From: Patrick Plitzner Date: Tue, 14 Jun 2016 09:38:39 +0000 (+0200) Subject: Saving files before refreshing line endings X-Git-Tag: 4.2.0^2~58 X-Git-Url: https://dev.e-taxonomy.eu/gitweb/taxeditor.git/commitdiff_plain/23b1c77b19f6e95c7b052a45628be0ad30bdca81 Saving files before refreshing line endings --- diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/NomenclaturalAuthorSelectionDialog.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/NomenclaturalAuthorSelectionDialog.java index f5a5e41c9..5a9e10a1d 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/NomenclaturalAuthorSelectionDialog.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/NomenclaturalAuthorSelectionDialog.java @@ -1,84 +1,84 @@ -// $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.Shell; - -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.TeamOrPersonBase; -import eu.etaxonomy.taxeditor.store.CdmStore; - -/** - * @author k.luther - * @date 25.05.2016 - * - */ -public class NomenclaturalAuthorSelectionDialog extends AgentSelectionDialog { - - - /** - * @param shell - * @param conversation - * @param title - * @param multi - * @param settings - * @param agent - */ - protected NomenclaturalAuthorSelectionDialog(Shell shell, ConversationHolder conversation, String title, - boolean multi, String settings, AgentBase agent) { - super(shell, conversation, title, multi, settings, agent); - // TODO Auto-generated constructor stub - } - - @Override - protected void initModel() { - model = CdmStore.getService(IAgentService.class).getUuidAndAbbrevTitleCache(null, null, null); - } - - /** - *

select

- * - * @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) { - NomenclaturalAuthorSelectionDialog dialog = new NomenclaturalAuthorSelectionDialog(shell, conversation, - "Choose Agent", false, NomenclaturalAuthorSelectionDialog.class.getCanonicalName(), entity); - return getSelectionFromDialog(dialog); - } - - /** - *

getTitle

- * - * @param cdmObject a T object. - * @return a {@link java.lang.String} object. - */ - @Override - protected String getTitle(AgentBase cdmObject) { - if(cdmObject == null){ - return ""; - } - - if (cdmObject instanceof TeamOrPersonBase) { - return ((TeamOrPersonBase) cdmObject).getNomenclaturalTitle(); - } else if (cdmObject instanceof AgentBase){ - return ((TeamOrPersonBase) cdmObject).getTitleCache(); - } - - throw new IllegalArgumentException("Generic method only" + - " supports cdmObject of type IIdentifiableEntity." + - " Please implement specific method in subclass."); - } - -} +// $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.Shell; + +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.TeamOrPersonBase; +import eu.etaxonomy.taxeditor.store.CdmStore; + +/** + * @author k.luther + * @date 25.05.2016 + * + */ +public class NomenclaturalAuthorSelectionDialog extends AgentSelectionDialog { + + + /** + * @param shell + * @param conversation + * @param title + * @param multi + * @param settings + * @param agent + */ + protected NomenclaturalAuthorSelectionDialog(Shell shell, ConversationHolder conversation, String title, + boolean multi, String settings, AgentBase agent) { + super(shell, conversation, title, multi, settings, agent); + // TODO Auto-generated constructor stub + } + + @Override + protected void initModel() { + model = CdmStore.getService(IAgentService.class).getUuidAndAbbrevTitleCache(null, null, null); + } + + /** + *

select

