X-Git-Url: https://dev.e-taxonomy.eu/gitweb/taxeditor.git/blobdiff_plain/915cda99cebe8dd83a1f63bf0126e52269335825..3be6ef3e47d2a22ca199d2d66a13caf1252fd0d1:/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/operations/ChangeSynonymToHomotypicalGroupBasionymOperation.java diff --git a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/operations/ChangeSynonymToHomotypicalGroupBasionymOperation.java b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/operations/ChangeSynonymToHomotypicalGroupBasionymOperation.java index 017a75a47..39c903c92 100644 --- a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/operations/ChangeSynonymToHomotypicalGroupBasionymOperation.java +++ b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/operations/ChangeSynonymToHomotypicalGroupBasionymOperation.java @@ -1,84 +1,97 @@ -/** -* 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.operations; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.commands.operations.IUndoContext; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; - -import eu.etaxonomy.cdm.model.taxon.Synonym; -import eu.etaxonomy.cdm.model.taxon.Taxon; - -/** - * @author p.ciardelli - * @created 14.01.2009 - * @version 1.0 - * @deprecated there will be an operation to set the basionym only that automatically unsets the former basionym - */ -public class ChangeSynonymToHomotypicalGroupBasionymOperation extends AbstractPostOperation { - - private Synonym synonym; - - public ChangeSynonymToHomotypicalGroupBasionymOperation(String text, IUndoContext undoContext, - Taxon taxon, Synonym synonym) { - super(text, undoContext, taxon); - - this.synonym = synonym; - } - - /* (non-Javadoc) - * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable) - */ - @Override - public IStatus execute(IProgressMonitor monitor, IAdaptable info) - throws ExecutionException { - - monitor.worked(20); -// // Get basionym for synonyms homotypic group -// homotypicGroup = synonym.getHomotypicGroup(); -// TaxonNameBase basionym = homotypicGroup.getBasionym(); -// -// // Check if synonym is already basionym -// if(basionym != null && basionym.equals(synonym.getName())){ -// return Status.OK_STATUS; -// } - - // TODO replace w method from cdmlib - // FIXME this is also old code: reimplement -// CdmUtil.setGroupBasionym(synonym.getName()); - monitor.worked(40); - - return postExecute(synonym); - } - - /* (non-Javadoc) - * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable) - */ - @Override - public IStatus redo(IProgressMonitor monitor, IAdaptable info) - throws ExecutionException { - return execute(monitor, info); - } - - /* (non-Javadoc) - * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable) - */ - @Override - public IStatus undo(IProgressMonitor monitor, IAdaptable info) - throws ExecutionException { - // TODO replace w method from cdmlib - // FIXME this is also old code: reimplement -// CdmUtil.removeGroupBasionym(synonym.getName()); - - return postExecute(synonym); - } -} +/** +* 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.operations; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.operations.IUndoContext; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; + +import eu.etaxonomy.cdm.model.taxon.Synonym; +import eu.etaxonomy.cdm.model.taxon.Taxon; + +/** + *

ChangeSynonymToHomotypicalGroupBasionymOperation class.

+ * + * @author p.ciardelli + * @created 14.01.2009 + * @version 1.0 + * @deprecated there will be an operation to set the basionym only that automatically unsets the former basionym + */ +public class ChangeSynonymToHomotypicalGroupBasionymOperation extends AbstractPostOperation { + + private Synonym synonym; + + /** + *

Constructor for ChangeSynonymToHomotypicalGroupBasionymOperation.

+ * + * @param text a {@link java.lang.String} object. + * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object. + * @param taxon a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object. + * @param synonym a {@link eu.etaxonomy.cdm.model.taxon.Synonym} object. + */ + public ChangeSynonymToHomotypicalGroupBasionymOperation(String text, IUndoContext undoContext, + Taxon taxon, Synonym synonym) { + super(text, undoContext, taxon); + + this.synonym = synonym; + } + + /* (non-Javadoc) + * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable) + */ + /** {@inheritDoc} */ + @Override + public IStatus execute(IProgressMonitor monitor, IAdaptable info) + throws ExecutionException { + + monitor.worked(20); +// // Get basionym for synonyms homotypic group +// homotypicGroup = synonym.getHomotypicGroup(); +// TaxonNameBase basionym = homotypicGroup.getBasionym(); +// +// // Check if synonym is already basionym +// if(basionym != null && basionym.equals(synonym.getName())){ +// return Status.OK_STATUS; +// } + + // TODO replace w method from cdmlib + // FIXME this is also old code: reimplement +// CdmUtil.setGroupBasionym(synonym.getName()); + monitor.worked(40); + + return postExecute(synonym); + } + + /* (non-Javadoc) + * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable) + */ + /** {@inheritDoc} */ + @Override + public IStatus redo(IProgressMonitor monitor, IAdaptable info) + throws ExecutionException { + return execute(monitor, info); + } + + /* (non-Javadoc) + * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable) + */ + /** {@inheritDoc} */ + @Override + public IStatus undo(IProgressMonitor monitor, IAdaptable info) + throws ExecutionException { + // TODO replace w method from cdmlib + // FIXME this is also old code: reimplement +// CdmUtil.removeGroupBasionym(synonym.getName()); + + return postExecute(synonym); + } +}