From dab3119d5f4ec8a80c3759d1903f0ac0ff2606d9 Mon Sep 17 00:00:00 2001 From: Patrick Plitzner Date: Wed, 13 Jan 2016 19:16:17 +0100 Subject: [PATCH 1/1] Trim code --- .../selection/TaxonBaseSelectionDialog.java | 245 ++++++++---------- 1 file changed, 101 insertions(+), 144 deletions(-) diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/TaxonBaseSelectionDialog.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/TaxonBaseSelectionDialog.java index b4901d2d3..938609096 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/TaxonBaseSelectionDialog.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/TaxonBaseSelectionDialog.java @@ -1,144 +1,101 @@ -// $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 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) { - AbstractFilteredCdmResourceSelectionDialog dialog = new TaxonBaseSelectionDialog(TaxonBase.class, shell, conversation, - "Choose a taxon", false, null, 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, Taxon taxonToBeFiltered) { - - - AbstractFilteredCdmResourceSelectionDialog dialog = new TaxonBaseSelectionDialog(Taxon.class, shell, conversation, - "Choose a taxon", false, null, taxonToBeFiltered); - 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) { - AbstractFilteredCdmResourceSelectionDialog dialog = new TaxonBaseSelectionDialog(Synonym.class, shell, conversation, - "Choose a taxon", false, null, null); - return (Synonym) getSelectionFromDialog(dialog); - } - - private final Class 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 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(); - } - - /* (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; + +/** + * @author n.hoffmann + * @created Sep 21, 2009 + * @version 1.0 + */ +public class TaxonBaseSelectionDialog extends AbstractFilteredCdmResourceSelectionDialog { + + + public static TaxonBase selectTaxonBase(Shell shell, ConversationHolder conversation) { + AbstractFilteredCdmResourceSelectionDialog 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 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 dialog = new TaxonBaseSelectionDialog(Synonym.class, shell, conversation, + "Choose a taxon", false, null, null); + return (Synonym) getSelectionFromDialog(dialog); + } + + private final Class clazz; + + protected TaxonBaseSelectionDialog(Class 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; + } +} -- 2.34.1