From 9ac721874a85a88397999cf2fca75f000863ed38 Mon Sep 17 00:00:00 2001
From: "l.morris" Constructor for AbstractFilteredCdmResourceSelectionDialog.
select
- * - * @param shell a {@link org.eclipse.swt.widgets.Shell} object. - * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object. - * @return a {@link eu.etaxonomy.cdm.model.taxon.TaxonBase} object. - */ - public static TaxonBase selectTaxonBase(Shell shell, ConversationHolder conversation) { - TaxonBaseSelectionDialog dialog = new TaxonBaseSelectionDialog(TaxonBase.class, shell, conversation, - "Choose a taxon", false, null); - return getSelectionFromDialog(dialog); - } - - /** - *select
- * - * @param shell a {@link org.eclipse.swt.widgets.Shell} object. - * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object. - * @return a {@link eu.etaxonomy.cdm.model.taxon.TaxonBase} object. - */ - public static Taxon selectTaxon(Shell shell, ConversationHolder conversation) { - TaxonBaseSelectionDialog dialog = new TaxonBaseSelectionDialog(Taxon.class, shell, conversation, - "Choose a taxon", false, null); - return (Taxon) getSelectionFromDialog(dialog); - } - - /** - *select
- * - * @param shell a {@link org.eclipse.swt.widgets.Shell} object. - * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object. - * @return a {@link eu.etaxonomy.cdm.model.taxon.TaxonBase} object. - */ - public static Synonym selectSynonym(Shell shell, ConversationHolder conversation) { - TaxonBaseSelectionDialog dialog = new TaxonBaseSelectionDialog(Synonym.class, shell, conversation, - "Choose a taxon", false, null); - return (Synonym) getSelectionFromDialog(dialog); - } - - private final Class extends TaxonBase> clazz; - - /** - *Constructor for FilteredTaxonBaseSelectionDialog.
- * - * @param shell a {@link org.eclipse.swt.widgets.Shell} object. - * @param title a {@link java.lang.String} object. - * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object. - * @param multi a boolean. - * @param taxon a {@link eu.etaxonomy.cdm.model.taxon.TaxonBase} object. - */ - protected TaxonBaseSelectionDialog(Class extends TaxonBase> clazz, Shell shell, ConversationHolder conversation, String title, boolean multi, TaxonBase taxon) { - super(shell, conversation, title, multi, ReferenceSelectionDialog.class.getCanonicalName(), taxon); - this.clazz = clazz; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.dialogs.FilteredItemsSelectionDialog#createExtendedContentArea(org.eclipse.swt.widgets.Composite) - */ - /** {@inheritDoc} */ - @Override - protected Control createExtendedContentArea(Composite parent) { - return null; - } - - /* (non-Javadoc) - * @see eu.etaxonomy.taxeditor.dialogs.AbstractFilteredCdmResourceSelectionDialog#getPersistentObject(java.util.UUID) - */ - /** {@inheritDoc} */ - @Override - protected TaxonBase getPersistentObject(UUID uuid) { - return CdmStore.getService(ITaxonService.class).load(uuid); - } - - /* (non-Javadoc) - * @see eu.etaxonomy.taxeditor.dialogs.AbstractFilteredCdmResourceSelectionDialog#initModel() - */ - /** {@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; - } -} +// $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; + +/** + *FilteredTaxonBaseSelectionDialog class.
+ * + * @author n.hoffmann + * @created Sep 21, 2009 + * @version 1.0 + */ +public class TaxonBaseSelectionDialog extends + AbstractFilteredCdmResourceSelectionDialogselect
+ * + * @param shell a {@link org.eclipse.swt.widgets.Shell} object. + * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object. + * @return a {@link eu.etaxonomy.cdm.model.taxon.TaxonBase} object. + */ + public static TaxonBase selectTaxonBase(Shell shell, ConversationHolder conversation) { + AbstractFilteredCdmResourceSelectionDialogselect
+ * + * @param shell a {@link org.eclipse.swt.widgets.Shell} object. + * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object. + * @return a {@link eu.etaxonomy.cdm.model.taxon.TaxonBase} object. + */ + public static Taxon selectTaxon(Shell shell, ConversationHolder conversation, Taxon taxonToBeFiltered) { + + + AbstractFilteredCdmResourceSelectionDialogselect
+ * + * @param shell a {@link org.eclipse.swt.widgets.Shell} object. + * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object. + * @return a {@link eu.etaxonomy.cdm.model.taxon.TaxonBase} object. + */ + public static Synonym selectSynonym(Shell shell, ConversationHolder conversation) { + AbstractFilteredCdmResourceSelectionDialogConstructor for FilteredTaxonBaseSelectionDialog.
+ * + * @param shell a {@link org.eclipse.swt.widgets.Shell} object. + * @param title a {@link java.lang.String} object. + * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object. + * @param multi a boolean. + * @param taxon a {@link eu.etaxonomy.cdm.model.taxon.TaxonBase} object. + */ + 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; + } + + /* (non-Javadoc) + * @see org.eclipse.ui.dialogs.FilteredItemsSelectionDialog#createExtendedContentArea(org.eclipse.swt.widgets.Composite) + */ + /** {@inheritDoc} */ + @Override + protected Control createExtendedContentArea(Composite parent) { + return null; + } + + /* (non-Javadoc) + * @see eu.etaxonomy.taxeditor.dialogs.AbstractFilteredCdmResourceSelectionDialog#getPersistentObject(java.util.UUID) + */ + /** {@inheritDoc} */ + @Override + protected TaxonBase getPersistentObject(UUID uuid) { + return CdmStore.getService(ITaxonService.class).load(uuid); + } + + /* (non-Javadoc) + * @see eu.etaxonomy.taxeditor.dialogs.AbstractFilteredCdmResourceSelectionDialog#initModel() + */ + /** {@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; + } +} diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/key/TaxonomicScopeSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/key/TaxonomicScopeSection.java index 4b5227e84..bd732e883 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/key/TaxonomicScopeSection.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/key/TaxonomicScopeSection.java @@ -62,7 +62,7 @@ public class TaxonomicScopeSection extends @Override public Taxon createNewElement() { Taxon selection = TaxonBaseSelectionDialog.selectTaxon(getShell(), - getConversationHolder()); + getConversationHolder(), null); return selection; } diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/TaxonSelectionElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/TaxonSelectionElement.java index 156f18a36..8b0d65f0e 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/TaxonSelectionElement.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/TaxonSelectionElement.java @@ -54,7 +54,7 @@ public class TaxonSelectionElement extends AbstractSelectionElement