Trim code
authorPatrick Plitzner <p.plitzner@bgbm.org>
Wed, 13 Jan 2016 18:16:17 +0000 (19:16 +0100)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Wed, 13 Jan 2016 18:16:17 +0000 (19:16 +0100)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/TaxonBaseSelectionDialog.java

index b4901d2d38fb7d3f31d3cd24fb74c49afd642d2d..93860909685b64708e50f515cf973e8c700b7062 100644 (file)
-// $Id$\r
-/**\r
- * Copyright (C) 2007 EDIT\r
- * European Distributed Institute of Taxonomy\r
- * http://www.e-taxonomy.eu\r
- *\r
- * The contents of this file are subject to the Mozilla Public License Version 1.1\r
- * See LICENSE.TXT at the top of this package for the full license terms.\r
- */\r
-\r
-package eu.etaxonomy.taxeditor.ui.dialog.selection;\r
-\r
-import java.util.UUID;\r
-\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.swt.widgets.Control;\r
-import org.eclipse.swt.widgets.Shell;\r
-\r
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;\r
-import eu.etaxonomy.cdm.api.service.ITaxonService;\r
-import eu.etaxonomy.cdm.model.taxon.Synonym;\r
-import eu.etaxonomy.cdm.model.taxon.Taxon;\r
-import eu.etaxonomy.cdm.model.taxon.TaxonBase;\r
-import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;\r
-import eu.etaxonomy.taxeditor.store.CdmStore;\r
-\r
-/**\r
- * <p>FilteredTaxonBaseSelectionDialog class.</p>\r
- *\r
- * @author n.hoffmann\r
- * @created Sep 21, 2009\r
- * @version 1.0\r
- */\r
-public class TaxonBaseSelectionDialog extends AbstractFilteredCdmResourceSelectionDialog<TaxonBase> {\r
-\r
-\r
-    /**\r
-     * <p>select</p>\r
-     *\r
-     * @param shell a {@link org.eclipse.swt.widgets.Shell} object.\r
-     * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.\r
-     * @return a {@link eu.etaxonomy.cdm.model.taxon.TaxonBase} object.\r
-     */\r
-    public static TaxonBase selectTaxonBase(Shell shell, ConversationHolder conversation) {\r
-        AbstractFilteredCdmResourceSelectionDialog<TaxonBase> dialog = new TaxonBaseSelectionDialog(TaxonBase.class, shell, conversation,\r
-                "Choose a taxon", false, null, null);\r
-        return getSelectionFromDialog(dialog);\r
-    }\r
-\r
-    /**\r
-     * <p>select</p>\r
-     *\r
-     * @param shell a {@link org.eclipse.swt.widgets.Shell} object.\r
-     * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.\r
-     * @return a {@link eu.etaxonomy.cdm.model.taxon.TaxonBase} object.\r
-     */\r
-    public static Taxon selectTaxon(Shell shell, ConversationHolder conversation, Taxon taxonToBeFiltered) {\r
-\r
-\r
-        AbstractFilteredCdmResourceSelectionDialog<TaxonBase> dialog = new TaxonBaseSelectionDialog(Taxon.class, shell, conversation,\r
-                "Choose a taxon", false, null, taxonToBeFiltered);\r
-        return (Taxon) getSelectionFromDialog(dialog);\r
-    }\r
-\r
-    /**\r
-     * <p>select</p>\r
-     *\r
-     * @param shell a {@link org.eclipse.swt.widgets.Shell} object.\r
-     * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.\r
-     * @return a {@link eu.etaxonomy.cdm.model.taxon.TaxonBase} object.\r
-     */\r
-    public static Synonym selectSynonym(Shell shell, ConversationHolder conversation) {\r
-        AbstractFilteredCdmResourceSelectionDialog<TaxonBase> dialog = new TaxonBaseSelectionDialog(Synonym.class, shell, conversation,\r
-                "Choose a taxon", false, null, null);\r
-        return (Synonym) getSelectionFromDialog(dialog);\r
-    }\r
-\r
-    private final Class<? extends TaxonBase> clazz;\r
-\r
-    /**\r
-     * <p>Constructor for FilteredTaxonBaseSelectionDialog.</p>\r
-     *\r
-     * @param shell a {@link org.eclipse.swt.widgets.Shell} object.\r
-     * @param title a {@link java.lang.String} object.\r
-     * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.\r
-     * @param multi a boolean.\r
-     * @param taxon a {@link eu.etaxonomy.cdm.model.taxon.TaxonBase} object.\r
-     */\r
-    protected TaxonBaseSelectionDialog(Class<? extends TaxonBase> clazz, Shell shell, ConversationHolder conversation, String title, boolean multi, TaxonBase taxon, TaxonBase taxonToBeFiltered) {\r
-        super(shell, conversation, title, multi, ReferenceSelectionDialog.class.getCanonicalName(), taxon);\r
-        this.cdmBaseToBeFiltered = taxonToBeFiltered;\r
-        this.clazz = clazz;\r
-        initModel();\r
-    }\r
-\r
-    /* (non-Javadoc)\r
-     * @see org.eclipse.ui.dialogs.FilteredItemsSelectionDialog#createExtendedContentArea(org.eclipse.swt.widgets.Composite)\r
-     */\r
-    /** {@inheritDoc} */\r
-    @Override\r
-    protected Control createExtendedContentArea(Composite parent) {\r
-        return null;\r
-    }\r
-\r
-    /* (non-Javadoc)\r
-     * @see eu.etaxonomy.taxeditor.dialogs.AbstractFilteredCdmResourceSelectionDialog#getPersistentObject(java.util.UUID)\r
-     */\r
-    /** {@inheritDoc} */\r
-    @Override\r
-    protected TaxonBase getPersistentObject(UUID uuid) {\r
-        return CdmStore.getService(ITaxonService.class).load(uuid);\r
-    }\r
-\r
-    /* (non-Javadoc)\r
-     * @see eu.etaxonomy.taxeditor.dialogs.AbstractFilteredCdmResourceSelectionDialog#initModel()\r
-     */\r
-    /** {@inheritDoc} */\r
-    @Override\r
-    protected void initModel() {\r
-        if(clazz == TaxonBase.class){\r
-            model = CdmStore.getService(ITaxonService.class).getUuidAndTitleCache();\r
-        }\r
-        else if(clazz == Taxon.class){\r
-\r
-            model = CdmStore.getService(ITaxonService.class).getUuidAndTitleCacheTaxon();\r
-\r
-        }\r
-        else if(clazz == Synonym.class){\r
-            model = CdmStore.getService(ITaxonService.class).getUuidAndTitleCacheSynonym();\r
-        }\r
-    }\r
-\r
-    /** {@inheritDoc} */\r
-    @Override\r
-    protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {\r
-        return null;\r
-    }\r
-\r
-    /** {@inheritDoc} */\r
-    @Override\r
-    protected String getNewWizardLinkText() {\r
-        return null;\r
-    }\r
-}\r
+// $Id$
+/**
+ * Copyright (C) 2007 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 java.util.UUID;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.service.ITaxonService;
+import eu.etaxonomy.cdm.model.taxon.Synonym;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author n.hoffmann
+ * @created Sep 21, 2009
+ * @version 1.0
+ */
+public class TaxonBaseSelectionDialog extends AbstractFilteredCdmResourceSelectionDialog<TaxonBase> {
+
+
+    public static TaxonBase selectTaxonBase(Shell shell, ConversationHolder conversation) {
+        AbstractFilteredCdmResourceSelectionDialog<TaxonBase> dialog = new TaxonBaseSelectionDialog(TaxonBase.class, shell, conversation,
+                "Choose a taxon", false, null, null);
+        return getSelectionFromDialog(dialog);
+    }
+
+    public static Taxon selectTaxon(Shell shell, ConversationHolder conversation, Taxon taxonToBeFiltered) {
+
+
+        AbstractFilteredCdmResourceSelectionDialog<TaxonBase> dialog = new TaxonBaseSelectionDialog(Taxon.class, shell, conversation,
+                "Choose a taxon", false, null, taxonToBeFiltered);
+        return (Taxon) getSelectionFromDialog(dialog);
+    }
+
+    public static Synonym selectSynonym(Shell shell, ConversationHolder conversation) {
+        AbstractFilteredCdmResourceSelectionDialog<TaxonBase> dialog = new TaxonBaseSelectionDialog(Synonym.class, shell, conversation,
+                "Choose a taxon", false, null, null);
+        return (Synonym) getSelectionFromDialog(dialog);
+    }
+
+    private final Class<? extends TaxonBase> clazz;
+
+    protected TaxonBaseSelectionDialog(Class<? extends TaxonBase> clazz, Shell shell, ConversationHolder conversation, String title, boolean multi, TaxonBase taxon, TaxonBase taxonToBeFiltered) {
+        super(shell, conversation, title, multi, ReferenceSelectionDialog.class.getCanonicalName(), taxon);
+        this.cdmBaseToBeFiltered = taxonToBeFiltered;
+        this.clazz = clazz;
+        initModel();
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    protected Control createExtendedContentArea(Composite parent) {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    protected TaxonBase getPersistentObject(UUID uuid) {
+        return CdmStore.getService(ITaxonService.class).load(uuid);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    protected void initModel() {
+        if(clazz == TaxonBase.class){
+            model = CdmStore.getService(ITaxonService.class).getUuidAndTitleCache();
+        }
+        else if(clazz == Taxon.class){
+            model = CdmStore.getService(ITaxonService.class).getUuidAndTitleCacheTaxon();
+        }
+        else if(clazz == Synonym.class){
+            model = CdmStore.getService(ITaxonService.class).getUuidAndTitleCacheSynonym();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    protected String getNewWizardLinkText() {
+        return null;
+    }
+}