+ * + * @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) { + NomenclaturalAuthorSelectionDialog dialog = new NomenclaturalAuthorSelectionDialog(shell, conversation, + "Choose Agent", false, NomenclaturalAuthorSelectionDialog.class.getCanonicalName(), entity); + return getSelectionFromDialog(dialog); + } + + /** + *

getTitle

+ * + * @param cdmObject a T object. + * @return a {@link java.lang.String} object. + */ + @Override + protected String getTitle(AgentBase cdmObject) { + if(cdmObject == null){ + return ""; + } + + if (cdmObject instanceof TeamOrPersonBase) { + return ((TeamOrPersonBase) cdmObject).getNomenclaturalTitle(); + } else if (cdmObject instanceof AgentBase){ + return ((TeamOrPersonBase) cdmObject).getTitleCache(); + } + + throw new IllegalArgumentException("Generic method only" + + " supports cdmObject of type IIdentifiableEntity." + + " Please implement specific method in subclass."); + } + +} diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/SpecimenOrObservationBaseSelectionDialog.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/SpecimenOrObservationBaseSelectionDialog.java index 9a6a92ac2..f99ce3677 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/SpecimenOrObservationBaseSelectionDialog.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/SpecimenOrObservationBaseSelectionDialog.java @@ -1,67 +1,67 @@ -// $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.Shell; - -import eu.etaxonomy.cdm.api.conversation.ConversationHolder; -import eu.etaxonomy.cdm.api.service.IOccurrenceService; -import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper; -import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; -import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard; -import eu.etaxonomy.taxeditor.newWizard.NewDerivedUnitBaseWizard; -import eu.etaxonomy.taxeditor.store.CdmStore; - -/** - * @author pplitzner - */ -public class SpecimenOrObservationBaseSelectionDialog extends - AbstractFilteredCdmResourceSelectionDialog { - - public static SpecimenOrObservationBase select(Shell shell, ConversationHolder conversation, SpecimenOrObservationBase observation){ - SpecimenOrObservationBaseSelectionDialog dialog = new SpecimenOrObservationBaseSelectionDialog(shell, conversation, - "Choose field unit or derived unit", false, SpecimenOrObservationBaseSelectionDialog.class.getCanonicalName(), observation); - return getSelectionFromDialog(dialog); - } - - protected SpecimenOrObservationBaseSelectionDialog(Shell shell, ConversationHolder conversation, - String title, boolean multi, String settings, - SpecimenOrObservationBase cdmObject) { - super(shell, conversation, title, multi, settings, cdmObject); - } - - /** {@inheritDoc} */ - @Override - protected SpecimenOrObservationBase getPersistentObject(UUID uuid) { - Object object = CdmStore.getService(IOccurrenceService.class).load(uuid); - return HibernateProxyHelper.deproxy(object, SpecimenOrObservationBase.class); - } - - /** {@inheritDoc} */ - @Override - protected void initModel() { - model = CdmStore.getService(IOccurrenceService.class).getUuidAndTitleCache(null, null); - } - - /** {@inheritDoc} */ - @Override - protected AbstractNewEntityWizard getNewEntityWizard(String parameter) { - return new NewDerivedUnitBaseWizard(); - } - - /** {@inheritDoc} */ - @Override - protected String getNewWizardLinkText() { - return String.format("Create a new %1s", "field unit/derived unit"); - } -} +// $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.Shell; + +import eu.etaxonomy.cdm.api.conversation.ConversationHolder; +import eu.etaxonomy.cdm.api.service.IOccurrenceService; +import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper; +import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; +import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard; +import eu.etaxonomy.taxeditor.newWizard.NewDerivedUnitBaseWizard; +import eu.etaxonomy.taxeditor.store.CdmStore; + +/** + * @author pplitzner + */ +public class SpecimenOrObservationBaseSelectionDialog extends + AbstractFilteredCdmResourceSelectionDialog { + + public static SpecimenOrObservationBase select(Shell shell, ConversationHolder conversation, SpecimenOrObservationBase observation){ + SpecimenOrObservationBaseSelectionDialog dialog = new SpecimenOrObservationBaseSelectionDialog(shell, conversation, + "Choose field unit or derived unit", false, SpecimenOrObservationBaseSelectionDialog.class.getCanonicalName(), observation); + return getSelectionFromDialog(dialog); + } + + protected SpecimenOrObservationBaseSelectionDialog(Shell shell, ConversationHolder conversation, + String title, boolean multi, String settings, + SpecimenOrObservationBase cdmObject) { + super(shell, conversation, title, multi, settings, cdmObject); + } + + /** {@inheritDoc} */ + @Override + protected SpecimenOrObservationBase getPersistentObject(UUID uuid) { + Object object = CdmStore.getService(IOccurrenceService.class).load(uuid); + return HibernateProxyHelper.deproxy(object, SpecimenOrObservationBase.class); + } + + /** {@inheritDoc} */ + @Override + protected void initModel() { + model = CdmStore.getService(IOccurrenceService.class).getUuidAndTitleCache(null, null); + } + + /** {@inheritDoc} */ + @Override + protected AbstractNewEntityWizard getNewEntityWizard(String parameter) { + return new NewDerivedUnitBaseWizard(); + } + + /** {@inheritDoc} */ + @Override + protected String getNewWizardLinkText() { + return String.format("Create a new %1s", "field unit/derived unit"); + } +}