new NomenclaturalPersonAuthorSelectionDialog
authorKatja Luther <k.luther@bgbm.org>
Tue, 21 Jun 2016 11:47:02 +0000 (13:47 +0200)
committerKatja Luther <k.luther@bgbm.org>
Tue, 21 Jun 2016 11:47:02 +0000 (13:47 +0200)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/NomenclaturalPersonAuthorSelectionDialog.java [new file with mode: 0644]

diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/NomenclaturalPersonAuthorSelectionDialog.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/NomenclaturalPersonAuthorSelectionDialog.java
new file mode 100644 (file)
index 0000000..0e70020
--- /dev/null
@@ -0,0 +1,69 @@
+// $Id$
+/**
+* Copyright (C) 2016 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.ui.dialog.selection;
+
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.service.IAgentService;
+import eu.etaxonomy.cdm.model.agent.AgentBase;
+import eu.etaxonomy.cdm.model.agent.Person;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author k.luther
+ * @date 21.06.2016
+ *
+ */
+public class NomenclaturalPersonAuthorSelectionDialog extends NomenclaturalAuthorSelectionDialog {
+
+    /**
+     * @param shell
+     * @param conversation
+     * @param title
+     * @param multi
+     * @param settings
+     * @param agent
+     */
+    protected NomenclaturalPersonAuthorSelectionDialog(Shell shell, ConversationHolder conversation, String title,
+            boolean multi, String settings, AgentBase agent) {
+        super(shell, conversation, title, multi, settings, agent);
+        // TODO Auto-generated constructor stub
+    }
+
+
+    /**
+     * <p>select</p>
+     *
+     * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
+     * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
+     * @param entity a {@link eu.etaxonomy.cdm.model.agent.AgentBase} object.
+     * @return a {@link eu.etaxonomy.cdm.model.agent.AgentBase} object.
+     */
+    public static AgentBase select(Shell shell, ConversationHolder conversation, AgentBase entity) {
+        NomenclaturalPersonAuthorSelectionDialog dialog = new NomenclaturalPersonAuthorSelectionDialog(shell, conversation,
+                "Choose Agent", false, NomenclaturalAuthorSelectionDialog.class.getCanonicalName(), entity);
+        return getSelectionFromDialog(dialog);
+    }
+
+    @Override
+    protected void initModel() {
+        Control control = getPatternControl();
+        String pattern = null;
+        if (control != null){
+            pattern = ((Text)control).getText();
+        }
+
+        model = CdmStore.getService(IAgentService.class).getUuidAndAbbrevTitleCache(limitOfInitialElements, pattern, Person.class);
+    }
+
+}