- adapted sub classes of AbstractPostOperation
authorPatric Plitzner <p.plitzner@bgbm.org>
Wed, 4 Dec 2013 08:34:15 +0000 (08:34 +0000)
committerPatric Plitzner <p.plitzner@bgbm.org>
Wed, 4 Dec 2013 08:34:15 +0000 (08:34 +0000)
28 files changed:
.gitattributes
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeConceptRelationshipTypeOperation.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeConceptToSynonymOperation.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeHomotypicGroupOperation.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeSynonymToAcceptedTaxonOperation.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeSynonymToConceptOperation.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeSynonymToMisapplicationOperation.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/CreateSynonymInExistingHomotypicalGroupOperation.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/CreateSynonymInNewGroupOperation.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteMisapplicationOperation.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteSynonymOperation.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteTaxonOperation.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/SwapSynonymAndAcceptedOperation.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/operation/CreateConceptRelationOperation.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/operation/DeleteConceptRelationOperation.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptiveContentProvider.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptiveViewPart.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/CreateTaxonDescriptionOperation.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/DeleteTaxonDescriptionOperation.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/operation/CreateImageOperation.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/operation/CreateTaxonUseOperation.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/operation/CreateUseRecordOperation.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/operation/CreateUseSummaryOperation.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/DeleteOperation.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractDescriptionPostOperation.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractPostDescribableOperation.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractPostOperation.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractPostTaxonOperation.java

index 1b676b7ded8d5a882829fca9815fe4d89459e1cb..5d3b3263f4bd23a3a7074c542aef3a56282d9b8e 100644 (file)
@@ -1191,8 +1191,8 @@ eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewT
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewTeamWizard.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewUserWizard.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/PolytomousKeyWizardPage.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewTeamWizard.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewUserWizard.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/PolytomousKeyWizardPage.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractDescriptionPostOperation.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractPersistentPostOperation.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractPersistentPostOperation.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractPostDescribableOperation.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractPostOperation.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractPostTaxonOperation.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/IPostOperationEnabled.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractPostOperation.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractPostTaxonOperation.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/IPostOperationEnabled.java -text
index ef6b021c66ef9d4353e260b4e775a697a98c298a..850747b6252772404bb0d6cfbb7f5145d9914067 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * Copyright (C) 2007 EDIT
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
 * 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.
 */
 * 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.
 */
@@ -32,13 +32,13 @@ import eu.etaxonomy.taxeditor.store.StoreUtil;
  * @version 1.0
  */
 public class ChangeConceptRelationshipTypeOperation extends AbstractPostTaxonOperation {
  * @version 1.0
  */
 public class ChangeConceptRelationshipTypeOperation extends AbstractPostTaxonOperation {
-       
+
        private Taxon relatedTaxon;
        private Taxon relatedTaxon;
-       
+
        private TaxonRelationship taxonRelationship;
        private TaxonRelationship taxonRelationship;
-       
+
        private TaxonRelationshipType oldRelationshipType;
        private TaxonRelationshipType oldRelationshipType;
-       
+
        private TaxonRelationshipType newRelationshipType;
 
        /**
        private TaxonRelationshipType newRelationshipType;
 
        /**
@@ -55,20 +55,20 @@ public class ChangeConceptRelationshipTypeOperation extends AbstractPostTaxonOpe
                        IUndoContext undoContext, Taxon taxon, Taxon relatedTaxon, TaxonRelationshipType type, IPostOperationEnabled postOperationEnabled) {
                super(label, undoContext, taxon, postOperationEnabled);
                this.relatedTaxon = relatedTaxon;
                        IUndoContext undoContext, Taxon taxon, Taxon relatedTaxon, TaxonRelationshipType type, IPostOperationEnabled postOperationEnabled) {
                super(label, undoContext, taxon, postOperationEnabled);
                this.relatedTaxon = relatedTaxon;
-                               
+
                Set<TaxonRelationship> taxonRelationships = taxon.getTaxonRelations(relatedTaxon);
                Set<TaxonRelationship> taxonRelationships = taxon.getTaxonRelations(relatedTaxon);
-               
+
                if(taxonRelationships.size() > 1){
                        StoreUtil.warningDialog("Multiple relations between taxa", this, "There are multiple relations between the " +
                                        "accepted and the related taxon. This case is not handled by the software yet");
                        return;
                }
                if(taxonRelationships.size() > 1){
                        StoreUtil.warningDialog("Multiple relations between taxa", this, "There are multiple relations between the " +
                                        "accepted and the related taxon. This case is not handled by the software yet");
                        return;
                }
-               
+
                this.taxonRelationship = taxonRelationships.iterator().next();
                this.oldRelationshipType = taxonRelationship.getType();
                this.newRelationshipType = type;
        }
                this.taxonRelationship = taxonRelationships.iterator().next();
                this.oldRelationshipType = taxonRelationship.getType();
                this.newRelationshipType = type;
        }
-       
+
        /* (non-Javadoc)
         * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
         */
        /* (non-Javadoc)
         * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
         */
@@ -76,17 +76,17 @@ public class ChangeConceptRelationshipTypeOperation extends AbstractPostTaxonOpe
        @Override
        public IStatus execute(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
        @Override
        public IStatus execute(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
-               
+
                // Remove relatedTaxon and old relationship
                // FIXME since taxon relationships come in a set, which relationships are we going to delete here?
                // Remove relatedTaxon and old relationship
                // FIXME since taxon relationships come in a set, which relationships are we going to delete here?
-               taxon.removeTaxon(relatedTaxon, oldRelationshipType);
+           element.removeTaxon(relatedTaxon, oldRelationshipType);
                monitor.worked(20);
                monitor.worked(20);
-        
+
         // Add new relationship
                // TODO add microcitation for misapplied name to property sheet
         // Add new relationship
                // TODO add microcitation for misapplied name to property sheet
-               relatedTaxon.addTaxonRelation(taxon, newRelationshipType, null, null);  
+               relatedTaxon.addTaxonRelation(element, newRelationshipType, null, null);
                monitor.worked(40);
                monitor.worked(40);
-               
+
                return postExecute(relatedTaxon);
        }
 
                return postExecute(relatedTaxon);
        }
 
index 9f5221ddc9c1d79951abcaa95778d88f8a5bcaf3..62e56bcd4bf62e262f88642a72080bef78febb07 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * Copyright (C) 2007 EDIT
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
 * 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.
 */
 * 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.
 */
@@ -37,14 +37,14 @@ import eu.etaxonomy.taxeditor.store.StoreUtil;
  */
 public class ChangeConceptToSynonymOperation extends
                AbstractPostTaxonOperation {
  */
 public class ChangeConceptToSynonymOperation extends
                AbstractPostTaxonOperation {
-       
+
        private Taxon concept;
 
        private HomotypicalGroup homotypicalGroup;
 
        private TaxonRelationship taxonRelationship;
        private TaxonRelationshipType oldRelationshipType;
        private Taxon concept;
 
        private HomotypicalGroup homotypicalGroup;
 
        private TaxonRelationship taxonRelationship;
        private TaxonRelationshipType oldRelationshipType;
-       
+
        private SynonymRelationship newSynonymRelationship;
 
        /**
        private SynonymRelationship newSynonymRelationship;
 
        /**
@@ -61,18 +61,18 @@ public class ChangeConceptToSynonymOperation extends
                        IUndoContext undoContext, Taxon taxon, Taxon concept, HomotypicalGroup homotypicalGroup,
                        IPostOperationEnabled editor) {
                super(label, undoContext, taxon, editor);
                        IUndoContext undoContext, Taxon taxon, Taxon concept, HomotypicalGroup homotypicalGroup,
                        IPostOperationEnabled editor) {
                super(label, undoContext, taxon, editor);
-               
+
                Set<TaxonRelationship> taxonRelationships = taxon.getTaxonRelations(concept);
                Set<TaxonRelationship> taxonRelationships = taxon.getTaxonRelations(concept);
-               
+
                if(taxonRelationships.size() > 1){
                        StoreUtil.warningDialog("Multiple relations between taxa", this, "There are multiple relations between the " +
                                        "accepted and the related taxon. This case is not handled by the software yet");
                        return;
                }
                if(taxonRelationships.size() > 1){
                        StoreUtil.warningDialog("Multiple relations between taxa", this, "There are multiple relations between the " +
                                        "accepted and the related taxon. This case is not handled by the software yet");
                        return;
                }
-               
+
                this.taxonRelationship = taxonRelationships.iterator().next();
                this.oldRelationshipType = taxonRelationship.getType();
                this.taxonRelationship = taxonRelationships.iterator().next();
                this.oldRelationshipType = taxonRelationship.getType();
-               
+
                this.concept = concept;
                this.homotypicalGroup = homotypicalGroup != null ? homotypicalGroup : HomotypicalGroup.NewInstance();
        }
                this.concept = concept;
                this.homotypicalGroup = homotypicalGroup != null ? homotypicalGroup : HomotypicalGroup.NewInstance();
        }
@@ -84,21 +84,21 @@ public class ChangeConceptToSynonymOperation extends
        @Override
        public IStatus execute(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
        @Override
        public IStatus execute(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
-               
+
                // Create new synonym using concept name
                TaxonNameBase<?, ?> synonymName = concept.getName();
                // Create new synonym using concept name
                TaxonNameBase<?, ?> synonymName = concept.getName();
-               
+
                // Remove concept relation from taxon
                // Remove concept relation from taxon
-               taxon.removeTaxon(concept, oldRelationshipType);
+               element.removeTaxon(concept, oldRelationshipType);
                monitor.worked(20);
                monitor.worked(20);
-        
+
                // Add name to new homotypic group
                homotypicalGroup.addTypifiedName(synonymName);
                monitor.worked(40);
                // Add name to new homotypic group
                homotypicalGroup.addTypifiedName(synonymName);
                monitor.worked(40);
-               
+
         // Create a new synonym for the taxon
         // Create a new synonym for the taxon
-               newSynonymRelationship = taxon.addHeterotypicSynonymName(synonymName);
-                       
+               newSynonymRelationship = element.addHeterotypicSynonymName(synonymName);
+
                return postExecute(newSynonymRelationship.getSynonym());
        }
 
                return postExecute(newSynonymRelationship.getSynonym());
        }
 
index 8ee04835c97bc6ac7c04564cc95cc24732b6bfd3..d2b5af65d4ca40bed8ed0ee913c01c0e4a6218ef 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * Copyright (C) 2007 EDIT
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
 * 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.
 */
 * 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.
 */
@@ -35,16 +35,16 @@ public class ChangeHomotypicGroupOperation extends AbstractPostTaxonOperation {
        /**
         * The synonym to be moved.
         */
        /**
         * The synonym to be moved.
         */
-       private Synonym synonym; 
+       private final Synonym synonym;
        /**
         * The former homotypical group the synonym belonged to
         */
        /**
         * The former homotypical group the synonym belonged to
         */
-       private HomotypicalGroup oldHomotypicalGroup;
+       private final HomotypicalGroup oldHomotypicalGroup;
        /**
         * The homotypical group the synonym is to be moved to
         */
        /**
         * The homotypical group the synonym is to be moved to
         */
-       private HomotypicalGroup newHomotypicalGroup;
-       
+       private final HomotypicalGroup newHomotypicalGroup;
+
        /**
         * <p>Constructor for ChangeHomotypicGroupOperation.</p>
         *
        /**
         * <p>Constructor for ChangeHomotypicGroupOperation.</p>
         *
@@ -55,16 +55,16 @@ public class ChangeHomotypicGroupOperation extends AbstractPostTaxonOperation {
         * @param newHomotypicalGroup a {@link eu.etaxonomy.cdm.model.name.HomotypicalGroup} object.
         * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
         */
         * @param newHomotypicalGroup a {@link eu.etaxonomy.cdm.model.name.HomotypicalGroup} object.
         * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
         */
-       public ChangeHomotypicGroupOperation(String label, IUndoContext undoContext, 
+       public ChangeHomotypicGroupOperation(String label, IUndoContext undoContext,
                        Taxon taxon, Synonym synonym, HomotypicalGroup newHomotypicalGroup, IPostOperationEnabled postOperationEnabled) {
                super(label, undoContext, taxon, postOperationEnabled);
                        Taxon taxon, Synonym synonym, HomotypicalGroup newHomotypicalGroup, IPostOperationEnabled postOperationEnabled) {
                super(label, undoContext, taxon, postOperationEnabled);
-               
+
                this.synonym = synonym;
                if(synonym == null){
                        throw new IllegalArgumentException(
                                        "A null synonym was provided.");
                }
                this.synonym = synonym;
                if(synonym == null){
                        throw new IllegalArgumentException(
                                        "A null synonym was provided.");
                }
-               
+
                this.oldHomotypicalGroup = synonym.getHomotypicGroup();
                this.newHomotypicalGroup = newHomotypicalGroup != null ? newHomotypicalGroup : HomotypicalGroup.NewInstance();
        }
                this.oldHomotypicalGroup = synonym.getHomotypicGroup();
                this.newHomotypicalGroup = newHomotypicalGroup != null ? newHomotypicalGroup : HomotypicalGroup.NewInstance();
        }
@@ -76,32 +76,32 @@ public class ChangeHomotypicGroupOperation extends AbstractPostTaxonOperation {
        @Override
        public IStatus execute(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
        @Override
        public IStatus execute(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
-               
+
        // Get synonym name
                TaxonNameBase<?, ?> synonymName = synonym.getName();
                monitor.worked(20);
        // Get synonym name
                TaxonNameBase<?, ?> synonymName = synonym.getName();
                monitor.worked(20);
-        
+
                // TODO pass in homotypical group's taxon in case we are dragging from one editor to another
                // TODO pass in homotypical group's taxon in case we are dragging from one editor to another
-               
+
                // Switch groups
                oldHomotypicalGroup.removeTypifiedName(synonymName);
                monitor.worked(40);
 
                newHomotypicalGroup.addTypifiedName(synonymName);
                // Switch groups
                oldHomotypicalGroup.removeTypifiedName(synonymName);
                monitor.worked(40);
 
                newHomotypicalGroup.addTypifiedName(synonymName);
-               
-               if(! synonym.getAcceptedTaxa().contains(taxon)){
+
+               if(! synonym.getAcceptedTaxa().contains(element)){
                        for(Taxon acceptedTaxon : synonym.getAcceptedTaxa()){
                                acceptedTaxon.removeSynonym(synonym);
                        }
                        for(Taxon acceptedTaxon : synonym.getAcceptedTaxa()){
                                acceptedTaxon.removeSynonym(synonym);
                        }
-                       
+
                        SynonymRelationshipType type = SynonymRelationshipType.HETEROTYPIC_SYNONYM_OF();
                        SynonymRelationshipType type = SynonymRelationshipType.HETEROTYPIC_SYNONYM_OF();
-                       if(newHomotypicalGroup.getTypifiedNames().contains(taxon.getName())){
+                       if(newHomotypicalGroup.getTypifiedNames().contains(element.getName())){
                                type = SynonymRelationshipType.HOMOTYPIC_SYNONYM_OF();
                        }
                                type = SynonymRelationshipType.HOMOTYPIC_SYNONYM_OF();
                        }
-                       
-                       taxon.addSynonym(synonym, type);
+
+                       element.addSynonym(synonym, type);
                }
                }
-               
+
                // Redraw editor if it exists
                return postExecute(synonym);
        }
                // Redraw editor if it exists
                return postExecute(synonym);
        }
@@ -123,19 +123,19 @@ public class ChangeHomotypicGroupOperation extends AbstractPostTaxonOperation {
        @Override
        public IStatus undo(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
        @Override
        public IStatus undo(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
-               
+
                // Get synonym name
                TaxonNameBase<?, ?> synonymName = this.synonym.getName();
                if(synonymName == null){
                        // TODO
                }
                // Get synonym name
                TaxonNameBase<?, ?> synonymName = this.synonym.getName();
                if(synonymName == null){
                        // TODO
                }
-               
+
                // TODO pass in homotypical group's taxon in case we are dragging from one editor to another
                // TODO pass in homotypical group's taxon in case we are dragging from one editor to another
-               
+
                // Switch groups
                newHomotypicalGroup.removeTypifiedName(synonymName);
                // Switch groups
                newHomotypicalGroup.removeTypifiedName(synonymName);
-               oldHomotypicalGroup.addTypifiedName(synonymName);               
-               
+               oldHomotypicalGroup.addTypifiedName(synonymName);
+
                // Redraw editor if it exists
                return postExecute(synonym);
        }
                // Redraw editor if it exists
                return postExecute(synonym);
        }
index 5d8b351fdddda8a63fd5f34e275d05c4dabe0ce2..2c7f81315dbe265876a131b48dfa4249ac4b294f 100644 (file)
@@ -22,11 +22,10 @@ import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
 import eu.etaxonomy.cdm.model.taxon.Synonym;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.cdm.model.taxon.TaxonNode;
 import eu.etaxonomy.cdm.model.taxon.Synonym;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.cdm.model.taxon.TaxonNode;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation;
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation;
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
 import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.store.StoreUtil;
 
 /**
  * Change the taxonomic parent of a given taxon.
 
 /**
  * Change the taxonomic parent of a given taxon.
@@ -38,12 +37,12 @@ import eu.etaxonomy.taxeditor.store.StoreUtil;
 public class ChangeSynonymToAcceptedTaxonOperation extends AbstractPersistentPostOperation {
 
        private Taxon newTaxon;
 public class ChangeSynonymToAcceptedTaxonOperation extends AbstractPersistentPostOperation {
 
        private Taxon newTaxon;
-       private Synonym synonym;
-       private ITaxonTreeNode parentNode;
+       private final Synonym synonym;
+       private final ITaxonTreeNode parentNode;
 
        private TaxonNode newNode;
 
 
        private TaxonNode newNode;
 
-       private Synonym[] synonymsInHomotypicalGroup;
+       private final Synonym[] synonymsInHomotypicalGroup;
 
        /**
         * <p>Constructor for ChangeSynonymToAcceptedTaxonOperation.</p>
 
        /**
         * <p>Constructor for ChangeSynonymToAcceptedTaxonOperation.</p>
@@ -61,7 +60,7 @@ public class ChangeSynonymToAcceptedTaxonOperation extends AbstractPersistentPos
                        Taxon taxon, ITaxonTreeNode parentNode, Synonym synonym, Synonym[] synonymsInHomotypicalGroup, IPostOperationEnabled postOperationEnabled, IConversationEnabled conversationEnabled) {
                super(label, undoContext, postOperationEnabled, conversationEnabled);
 
                        Taxon taxon, ITaxonTreeNode parentNode, Synonym synonym, Synonym[] synonymsInHomotypicalGroup, IPostOperationEnabled postOperationEnabled, IConversationEnabled conversationEnabled) {
                super(label, undoContext, postOperationEnabled, conversationEnabled);
 
-               this.taxon = taxon;
+               this.element = taxon;
                this.parentNode = parentNode;
                this.synonym = synonym;
                this.synonymsInHomotypicalGroup = synonymsInHomotypicalGroup;
                this.parentNode = parentNode;
                this.synonym = synonym;
                this.synonymsInHomotypicalGroup = synonymsInHomotypicalGroup;
@@ -76,9 +75,9 @@ public class ChangeSynonymToAcceptedTaxonOperation extends AbstractPersistentPos
                        throws ExecutionException {
 
                try {
                        throws ExecutionException {
 
                try {
-                       newTaxon = CdmStore.getService(ITaxonService.class).changeSynonymToAcceptedTaxon(synonym, taxon, true, true, null, null);
+                       newTaxon = CdmStore.getService(ITaxonService.class).changeSynonymToAcceptedTaxon(synonym, element, true, true, null, null);
                } catch (HomotypicalGroupChangeException e) {
                } catch (HomotypicalGroupChangeException e) {
-                       EditorUtil.warningDialog("Operation may lead to inconsistent data", getClass(), e.getMessage());
+                       AbstractUtility.warningDialog("Operation may lead to inconsistent data", getClass(), e.getMessage());
                        return postExecute(null);
                }
                monitor.worked(20);
                        return postExecute(null);
                }
                monitor.worked(20);
@@ -117,9 +116,9 @@ public class ChangeSynonymToAcceptedTaxonOperation extends AbstractPersistentPos
                        throws ExecutionException {
 
                // TODO implement - biggest problem is that any window open for new taxon must be closed first
                        throws ExecutionException {
 
                // TODO implement - biggest problem is that any window open for new taxon must be closed first
-               StoreUtil.warn(this.getClass(), "Not yet implemented");
+               AbstractUtility.warn(this.getClass(), "Not yet implemented");
 
 
-               return postExecute(taxon);
+               return postExecute(element);
        }
 
 }
        }
 
 }
index 95ae23f9df159bf9082dc9afa127f16b1b90331a..5bcc43ef5b07f4e03c952af3d1ba8eda8828ed20 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * Copyright (C) 2007 EDIT
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
 * 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.
 */
 * 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.
 */
@@ -32,9 +32,9 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
  * @version 1.0
  */
 public class ChangeSynonymToConceptOperation extends AbstractPostTaxonOperation {
  * @version 1.0
  */
 public class ChangeSynonymToConceptOperation extends AbstractPostTaxonOperation {
-       private Synonym synonym;
-       private TaxonRelationshipType taxonRelationshipType;
-       
+       private final Synonym synonym;
+       private final TaxonRelationshipType taxonRelationshipType;
+
        /**
         * <p>Constructor for ChangeSynonymToConceptOperation.</p>
         *
        /**
         * <p>Constructor for ChangeSynonymToConceptOperation.</p>
         *
@@ -48,10 +48,10 @@ public class ChangeSynonymToConceptOperation extends AbstractPostTaxonOperation
        public ChangeSynonymToConceptOperation(String label,
                        IUndoContext undoContext, Taxon taxon, Synonym synonym, TaxonRelationshipType taxonRelationshipType, IPostOperationEnabled postOperationEnabled) {
                super(label, undoContext, taxon, postOperationEnabled);
        public ChangeSynonymToConceptOperation(String label,
                        IUndoContext undoContext, Taxon taxon, Synonym synonym, TaxonRelationshipType taxonRelationshipType, IPostOperationEnabled postOperationEnabled) {
                super(label, undoContext, taxon, postOperationEnabled);
-               
+
                this.taxonRelationshipType = taxonRelationshipType;
                this.synonym = synonym;
                this.taxonRelationshipType = taxonRelationshipType;
                this.synonym = synonym;
-               
+
        }
 
        /* (non-Javadoc)
        }
 
        /* (non-Javadoc)
@@ -64,20 +64,20 @@ public class ChangeSynonymToConceptOperation extends AbstractPostTaxonOperation
 
 //             // Get name from synonym
 //             TaxonNameBase<?, ?> synonymName = synonym.getName();
 
 //             // Get name from synonym
 //             TaxonNameBase<?, ?> synonymName = synonym.getName();
-//             
+//
 //             // remove synonym from taxon
 //             taxon.removeSynonym(synonym);
 //             // remove synonym from taxon
 //             taxon.removeSynonym(synonym);
-//             
+//
 //             // Create a taxon with synonym name
 //             Taxon fromTaxon = Taxon.NewInstance(synonymName, null);
 //             // Create a taxon with synonym name
 //             Taxon fromTaxon = Taxon.NewInstance(synonymName, null);
-//             
-//             // Add taxon relation 
+//
+//             // Add taxon relation
 //             fromTaxon.addTaxonRelation(taxon, taxonRelationshipType, null, null);
 
                monitor.worked(20);
 //             fromTaxon.addTaxonRelation(taxon, taxonRelationshipType, null, null);
 
                monitor.worked(20);
-       Taxon fromTaxon = CdmStore.getService(ITaxonService.class).changeSynonymToRelatedTaxon(synonym, taxon, taxonRelationshipType, null, null);
+       Taxon fromTaxon = CdmStore.getService(ITaxonService.class).changeSynonymToRelatedTaxon(synonym, element, taxonRelationshipType, null, null);
                monitor.worked(40);
                monitor.worked(40);
-               
+
 //             TaxonRelationshipType.
 //             logger.warn("Not yet implemented.");
 
 //             TaxonRelationshipType.
 //             logger.warn("Not yet implemented.");
 
index 86490aa856dc67e66c7c17df5952609968ec30d4..3bd310bd30a9439dc44ee67de235be50e600e0fc 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * Copyright (C) 2007 EDIT
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
 * 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.
 */
 * 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.
 */
@@ -37,7 +37,7 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
  */
 public class ChangeSynonymToMisapplicationOperation extends AbstractPostTaxonOperation {
 
  */
 public class ChangeSynonymToMisapplicationOperation extends AbstractPostTaxonOperation {
 
-       private Synonym synonym;
+       private final Synonym synonym;
        private Taxon misapplication;
        private Set<SynonymRelationshipType> synonymTypes;
 
        private Taxon misapplication;
        private Set<SynonymRelationshipType> synonymTypes;
 
@@ -53,7 +53,7 @@ public class ChangeSynonymToMisapplicationOperation extends AbstractPostTaxonOpe
        public ChangeSynonymToMisapplicationOperation(String label,
                        IUndoContext undoContext, Taxon taxon, Synonym synonym, IPostOperationEnabled editor) {
                super(label, undoContext, taxon, editor);
        public ChangeSynonymToMisapplicationOperation(String label,
                        IUndoContext undoContext, Taxon taxon, Synonym synonym, IPostOperationEnabled editor) {
                super(label, undoContext, taxon, editor);
-               
+
                this.synonym = synonym;
        }
 
                this.synonym = synonym;
        }
 
@@ -61,7 +61,7 @@ public class ChangeSynonymToMisapplicationOperation extends AbstractPostTaxonOpe
        @Override
        public IStatus execute(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
        @Override
        public IStatus execute(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
-               
+
        // get name from synonym
                TaxonNameBase<?, ?> synonymName = synonym.getName();
 
        // get name from synonym
                TaxonNameBase<?, ?> synonymName = synonym.getName();
 
@@ -69,18 +69,18 @@ public class ChangeSynonymToMisapplicationOperation extends AbstractPostTaxonOpe
                misapplication = Taxon.NewInstance(synonymName, null);
                CdmStore.getService(ITaxonService.class).saveOrUpdate(misapplication);
                monitor.worked(20);
                misapplication = Taxon.NewInstance(synonymName, null);
                CdmStore.getService(ITaxonService.class).saveOrUpdate(misapplication);
                monitor.worked(20);
-               
+
                // store synonymRelationshipType for later undo operations
                // store synonymRelationshipType for later undo operations
-               synonymTypes = synonym.getRelationType(taxon);
-               
-               // remove synonym from taxon            
-               taxon.removeSynonym(synonym);
+               synonymTypes = synonym.getRelationType(element);
+
+               // remove synonym from taxon
+               element.removeSynonym(synonym);
                monitor.worked(40);
                monitor.worked(40);
-               
+
                // add misapplied name to taxon
                // TODO add microcitation for misapplied name to property sheet (if microcitation is indeed needed?!)
                // add misapplied name to taxon
                // TODO add microcitation for misapplied name to property sheet (if microcitation is indeed needed?!)
-               taxon.addMisappliedName(misapplication, null, null);
-               
+               element.addMisappliedName(misapplication, null, null);
+
                // redraw editor if exists
                return postExecute(misapplication);
        }
                // redraw editor if exists
                return postExecute(misapplication);
        }
@@ -91,11 +91,11 @@ public class ChangeSynonymToMisapplicationOperation extends AbstractPostTaxonOpe
                        throws ExecutionException {
                // add misapplied name to taxon
                // TODO add citation for misapplied name to property sheet
                        throws ExecutionException {
                // add misapplied name to taxon
                // TODO add citation for misapplied name to property sheet
-               taxon.addMisappliedName(misapplication, null, null);
-               
+               element.addMisappliedName(misapplication, null, null);
+
                // remove synonym from taxon
                // remove synonym from taxon
-               taxon.removeSynonym(synonym);
-               
+               element.removeSynonym(synonym);
+
                // redraw editor if exists
                return postExecute(null);
        }
                // redraw editor if exists
                return postExecute(null);
        }
@@ -104,15 +104,15 @@ public class ChangeSynonymToMisapplicationOperation extends AbstractPostTaxonOpe
        @Override
        public IStatus undo(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
        @Override
        public IStatus undo(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
-               
+
                // remove misapplied name from taxon
                // remove misapplied name from taxon
-               taxon.removeTaxon(misapplication, TaxonRelationshipType.MISAPPLIED_NAME_FOR());
-               
+               element.removeTaxon(misapplication, TaxonRelationshipType.MISAPPLIED_NAME_FOR());
+
                // add synonym to taxon
                for (SynonymRelationshipType synonymType : synonymTypes){
                // add synonym to taxon
                for (SynonymRelationshipType synonymType : synonymTypes){
-                       taxon.addSynonym(synonym, synonymType);
+                       element.addSynonym(synonym, synonymType);
                }
                }
-               
+
                // redraw editor if exists
                return postExecute(null);
        }
                // redraw editor if exists
                return postExecute(null);
        }
index 83b6f2ce3592add5498dfcb0e31aa80dd062e025..d0d3d74c3caebe2d30b788ff847bda789f81bc76 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * Copyright (C) 2007 EDIT
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
 * 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.
 */
 * 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.
 */
@@ -32,11 +32,11 @@ import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
 public class CreateSynonymInExistingHomotypicalGroupOperation extends
                AbstractPostTaxonOperation {
 
 public class CreateSynonymInExistingHomotypicalGroupOperation extends
                AbstractPostTaxonOperation {
 
-       private HomotypicalGroup group;
-       private TaxonNameBase newSynonymName;
+       private final HomotypicalGroup group;
+       private final TaxonNameBase newSynonymName;
 
        private SynonymRelationship synonymRelationship;
 
        private SynonymRelationship synonymRelationship;
-       
+
        /**
         * <p>Constructor for CreateSynonymInExistingHomotypicalGroupOperation.</p>
         *
        /**
         * <p>Constructor for CreateSynonymInExistingHomotypicalGroupOperation.</p>
         *
@@ -61,29 +61,29 @@ public class CreateSynonymInExistingHomotypicalGroupOperation extends
        @Override
        public IStatus execute(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
        @Override
        public IStatus execute(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
-               
+
                // Add name to given homotypic group
                group.addTypifiedName(newSynonymName);
                monitor.worked(20);
                // Add name to given homotypic group
                group.addTypifiedName(newSynonymName);
                monitor.worked(20);
-               
+
                // Create a new synonym for the taxon
                // TODO add citations
                // Create a new synonym for the taxon
                // TODO add citations
-               if(group.equals(taxon.getHomotypicGroup())){
-                       synonymRelationship = taxon.addHomotypicSynonymName(newSynonymName, null, null);
+               if(group.equals(element.getHomotypicGroup())){
+                       synonymRelationship = element.addHomotypicSynonymName(newSynonymName, null, null);
                }else{
                }else{
-                       synonymRelationship = taxon.addHeterotypicSynonymName(newSynonymName);
+                       synonymRelationship = element.addHeterotypicSynonymName(newSynonymName);
                }
                monitor.worked(40);
                }
                monitor.worked(40);
-               
+
 //             Synonym affectedSynonym = null;
 //             Synonym affectedSynonym = null;
-//             
+//
 //             for(Synonym synonym : group.getSynonymsInGroup(taxon.getSec())){
 //                     if(synonym.getName() == synonymName){
 //                             affectedSynonym = synonym;
 //                             break;
 //                     }
 //             }
 //             for(Synonym synonym : group.getSynonymsInGroup(taxon.getSec())){
 //                     if(synonym.getName() == synonymName){
 //                             affectedSynonym = synonym;
 //                             break;
 //                     }
 //             }
-               
+
                return postExecute(synonymRelationship.getSynonym());
        }
 
                return postExecute(synonymRelationship.getSynonym());
        }
 
@@ -105,8 +105,8 @@ public class CreateSynonymInExistingHomotypicalGroupOperation extends
        public IStatus undo(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
 
        public IStatus undo(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
 
-               taxon.removeSynonymRelation(synonymRelationship);
-               
+               element.removeSynonymRelation(synonymRelationship);
+
                return postExecute(null);
        }
 }
                return postExecute(null);
        }
 }
index aaadbb1a8885bcce282e4ef633a086121141ca55..6fca0efc663a55c5ae49c249c5f23e3c81a25df6 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * Copyright (C) 2007 EDIT
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
 * 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.
 */
 * 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.
 */
@@ -35,9 +35,9 @@ import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
  * @version 1.0
  */
 public class CreateSynonymInNewGroupOperation extends AbstractPostTaxonOperation {
  * @version 1.0
  */
 public class CreateSynonymInNewGroupOperation extends AbstractPostTaxonOperation {
-       
+
        // TODO replace this with TaxonNameBase
        // TODO replace this with TaxonNameBase
-       private TaxonNameBase newSynonymName;
+       private final TaxonNameBase newSynonymName;
        private SynonymRelationship newSynonymRelationship;
 
        /**
        private SynonymRelationship newSynonymRelationship;
 
        /**
@@ -52,7 +52,7 @@ public class CreateSynonymInNewGroupOperation extends AbstractPostTaxonOperation
        public CreateSynonymInNewGroupOperation(String label,
                        IUndoContext undoContext, Taxon taxon, TaxonNameBase newSynonymName, IPostOperationEnabled postOperationEnabled) {
                super(label, undoContext, taxon, postOperationEnabled);
        public CreateSynonymInNewGroupOperation(String label,
                        IUndoContext undoContext, Taxon taxon, TaxonNameBase newSynonymName, IPostOperationEnabled postOperationEnabled) {
                super(label, undoContext, taxon, postOperationEnabled);
-               
+
                this.newSynonymName = newSynonymName;
        }
 
                this.newSynonymName = newSynonymName;
        }
 
@@ -63,13 +63,13 @@ public class CreateSynonymInNewGroupOperation extends AbstractPostTaxonOperation
        @Override
        public IStatus execute(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
        @Override
        public IStatus execute(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
-               
+
                // Add name to new homotypic group
                HomotypicalGroup.NewInstance().addTypifiedName(newSynonymName);
                monitor.worked(20);
                // Add name to new homotypic group
                HomotypicalGroup.NewInstance().addTypifiedName(newSynonymName);
                monitor.worked(20);
-               
+
                // Create a new synonym for the taxon
                // Create a new synonym for the taxon
-               newSynonymRelationship = taxon.addHeterotypicSynonymName(newSynonymName);
+               newSynonymRelationship = element.addHeterotypicSynonymName(newSynonymName);
                monitor.worked(40);
 
                return postExecute(newSynonymRelationship.getSynonym());
                monitor.worked(40);
 
                return postExecute(newSynonymRelationship.getSynonym());
@@ -92,11 +92,11 @@ public class CreateSynonymInNewGroupOperation extends AbstractPostTaxonOperation
        @Override
        public IStatus undo(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
        @Override
        public IStatus undo(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
-               
-               // Remove the synonym 
-               taxon.removeSynonymRelation(newSynonymRelationship);
+
+               // Remove the synonym
+               element.removeSynonymRelation(newSynonymRelationship);
                newSynonymRelationship = null;
                newSynonymRelationship = null;
-               
+
                return postExecute(null);
        }
 }
                return postExecute(null);
        }
 }
index 1874fa2eb2e5a245782835de547770e14a65d0d1..fb4856897d7e0a285ea50ef51518498a43b7e4cc 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * Copyright (C) 2007 EDIT
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
 * 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.
 */
 * 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.
 */
@@ -30,8 +30,8 @@ import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
  * @version 1.0
  */
 public class DeleteMisapplicationOperation extends AbstractPostTaxonOperation {
  * @version 1.0
  */
 public class DeleteMisapplicationOperation extends AbstractPostTaxonOperation {
-       
-       private Taxon misapplication;
+
+       private final Taxon misapplication;
 
        private Reference<?> citation;
 
 
        private Reference<?> citation;
 
@@ -49,7 +49,7 @@ public class DeleteMisapplicationOperation extends AbstractPostTaxonOperation {
        public DeleteMisapplicationOperation(String label, IUndoContext undoContext,
                        Taxon taxon, Taxon misapplication, IPostOperationEnabled postOperationEnabled) {
                super(label, undoContext, taxon, postOperationEnabled);
        public DeleteMisapplicationOperation(String label, IUndoContext undoContext,
                        Taxon taxon, Taxon misapplication, IPostOperationEnabled postOperationEnabled) {
                super(label, undoContext, taxon, postOperationEnabled);
-               
+
                this.misapplication = misapplication;
        }
 
                this.misapplication = misapplication;
        }
 
@@ -62,7 +62,7 @@ public class DeleteMisapplicationOperation extends AbstractPostTaxonOperation {
                        throws ExecutionException {
 
                // Find misapplication relation, save citation information
                        throws ExecutionException {
 
                // Find misapplication relation, save citation information
-               for (TaxonRelationship relationship : taxon.getTaxonRelations()) {
+               for (TaxonRelationship relationship : element.getTaxonRelations()) {
                        if (relationship.getType().equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR())
                                        && relationship.getFromTaxon().equals(misapplication)) {
                                citation = relationship.getCitation();
                        if (relationship.getType().equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR())
                                        && relationship.getFromTaxon().equals(misapplication)) {
                                citation = relationship.getCitation();
@@ -70,9 +70,9 @@ public class DeleteMisapplicationOperation extends AbstractPostTaxonOperation {
                        }
                }
                monitor.worked(20);
                        }
                }
                monitor.worked(20);
-               
+
                // Remove misapplied name relation from taxon
                // Remove misapplied name relation from taxon
-               taxon.removeTaxon(misapplication, TaxonRelationshipType.MISAPPLIED_NAME_FOR());
+               element.removeTaxon(misapplication, TaxonRelationshipType.MISAPPLIED_NAME_FOR());
                monitor.worked(40);
 
                return postExecute(null);
                monitor.worked(40);
 
                return postExecute(null);
@@ -95,9 +95,9 @@ public class DeleteMisapplicationOperation extends AbstractPostTaxonOperation {
        @Override
        public IStatus undo(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
        @Override
        public IStatus undo(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
-               
-               taxon.addMisappliedName(misapplication, citation, microcitation);
-               
+
+               element.addMisappliedName(misapplication, citation, microcitation);
+
                return postExecute(misapplication);
        }
 }
                return postExecute(misapplication);
        }
 }
index 4ba88a6d38580b64ee62ce232517e9b54607ed60..cba17dc0758906191e20b0e8e7736a81bbb05e66 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * Copyright (C) 2007 EDIT
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
 * 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.
 */
 * 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.
 */
@@ -34,8 +34,8 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
  * @version 1.0
  */
 public class DeleteSynonymOperation extends AbstractPostTaxonOperation {
  * @version 1.0
  */
 public class DeleteSynonymOperation extends AbstractPostTaxonOperation {
-       
-       private Synonym synonym;
+
+       private final Synonym synonym;
        private Set<SynonymRelationshipType> synonymTypes;
 
        /**
        private Set<SynonymRelationshipType> synonymTypes;
 
        /**
@@ -60,33 +60,33 @@ public class DeleteSynonymOperation extends AbstractPostTaxonOperation {
        @Override
        public IStatus execute(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
        @Override
        public IStatus execute(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
-               
+
                // Store synonymRelationshipType for later undo operations
                // Store synonymRelationshipType for later undo operations
-                               synonymTypes = synonym.getRelationType(taxon);
+                               synonymTypes = synonym.getRelationType(element);
                                monitor.worked(20);
                                monitor.worked(20);
-                               
+
                                // Remove synonym from taxon
                                // Remove synonym from taxon
-                               
+
                                CdmApplicationController controller;
                                CdmApplicationController controller;
-                               
+
                                controller = (CdmApplicationController) CdmStore.getCurrentApplicationConfiguration();
                                controller = (CdmApplicationController) CdmStore.getCurrentApplicationConfiguration();
-                               
+
                                ITaxonService service = controller.getTaxonService();
                                if (synonym.getId() == 0){
                                ITaxonService service = controller.getTaxonService();
                                if (synonym.getId() == 0){
-                                       taxon.removeSynonym(synonym);
-                                       
+                                       element.removeSynonym(synonym);
+
                                } else {
                                        service.deleteSynonym(synonym, null);
                                }
                        //      taxon.removeSynonym(synonym);
 //                             CdmStore.getTaxonService().deleteSynonymRelationships(synonym);
 //                             CdmStore.getTaxonService().delete(synonym);
                                } else {
                                        service.deleteSynonym(synonym, null);
                                }
                        //      taxon.removeSynonym(synonym);
 //                             CdmStore.getTaxonService().deleteSynonymRelationships(synonym);
 //                             CdmStore.getTaxonService().delete(synonym);
-                               
+
                                monitor.worked(40);
 
                                // Redraw editor if exists
                                monitor.worked(40);
 
                                // Redraw editor if exists
-                               
-                               return postExecute(taxon);
+
+                               return postExecute(element);
        }
 
        /* (non-Javadoc)
        }
 
        /* (non-Javadoc)
@@ -95,7 +95,7 @@ public class DeleteSynonymOperation extends AbstractPostTaxonOperation {
        /** {@inheritDoc} */
        @Override
        public IStatus redo(IProgressMonitor monitor, IAdaptable info)
        /** {@inheritDoc} */
        @Override
        public IStatus redo(IProgressMonitor monitor, IAdaptable info)
-                       throws ExecutionException {             
+                       throws ExecutionException {
                return execute(monitor, info);
        }
 
                return execute(monitor, info);
        }
 
@@ -106,12 +106,12 @@ public class DeleteSynonymOperation extends AbstractPostTaxonOperation {
        @Override
        public IStatus undo(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
        @Override
        public IStatus undo(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
-               
+
                // Add synonym to taxon
                for (SynonymRelationshipType synonymType : synonymTypes){
                // Add synonym to taxon
                for (SynonymRelationshipType synonymType : synonymTypes){
-                       taxon.addSynonym(synonym, synonymType);
+                       element.addSynonym(synonym, synonymType);
                }
                }
-               
+
                // Redraw editor if exists
                return postExecute(synonym);
        }
                // Redraw editor if exists
                return postExecute(synonym);
        }
index dbc7f7a043ea3000afcfc21e7d31ce3178cccbfb..49f714668504e8c48eadc17c513410b377069871 100644 (file)
@@ -3,21 +3,12 @@ package eu.etaxonomy.taxeditor.editor.name.operation;
 import java.util.Iterator;\r
 import java.util.Set;\r
 \r
 import java.util.Iterator;\r
 import java.util.Set;\r
 \r
-import org.eclipse.core.commands.ExecutionEvent;\r
 import org.eclipse.core.commands.ExecutionException;\r
 import org.eclipse.core.commands.operations.IUndoContext;\r
 import org.eclipse.core.runtime.IAdaptable;\r
 import org.eclipse.core.runtime.IProgressMonitor;\r
 import org.eclipse.core.runtime.IStatus;\r
 import org.eclipse.core.commands.ExecutionException;\r
 import org.eclipse.core.commands.operations.IUndoContext;\r
 import org.eclipse.core.runtime.IAdaptable;\r
 import org.eclipse.core.runtime.IProgressMonitor;\r
 import org.eclipse.core.runtime.IStatus;\r
-import org.eclipse.core.runtime.Status;\r
-import org.eclipse.ui.IEditorInput;\r
-import org.eclipse.ui.IEditorReference;\r
-import org.eclipse.ui.IPerspectiveDescriptor;\r
-import org.eclipse.ui.IViewPart;\r
-import org.eclipse.ui.IViewReference;\r
 import org.eclipse.ui.IWorkbenchPage;\r
 import org.eclipse.ui.IWorkbenchPage;\r
-import org.eclipse.ui.PartInitException;\r
-import org.eclipse.ui.handlers.HandlerUtil;\r
 \r
 import eu.etaxonomy.cdm.api.application.CdmApplicationController;\r
 import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;\r
 \r
 import eu.etaxonomy.cdm.api.application.CdmApplicationController;\r
 import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;\r
@@ -25,26 +16,23 @@ import eu.etaxonomy.cdm.api.service.ITaxonService;
 import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;\r
 import eu.etaxonomy.cdm.api.service.exception.DataChangeNoRollbackException;\r
 import eu.etaxonomy.cdm.model.taxon.Classification;\r
 import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;\r
 import eu.etaxonomy.cdm.api.service.exception.DataChangeNoRollbackException;\r
 import eu.etaxonomy.cdm.model.taxon.Classification;\r
-import eu.etaxonomy.cdm.model.taxon.Synonym;\r
 import eu.etaxonomy.cdm.model.taxon.Taxon;\r
 import eu.etaxonomy.cdm.model.taxon.TaxonNode;\r
 import eu.etaxonomy.cdm.model.taxon.Taxon;\r
 import eu.etaxonomy.cdm.model.taxon.TaxonNode;\r
-import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;\r
-import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;\r
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;\r
 import eu.etaxonomy.taxeditor.store.CdmStore;\r
 \r
 public class DeleteTaxonOperation extends DeleteTaxonBaseOperation{\r
        //private Taxon taxon;\r
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;\r
 import eu.etaxonomy.taxeditor.store.CdmStore;\r
 \r
 public class DeleteTaxonOperation extends DeleteTaxonBaseOperation{\r
        //private Taxon taxon;\r
-       private Classification classification;\r
-       \r
-       \r
-       \r
-       \r
+       private final Classification classification;\r
+\r
+\r
+\r
+\r
        public DeleteTaxonOperation(String label, IUndoContext undoContext,\r
                        Taxon taxon, Classification classification, IWorkbenchPage activePage, IPostOperationEnabled postOperationEnabled, IConversationEnabled conversationEnabled) {\r
                super(label, undoContext, taxon, activePage, postOperationEnabled, conversationEnabled);\r
        public DeleteTaxonOperation(String label, IUndoContext undoContext,\r
                        Taxon taxon, Classification classification, IWorkbenchPage activePage, IPostOperationEnabled postOperationEnabled, IConversationEnabled conversationEnabled) {\r
                super(label, undoContext, taxon, activePage, postOperationEnabled, conversationEnabled);\r
-               this.taxon = taxon;\r
-               \r
+               this.element = taxon;\r
+\r
                Set<TaxonNode> nodes = taxon.getTaxonNodes();\r
                if (nodes.size() == 1 && classification == null){\r
                        this.taxonNode = nodes.iterator().next();\r
                Set<TaxonNode> nodes = taxon.getTaxonNodes();\r
                if (nodes.size() == 1 && classification == null){\r
                        this.taxonNode = nodes.iterator().next();\r
@@ -60,38 +48,38 @@ public class DeleteTaxonOperation extends DeleteTaxonBaseOperation{
                        //TODO\r
                }\r
                this.classification = classification;\r
                        //TODO\r
                }\r
                this.classification = classification;\r
-               \r
+\r
        }\r
 \r
        }\r
 \r
-       \r
+\r
 \r
        @Override\r
        public IStatus execute(IProgressMonitor monitor, IAdaptable info)\r
                        throws ExecutionException {\r
 \r
        @Override\r
        public IStatus execute(IProgressMonitor monitor, IAdaptable info)\r
                        throws ExecutionException {\r
-                               \r
+\r
                                monitor.worked(20);\r
                                bind();\r
                                monitor.worked(20);\r
                                bind();\r
-                               \r
-                               \r
+\r
+\r
                                CdmApplicationController controller;\r
                                CdmApplicationController controller;\r
-                               \r
+\r
                                controller = (CdmApplicationController) CdmStore.getCurrentApplicationConfiguration();\r
                                controller = (CdmApplicationController) CdmStore.getCurrentApplicationConfiguration();\r
-                               \r
+\r
                                ITaxonService service = controller.getTaxonService();\r
                                try {\r
                                ITaxonService service = controller.getTaxonService();\r
                                try {\r
-                                       \r
-                                       service.deleteTaxon(taxon, new TaxonDeletionConfigurator(), classification);\r
-                                       \r
+\r
+                                       service.deleteTaxon(element, new TaxonDeletionConfigurator(), classification);\r
+\r
                                } catch (DataChangeNoRollbackException e) {\r
                                        // TODO Auto-generated catch block\r
                                        e.printStackTrace();\r
                                } catch (DataChangeNoRollbackException e) {\r
                                        // TODO Auto-generated catch block\r
                                        e.printStackTrace();\r
-                                       \r
+\r
                                }\r
                                }\r
-                               \r
+\r
                                //closeObsoleteEditor(taxon);\r
                                monitor.worked(40);\r
                                //closeObsoleteEditor(taxon);\r
                                monitor.worked(40);\r
-                               \r
-                               \r
+\r
+\r
                                return postExecute(null);\r
        }\r
 \r
                                return postExecute(null);\r
        }\r
 \r
@@ -108,6 +96,6 @@ public class DeleteTaxonOperation extends DeleteTaxonBaseOperation{
                // TODO Auto-generated method stub\r
                return null;\r
        }\r
                // TODO Auto-generated method stub\r
                return null;\r
        }\r
-       \r
-       \r
+\r
+\r
 }\r
 }\r
index 8cbb446d97c122934fe474f7e1faf242ead8364e..a30c1f9d394a6e3b32b97ad477605510ebf2d4fd 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 /**
 * Copyright (C) 2007 EDIT
 // $Id$
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
 * 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.
 */
 * 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.
 */
@@ -15,14 +15,11 @@ 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 org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
 
 import eu.etaxonomy.cdm.api.service.ITaxonService;
 
 import eu.etaxonomy.cdm.api.service.ITaxonService;
-import eu.etaxonomy.cdm.model.common.CdmBase;
 import eu.etaxonomy.cdm.model.taxon.Synonym;
 import eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.cdm.model.taxon.Synonym;
 import eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
 import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
 import eu.etaxonomy.taxeditor.store.CdmStore;
@@ -36,11 +33,11 @@ import eu.etaxonomy.taxeditor.store.StoreUtil;
  * @version 1.0
  */
 public class SwapSynonymAndAcceptedOperation extends AbstractPostTaxonOperation {
  * @version 1.0
  */
 public class SwapSynonymAndAcceptedOperation extends AbstractPostTaxonOperation {
-       
-       private Synonym synonym;
+
+       private final Synonym synonym;
        // TODO store the old relationship for undo reasons
        private SynonymRelationshipType synonymRelationshipType;
        // TODO store the old relationship for undo reasons
        private SynonymRelationshipType synonymRelationshipType;
-       
+
        /**
         * <p>Constructor for SwapSynonymAndAcceptedOperation.</p>
         *
        /**
         * <p>Constructor for SwapSynonymAndAcceptedOperation.</p>
         *
@@ -53,7 +50,7 @@ public class SwapSynonymAndAcceptedOperation extends AbstractPostTaxonOperation
        public SwapSynonymAndAcceptedOperation(String label, IUndoContext undoContext,
                        Taxon taxon, Synonym synonym, IPostOperationEnabled postOperationEnabled) {
                super("Swap Synonym And Accepted Taxon Operation", undoContext, taxon, postOperationEnabled);
        public SwapSynonymAndAcceptedOperation(String label, IUndoContext undoContext,
                        Taxon taxon, Synonym synonym, IPostOperationEnabled postOperationEnabled) {
                super("Swap Synonym And Accepted Taxon Operation", undoContext, taxon, postOperationEnabled);
-               
+
                this.synonym = synonym;
        }
 
                this.synonym = synonym;
        }
 
@@ -64,14 +61,14 @@ public class SwapSynonymAndAcceptedOperation extends AbstractPostTaxonOperation
        @Override
        public IStatus execute(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
        @Override
        public IStatus execute(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
-               
+
                monitor.worked(20);
                monitor.worked(20);
-               
-               CdmStore.getService(ITaxonService.class).swapSynonymAndAcceptedTaxon(synonym, taxon);
-               
+
+               CdmStore.getService(ITaxonService.class).swapSynonymAndAcceptedTaxon(synonym, element);
+
                monitor.worked(40);
 
                monitor.worked(40);
 
-               return postExecute(taxon);
+               return postExecute(element);
        }
 
        /* (non-Javadoc)
        }
 
        /* (non-Javadoc)
index a92057d3683698047b2a6219b3599507197b4ff6..40c92af92938f59b2ab03bc89f00eb4ace2bfdcd 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * Copyright (C) 2007 EDIT
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
 * 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.
 */
 * 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.
 */
@@ -30,10 +30,10 @@ import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
  * @version 1.0
  */
 public class CreateConceptRelationOperation extends AbstractPostTaxonOperation {
  * @version 1.0
  */
 public class CreateConceptRelationOperation extends AbstractPostTaxonOperation {
-       
-       private Taxon concept;
-       private TaxonRelationshipTypeInverseContainer taxonRelationshipTypeInverseContainer;
-       
+
+       private final Taxon concept;
+       private final TaxonRelationshipTypeInverseContainer taxonRelationshipTypeInverseContainer;
+
        /**
         * <p>Constructor for CreateConceptRelationOperation.</p>
         *
        /**
         * <p>Constructor for CreateConceptRelationOperation.</p>
         *
@@ -51,7 +51,7 @@ public class CreateConceptRelationOperation extends AbstractPostTaxonOperation {
                this.concept = concept;
                this.taxonRelationshipTypeInverseContainer = taxonRelationshipTypeInverseContainer;
        }
                this.concept = concept;
                this.taxonRelationshipTypeInverseContainer = taxonRelationshipTypeInverseContainer;
        }
-       
+
        public CreateConceptRelationOperation(String label,
                        IUndoContext undoContext, Taxon taxon, Taxon concept, TaxonRelationshipType taxonRelationshipType
                        , IPostOperationEnabled postOperationEnabled) {
        public CreateConceptRelationOperation(String label,
                        IUndoContext undoContext, Taxon taxon, Taxon concept, TaxonRelationshipType taxonRelationshipType
                        , IPostOperationEnabled postOperationEnabled) {
@@ -69,12 +69,12 @@ public class CreateConceptRelationOperation extends AbstractPostTaxonOperation {
                monitor.worked(20);
                // add concept to taxon
                if(taxonRelationshipTypeInverseContainer.isInverse()){
                monitor.worked(20);
                // add concept to taxon
                if(taxonRelationshipTypeInverseContainer.isInverse()){
-                       concept.addTaxonRelation(taxon, taxonRelationshipTypeInverseContainer.getType(), null, null);   
+                       concept.addTaxonRelation(element, taxonRelationshipTypeInverseContainer.getType(), null, null);
                } else {
                } else {
-                       taxon.addTaxonRelation(concept, taxonRelationshipTypeInverseContainer.getType(), null, null);
+                   element.addTaxonRelation(concept, taxonRelationshipTypeInverseContainer.getType(), null, null);
                }
                monitor.worked(40);
                }
                monitor.worked(40);
-               
+
                // redraw editor if exists
                return postExecute(concept);
        }
                // redraw editor if exists
                return postExecute(concept);
        }
@@ -96,9 +96,9 @@ public class CreateConceptRelationOperation extends AbstractPostTaxonOperation {
        @Override
        public IStatus undo(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
        @Override
        public IStatus undo(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
-               
-               taxon.removeTaxon(concept, taxonRelationshipTypeInverseContainer.getType());
-               
+
+           element.removeTaxon(concept, taxonRelationshipTypeInverseContainer.getType());
+
                // redraw editor if exists
                return postExecute(null);
        }
                // redraw editor if exists
                return postExecute(null);
        }
index 4e6a243dd24d0b5200ffafde121e87e5a8a28456..9f71fae56e44aee8dc84047de1d00ba48a0680de 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * Copyright (C) 2007 EDIT
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
 * 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.
 */
 * 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.
 */
@@ -31,8 +31,8 @@ import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
  * @version 1.0
  */
 public class DeleteConceptRelationOperation extends AbstractPostTaxonOperation {
  * @version 1.0
  */
 public class DeleteConceptRelationOperation extends AbstractPostTaxonOperation {
-       
-       private Set<TaxonRelationship> taxonRelationships;      
+
+       private final Set<TaxonRelationship> taxonRelationships;
 
 
        /**
 
 
        /**
@@ -45,7 +45,7 @@ public class DeleteConceptRelationOperation extends AbstractPostTaxonOperation {
                        IUndoContext undoContext, Taxon taxon, Set<TaxonRelationship> relations,
                        IPostOperationEnabled postOperationEnabled) {
                super(label, undoContext, taxon, postOperationEnabled);
                        IUndoContext undoContext, Taxon taxon, Set<TaxonRelationship> relations,
                        IPostOperationEnabled postOperationEnabled) {
                super(label, undoContext, taxon, postOperationEnabled);
-               
+
                taxonRelationships = relations;
        }
 
                taxonRelationships = relations;
        }
 
@@ -56,17 +56,17 @@ public class DeleteConceptRelationOperation extends AbstractPostTaxonOperation {
        @Override
        public IStatus execute(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
        @Override
        public IStatus execute(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
-               
+
                monitor.worked(20);
                monitor.worked(20);
-               
+
                // Remove relation from taxon
                for(TaxonRelationship relationship : taxonRelationships){
                // Remove relation from taxon
                for(TaxonRelationship relationship : taxonRelationships){
-                       taxon.removeTaxonRelation(relationship);
+                   element.removeTaxonRelation(relationship);
                        monitor.worked(10);
                }
                monitor.worked(10);
 
                        monitor.worked(10);
                }
                monitor.worked(10);
 
-               return postExecute(taxon);
+               return postExecute(element);
        }
 
        /* (non-Javadoc)
        }
 
        /* (non-Javadoc)
@@ -86,12 +86,12 @@ public class DeleteConceptRelationOperation extends AbstractPostTaxonOperation {
        @Override
        public IStatus undo(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
        @Override
        public IStatus undo(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
-               
+
                for(TaxonRelationship relationship : taxonRelationships){
                for(TaxonRelationship relationship : taxonRelationships){
-                       taxon.addTaxonRelation(relationship);
+                   element.addTaxonRelation(relationship);
                        monitor.worked(10);
                }
                        monitor.worked(10);
                }
-               
-               return postExecute(taxon);
+
+               return postExecute(element);
        }
 }
        }
 }
index fa09a1ed3593ab1aac5e9f3060e55a17c2396f9e..8bd9fa6f4386c3156e888ca49a1262b3bc9eede0 100644 (file)
@@ -124,16 +124,15 @@ public class DescriptiveContentProvider implements ITreeContentProvider {
                return featureTree;
        }
 
                return featureTree;
        }
 
-       /**
-        * Get all descriptions associated with the given TaxonEditorInput
-        *
-        * @param parentElement
-        * @return
-        */
-       protected List<DescriptionBase> getDescriptions(IDescribable<?> parentElement) {
-           Set<? extends DescriptionBase<?>> elementDescriptions = parentElement.getDescriptions();
-               List<DescriptionBase> resultDescriptions = new ArrayList<DescriptionBase>();
-               for(DescriptionBase description : elementDescriptions){
+    /**
+     * Get all descriptions associated with the given object
+     * @param parentElement
+     * @return
+     */
+    protected List<DescriptionBase> getDescriptions(IDescribable<?> parentElement) {
+        Set<? extends DescriptionBase> elementDescriptions = parentElement.getDescriptions();
+        List<DescriptionBase> resultDescriptions = new ArrayList<DescriptionBase>();
+        for(DescriptionBase description : elementDescriptions){
                        if(! description.isImageGallery()){
                                MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(UsageTermCollection.uuidUseMarkerType);
                                Set<Marker> descriptionMarkers = description.getMarkers();
                        if(! description.isImageGallery()){
                                MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(UsageTermCollection.uuidUseMarkerType);
                                Set<Marker> descriptionMarkers = description.getMarkers();
@@ -148,10 +147,9 @@ public class DescriptiveContentProvider implements ITreeContentProvider {
                                        resultDescriptions.add(description);
                                }
                        }
                                        resultDescriptions.add(description);
                                }
                        }
-
                }
                }
-               return resultDescriptions;
-       }
+        return resultDescriptions;
+    }
 
        /* (non-Javadoc)
         * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
 
        /* (non-Javadoc)
         * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
index e946cde5afe412a52bcecfe2529d2e697249f518..cb8582f84d3eb203576b33495849597d3bb114e0 100644 (file)
@@ -21,6 +21,7 @@ import org.eclipse.jface.action.MenuManager;
 import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
 import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.jface.viewers.Viewer;
 import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.jface.viewers.Viewer;
@@ -64,6 +65,10 @@ public class DescriptiveViewPart extends AbstractCdmEditorViewPart implements IP
 
        protected TreeViewer viewer;
 
 
        protected TreeViewer viewer;
 
+       /**
+        * Maps {@link FeatureNodeContainerTree} to their corresponding {@link TaxonDescritpion}.<br>
+        * This serves as input for the {@link ITreeContentProvider} of the {@link TreeViewer}
+        */
        protected Map<DescriptionBase<?>, FeatureNodeContainerTree> featureNodeContainerCache = new HashMap<DescriptionBase<?>, FeatureNodeContainerTree>();
 
        protected ToggleDescriptionAction showAllElementsAction;
        protected Map<DescriptionBase<?>, FeatureNodeContainerTree> featureNodeContainerCache = new HashMap<DescriptionBase<?>, FeatureNodeContainerTree>();
 
        protected ToggleDescriptionAction showAllElementsAction;
index 8065668b95bc2201efef9a5977974d7c2f1a993c..445ec48a501063cf4871fd3e356a301d961e19fc 100644 (file)
@@ -20,7 +20,7 @@ import eu.etaxonomy.cdm.model.description.TaxonDescription;
 import eu.etaxonomy.cdm.model.description.TextData;
 import eu.etaxonomy.cdm.model.media.Media;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.cdm.model.description.TextData;
 import eu.etaxonomy.cdm.model.media.Media;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.taxeditor.operation.AbstractPostDescribableOperation;
+import eu.etaxonomy.taxeditor.operation.AbstractDescriptionPostOperation;
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
 
 /**
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
 
 /**
@@ -31,10 +31,9 @@ import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
  * @created 05.02.2009
  * @version 1.0
  */
  * @created 05.02.2009
  * @version 1.0
  */
-public class CreateTaxonDescriptionOperation extends AbstractPostDescribableOperation{
+public class CreateTaxonDescriptionOperation extends AbstractDescriptionPostOperation<Taxon, TaxonDescription>{
 
 
-       private TaxonDescription description;
-       private boolean isImageGallery;
+       private final boolean isImageGallery;
 
        /**
         * <p>Constructor for CreateTaxonDescriptionOperation.</p>
 
        /**
         * <p>Constructor for CreateTaxonDescriptionOperation.</p>
@@ -59,7 +58,7 @@ public class CreateTaxonDescriptionOperation extends AbstractPostDescribableOper
         * @param isImageGallery a boolean.
         */
        public CreateTaxonDescriptionOperation(String label, IUndoContext undoContext,
         * @param isImageGallery a boolean.
         */
        public CreateTaxonDescriptionOperation(String label, IUndoContext undoContext,
-                       Taxon taxon, IPostOperationEnabled postOperationEnabled, boolean isImageGallery) {
+               Taxon taxon, IPostOperationEnabled postOperationEnabled, boolean isImageGallery) {
                super(label, undoContext, taxon, postOperationEnabled);
 
                this.isImageGallery  = isImageGallery;
                super(label, undoContext, taxon, postOperationEnabled);
 
                this.isImageGallery  = isImageGallery;
@@ -73,7 +72,7 @@ public class CreateTaxonDescriptionOperation extends AbstractPostDescribableOper
        public IStatus execute(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
 
        public IStatus execute(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
 
-               description = TaxonDescription.NewInstance(taxon);
+               description = TaxonDescription.NewInstance(element);
                monitor.worked(20);
 
                if(isImageGallery){
                monitor.worked(20);
 
                if(isImageGallery){
@@ -96,7 +95,7 @@ public class CreateTaxonDescriptionOperation extends AbstractPostDescribableOper
        public IStatus redo(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
 
        public IStatus redo(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
 
-               describable.addDescription(description);
+               element.addDescription(description);
 
                return postExecute(description);
        }
 
                return postExecute(description);
        }
@@ -109,7 +108,7 @@ public class CreateTaxonDescriptionOperation extends AbstractPostDescribableOper
        public IStatus undo(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
 
        public IStatus undo(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
 
-               describable.removeDescription(description);
+               element.removeDescription(description);
 
                return postExecute(null);
        }
 
                return postExecute(null);
        }
index fa8c8762ac494f211f3764ba5e7e2642d8042b7b..daa0394da86657dbd3e1e415358c7b98ceef4b1c 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * Copyright (C) 2007 EDIT
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
 * 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.
 */
 * 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.
 */
@@ -28,8 +28,8 @@ import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
  * @version 1.0
  */
 public class DeleteTaxonDescriptionOperation extends AbstractPostTaxonOperation {
  * @version 1.0
  */
 public class DeleteTaxonDescriptionOperation extends AbstractPostTaxonOperation {
-       
-       private TaxonDescription description;
+
+       private final TaxonDescription description;
 
        /**
         * <p>Constructor for DeleteTaxonDescriptionOperation.</p>
 
        /**
         * <p>Constructor for DeleteTaxonDescriptionOperation.</p>
@@ -42,9 +42,9 @@ public class DeleteTaxonDescriptionOperation extends AbstractPostTaxonOperation
        public DeleteTaxonDescriptionOperation(String label, IUndoContext undoContext,
                        TaxonDescription description, IPostOperationEnabled postOperationEnabled) {
                super(label, undoContext, postOperationEnabled);
        public DeleteTaxonDescriptionOperation(String label, IUndoContext undoContext,
                        TaxonDescription description, IPostOperationEnabled postOperationEnabled) {
                super(label, undoContext, postOperationEnabled);
-               
+
                this.description = description;
                this.description = description;
-               taxon = description.getTaxon();
+               element = description.getTaxon();
        }
 
        /* (non-Javadoc)
        }
 
        /* (non-Javadoc)
@@ -56,7 +56,7 @@ public class DeleteTaxonDescriptionOperation extends AbstractPostTaxonOperation
                        throws ExecutionException {
 
                monitor.worked(20);
                        throws ExecutionException {
 
                monitor.worked(20);
-               taxon.removeDescription(description);
+               element.removeDescription(description);
                monitor.worked(40);
 
                return postExecute(description);
                monitor.worked(40);
 
                return postExecute(description);
@@ -80,8 +80,8 @@ public class DeleteTaxonDescriptionOperation extends AbstractPostTaxonOperation
        public IStatus undo(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
 
        public IStatus undo(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
 
-               taxon.addDescription(description);
-               
+           element.addDescription(description);
+
                return postExecute(null);
        }
 }
                return postExecute(null);
        }
 }
index e505d1389a1b8cd254415e4fdd5172df4187ec3d..f6025c0d9252f30df304f4394a39cecf7fa5fd98 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 /**
 * Copyright (C) 2007 EDIT
 // $Id$
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
 * 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.
 */
 * 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.
 */
@@ -31,10 +31,10 @@ import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
  * @version 1.0
  */
 public class CreateImageOperation extends AbstractPostTaxonOperation {
  * @version 1.0
  */
 public class CreateImageOperation extends AbstractPostTaxonOperation {
-       
+
        private ImageFile imageFile;
 
        private ImageFile imageFile;
 
-       private DescriptionBase<?> description;
+       private final DescriptionBase<?> description;
 
        /**
         * <p>Constructor for CreateImageOperation.</p>
 
        /**
         * <p>Constructor for CreateImageOperation.</p>
@@ -67,7 +67,7 @@ public class CreateImageOperation extends AbstractPostTaxonOperation {
                super(label, undoContext, taxon, postOperationEnabled);
                this.description = description;
        }
                super(label, undoContext, taxon, postOperationEnabled);
                this.description = description;
        }
-       
+
        /* (non-Javadoc)
         * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
         */
        /* (non-Javadoc)
         * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
         */
@@ -75,13 +75,13 @@ public class CreateImageOperation extends AbstractPostTaxonOperation {
        @Override
        public IStatus execute(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
        @Override
        public IStatus execute(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
-               
+
                if (imageFile == null) {
                        imageFile = ImageFile.NewInstance(null, null);
                }
                monitor.worked(20);
 
                if (imageFile == null) {
                        imageFile = ImageFile.NewInstance(null, null);
                }
                monitor.worked(20);
 
-               ImagesUtility.addTaxonImage(taxon, description, imageFile);
+               ImagesUtility.addTaxonImage(element, description, imageFile);
                monitor.worked(40);
 
                return postExecute(imageFile);
                monitor.worked(40);
 
                return postExecute(imageFile);
@@ -94,9 +94,9 @@ public class CreateImageOperation extends AbstractPostTaxonOperation {
        @Override
        public IStatus redo(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
        @Override
        public IStatus redo(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
-               
-               ImagesUtility.addTaxonImage(taxon, description, imageFile);
-               
+
+               ImagesUtility.addTaxonImage(element, description, imageFile);
+
                return postExecute(imageFile);
        }
 
                return postExecute(imageFile);
        }
 
@@ -107,9 +107,9 @@ public class CreateImageOperation extends AbstractPostTaxonOperation {
        @Override
        public IStatus undo(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
        @Override
        public IStatus undo(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
-               
-               ImagesUtility.removeTaxonImage(taxon, description, imageFile);
-               
+
+               ImagesUtility.removeTaxonImage(element, description, imageFile);
+
                return postExecute(null);
        }
 
                return postExecute(null);
        }
 
index f312a1a42970e4b5efe9ddeb73dbdbcda9971a9d..8f1c8084981009f005b0e24055b46ce60361cec3 100644 (file)
@@ -1,15 +1,13 @@
 /**\r
 * Copyright (C) 2011 EDIT\r
 /**\r
 * Copyright (C) 2011 EDIT\r
-* European Distributed Institute of Taxonomy \r
+* European Distributed Institute of Taxonomy\r
 * http://www.e-taxonomy.eu\r
 * http://www.e-taxonomy.eu\r
-* \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
 package eu.etaxonomy.taxeditor.editor.view.uses.operation;\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
 package eu.etaxonomy.taxeditor.editor.view.uses.operation;\r
 \r
-import java.util.UUID;\r
-\r
 import org.eclipse.core.commands.ExecutionException;\r
 import org.eclipse.core.commands.operations.IUndoContext;\r
 import org.eclipse.core.runtime.IAdaptable;\r
 import org.eclipse.core.commands.ExecutionException;\r
 import org.eclipse.core.commands.operations.IUndoContext;\r
 import org.eclipse.core.runtime.IAdaptable;\r
@@ -28,7 +26,7 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
 \r
 /**\r
  * CreateTaxonUseOperation Class\r
 \r
 /**\r
  * CreateTaxonUseOperation Class\r
- * @author a.theys     \r
+ * @author a.theys\r
  * @created mar 13, 2012\r
  * @version 1.0\r
  */\r
  * @created mar 13, 2012\r
  * @version 1.0\r
  */\r
@@ -62,7 +60,7 @@ public class CreateTaxonUseOperation extends CreateTaxonDescriptionOperation {
                        Taxon taxon, IPostOperationEnabled postOperationEnabled, boolean isImageGallery) {\r
                super(label, undoContext, taxon, postOperationEnabled);\r
        }\r
                        Taxon taxon, IPostOperationEnabled postOperationEnabled, boolean isImageGallery) {\r
                super(label, undoContext, taxon, postOperationEnabled);\r
        }\r
-       \r
+\r
        /* (non-Javadoc)\r
         * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)\r
         */\r
        /* (non-Javadoc)\r
         * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)\r
         */\r
@@ -70,8 +68,8 @@ public class CreateTaxonUseOperation extends CreateTaxonDescriptionOperation {
        @Override\r
        public IStatus execute(IProgressMonitor monitor, IAdaptable info)\r
                        throws ExecutionException {\r
        @Override\r
        public IStatus execute(IProgressMonitor monitor, IAdaptable info)\r
                        throws ExecutionException {\r
-               \r
-               description = TaxonDescription.NewInstance(taxon);\r
+\r
+               description = TaxonDescription.NewInstance(element);\r
                monitor.worked(20);\r
                MarkerType useMarkerType = (MarkerType) CdmStore.getService(ITermService.class).find(UsageTermCollection.uuidUseMarkerType);\r
                marker = Marker.NewInstance(useMarkerType, true);\r
                monitor.worked(20);\r
                MarkerType useMarkerType = (MarkerType) CdmStore.getService(ITermService.class).find(UsageTermCollection.uuidUseMarkerType);\r
                marker = Marker.NewInstance(useMarkerType, true);\r
index d33a439b7876c73e908a1636133a2688b9fecc84..28b7b201156482214e34eba1ba6e649449e773a8 100644 (file)
@@ -21,7 +21,7 @@ import eu.etaxonomy.cdm.model.description.Feature;
 import eu.etaxonomy.cdm.model.description.TaxonDescription;
 import eu.etaxonomy.cdm.model.description.TextData;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.cdm.model.description.TaxonDescription;
 import eu.etaxonomy.cdm.model.description.TextData;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
 
 
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
 
 
@@ -31,7 +31,7 @@ import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
  * @created mar 13, 2012
  * @version 1.0
  */
  * @created mar 13, 2012
  * @version 1.0
  */
-public class CreateUseRecordOperation extends AbstractPostTaxonOperation {
+public class CreateUseRecordOperation extends AbstractPostOperation {
 
        /** Constant <code>ID="eu.etaxonomy.taxeditor.editor.view.use."{trunked}</code> */
        public static final String ID = "eu.etaxonomy.taxeditor.editor.use.createUseRecord";
 
        /** Constant <code>ID="eu.etaxonomy.taxeditor.editor.view.use."{trunked}</code> */
        public static final String ID = "eu.etaxonomy.taxeditor.editor.use.createUseRecord";
index b478f00ba0efeb35a254f69298a2251366daa1dc..80c85db61ccca467cd2e22f646eca1d2a4550610 100644 (file)
@@ -20,7 +20,7 @@ import eu.etaxonomy.cdm.model.description.Feature;
 import eu.etaxonomy.cdm.model.description.TaxonDescription;\r
 import eu.etaxonomy.cdm.model.description.TextData;\r
 import eu.etaxonomy.cdm.model.taxon.Taxon;\r
 import eu.etaxonomy.cdm.model.description.TaxonDescription;\r
 import eu.etaxonomy.cdm.model.description.TextData;\r
 import eu.etaxonomy.cdm.model.taxon.Taxon;\r
-import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;\r
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;\r
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;\r
 \r
 \r
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;\r
 \r
 \r
@@ -30,7 +30,7 @@ import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
  * @created mar 13, 2012\r
  * @version 1.0\r
  */\r
  * @created mar 13, 2012\r
  * @version 1.0\r
  */\r
-public class CreateUseSummaryOperation extends AbstractPostTaxonOperation {\r
+public class CreateUseSummaryOperation extends AbstractPostOperation {\r
 \r
        public static final String ID = "eu.etaxonomy.taxeditor.editor.use.createUseRecord";\r
 \r
 \r
        public static final String ID = "eu.etaxonomy.taxeditor.editor.use.createUseRecord";\r
 \r
index 9cd017a222c44819d6cbb38fbc6bc7dcd39ec05a..1f9cea4dfdb3607a7e1bb2ab5215ebc9321d31a5 100644 (file)
@@ -17,27 +17,21 @@ 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 org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.ui.handlers.HandlerUtil;
 
 
-import eu.etaxonomy.cdm.api.application.CdmApplicationController;
 import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
 import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
 import eu.etaxonomy.cdm.api.service.IClassificationService;
 import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
 import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
 import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
 import eu.etaxonomy.cdm.api.service.IClassificationService;
 import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
-import eu.etaxonomy.cdm.api.service.ITaxonService;
 import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
 import eu.etaxonomy.cdm.api.service.exception.DataChangeNoRollbackException;
 import eu.etaxonomy.cdm.api.service.exception.ReferencedObjectUndeletableException;
 import eu.etaxonomy.cdm.model.common.CdmBase;
 import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
 import eu.etaxonomy.cdm.api.service.exception.DataChangeNoRollbackException;
 import eu.etaxonomy.cdm.api.service.exception.ReferencedObjectUndeletableException;
 import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.model.common.ITreeNode;
 import eu.etaxonomy.cdm.model.taxon.Classification;
 import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
 import eu.etaxonomy.cdm.model.taxon.TaxonNode;
 import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation;
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.cdm.model.taxon.Classification;
 import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
 import eu.etaxonomy.cdm.model.taxon.TaxonNode;
 import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation;
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
 import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.store.StoreUtil;
 
 /**
  * <p>DeleteTreeNodeOperation class.</p>
 
 /**
  * <p>DeleteTreeNodeOperation class.</p>
@@ -49,7 +43,7 @@ import eu.etaxonomy.taxeditor.store.StoreUtil;
 public class DeleteOperation extends AbstractPersistentPostOperation{
 
        private Set<ITaxonTreeNode> treeNodes;
 public class DeleteOperation extends AbstractPersistentPostOperation{
 
        private Set<ITaxonTreeNode> treeNodes;
-       private TaxonDeletionConfigurator config;
+       private final TaxonDeletionConfigurator config;
 
 
        /**
 
 
        /**
@@ -87,7 +81,7 @@ public class DeleteOperation extends AbstractPersistentPostOperation{
                this.treeNodes = treeNodes;
                this.config = config;
        }
                this.treeNodes = treeNodes;
                this.config = config;
        }
-       
+
 
        /* (non-Javadoc)
         * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
 
        /* (non-Javadoc)
         * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
@@ -104,15 +98,15 @@ public class DeleteOperation extends AbstractPersistentPostOperation{
                        if(taxonNode != null && taxonNode instanceof TaxonNode){
                                //((TaxonNode) treeNode).delete();
 
                        if(taxonNode != null && taxonNode instanceof TaxonNode){
                                //((TaxonNode) treeNode).delete();
 
-                               taxon = ((TaxonNode)taxonNode).getTaxon();
+                               element = ((TaxonNode)taxonNode).getTaxon();
                                try {
                                        service.deleteTaxonNode((TaxonNode)taxonNode, config);
                                } catch (DataChangeNoRollbackException e) {
                                try {
                                        service.deleteTaxonNode((TaxonNode)taxonNode, config);
                                } catch (DataChangeNoRollbackException e) {
-                                       
+
                                        throw new ExecutionException(e.getMessage());
                                        throw new ExecutionException(e.getMessage());
-                                       
+
                                }
                                }
-                               
+
                        }else if(taxonNode != null && taxonNode instanceof Classification){
                                Classification taxonomicTree = (Classification) taxonNode;
                                /*if(taxonomicTree.hasChildNodes()){
                        }else if(taxonNode != null && taxonNode instanceof Classification){
                                Classification taxonomicTree = (Classification) taxonNode;
                                /*if(taxonomicTree.hasChildNodes()){
@@ -125,8 +119,8 @@ public class DeleteOperation extends AbstractPersistentPostOperation{
                                }catch(ReferencedObjectUndeletableException e){
                                        throw new ExecutionException(e.getMessage());
                                }
                                }catch(ReferencedObjectUndeletableException e){
                                        throw new ExecutionException(e.getMessage());
                                }
-                                       
-                                       
+
+
                                /*}else{
                                        try{
                                        CdmStore.getService(IClassificationService.class).delete(taxonomicTree);
                                /*}else{
                                        try{
                                        CdmStore.getService(IClassificationService.class).delete(taxonomicTree);
@@ -141,7 +135,7 @@ public class DeleteOperation extends AbstractPersistentPostOperation{
                                        throw new ExecutionException(e.getMessage());
                                }
                        }
                                        throw new ExecutionException(e.getMessage());
                                }
                        }
-               
+
                monitor.worked(40);
                return postExecute(null);
        }
                monitor.worked(40);
                return postExecute(null);
        }
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractDescriptionPostOperation.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractDescriptionPostOperation.java
new file mode 100644 (file)
index 0000000..c84a01a
--- /dev/null
@@ -0,0 +1,35 @@
+// $Id$
+/**
+* Copyright (C) 2013 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.operation;
+
+import org.eclipse.core.commands.operations.IUndoContext;
+
+import eu.etaxonomy.cdm.model.description.DescriptionBase;
+import eu.etaxonomy.cdm.model.description.IDescribable;
+import eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy;
+
+/**
+ * @author pplitzner
+ * @date 04.12.2013
+ *
+ */
+public abstract class AbstractDescriptionPostOperation<T extends IDescribable<D>, D extends DescriptionBase<IIdentifiableEntityCacheStrategy<D>>> extends AbstractPostOperation<T> {
+
+    protected D description;
+
+    /**
+     *
+     */
+    public AbstractDescriptionPostOperation(String label, IUndoContext undoContext,
+            T describable, IPostOperationEnabled postOperationEnabled) {
+        super(label, undoContext, describable, postOperationEnabled);
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractPostDescribableOperation.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractPostDescribableOperation.java
deleted file mode 100644 (file)
index dad0784..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-// $Id$
-/**
-* Copyright (C) 2013 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.operation;
-
-import eu.etaxonomy.cdm.model.description.IDescribable;
-
-/**
- * @author pplitzner
- * @date 03.12.2013
- *
- */
-public abstract class AbstractPostDescribableOperation extends AbstractPostOperation {
-
-    protected IDescribable describable;
-
-    /**
-     * @param label
-     */
-    public AbstractPostDescribableOperation(String label) {
-        super(label);
-    }
-
-}
index 9506bd4b4046af111523e119e1f0725f50d660e1..5b7c68ec8230074a7de6ef72c0fd5ae812bb3636 100644 (file)
 package eu.etaxonomy.taxeditor.operation;
 
 import org.eclipse.core.commands.operations.AbstractOperation;
 package eu.etaxonomy.taxeditor.operation;
 
 import org.eclipse.core.commands.operations.AbstractOperation;
+import org.eclipse.core.commands.operations.IUndoContext;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
 
 import eu.etaxonomy.cdm.model.common.CdmBase;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
 
 import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.common.ICdmBase;
 
 /**
  * @author pplitzner
  * @date 03.12.2013
  *
  */
 
 /**
  * @author pplitzner
  * @date 03.12.2013
  *
  */
-public abstract class AbstractPostOperation extends AbstractOperation {
+public abstract class AbstractPostOperation<T extends ICdmBase> extends AbstractOperation {
+
 
     /**
 
     /**
-     * 
+     * A reference to the {@link ICdmBase} element the concrete operation is working on
+     */
+    protected T element;
+
+    /**
+     *
      */
     protected IPostOperationEnabled postOperationEnabled;
 
      */
     protected IPostOperationEnabled postOperationEnabled;
 
+
     /**
     /**
-     * @param label
+     * <p>Constructor for AbstractPostOperation.</p>
+     *
+     * @param label a {@link java.lang.String} object.
+     * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
      */
      */
-    public AbstractPostOperation(String label) {
+    protected AbstractPostOperation(String label, IUndoContext undoContext) {
         super(label);
         super(label);
+        addContext(undoContext);
+    }
+
+    /**
+     * <p>Constructor for AbstractPostOperation.</p>
+     *
+     * @param label a {@link java.lang.String} object.
+     * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
+     * @param element a {@link ICdmBase} object on which this operation is working.
+     */
+    public AbstractPostOperation(String label, IUndoContext undoContext, T element) {
+        this(label, undoContext);
+        this.element = element;
+    }
+
+    /**
+     * @param label
+     * @param element
+     * @param postOperationEnabled
+     */
+    public AbstractPostOperation(String label, IUndoContext undoContext,
+            T element, IPostOperationEnabled postOperationEnabled) {
+        this(label, undoContext);
+        this.element = element;
+        this.postOperationEnabled = postOperationEnabled;
     }
 
     /**
     }
 
     /**
@@ -42,7 +79,7 @@ public abstract class AbstractPostOperation extends AbstractOperation {
      * @param objectAffectedByOperation the affected object. Should be <code>null</code> if not needed
      * @return a {@link org.eclipse.core.runtime.IStatus} object.
      */
      * @param objectAffectedByOperation the affected object. Should be <code>null</code> if not needed
      * @return a {@link org.eclipse.core.runtime.IStatus} object.
      */
-    protected IStatus postExecute(CdmBase objectAffectedByOperation) { 
+    protected IStatus postExecute(CdmBase objectAffectedByOperation) {
        if(postOperationEnabled != null){
                return postOperationEnabled.postOperation(objectAffectedByOperation) ? Status.OK_STATUS : Status.CANCEL_STATUS;
        }
        if(postOperationEnabled != null){
                return postOperationEnabled.postOperation(objectAffectedByOperation) ? Status.OK_STATUS : Status.CANCEL_STATUS;
        }
index 6c75b7987949a55b996d3f1de0062312c94596e4..b37c5401060a7b0dc3825b3e1210422ba01ac992 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * Copyright (C) 2007 EDIT
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
 * 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.
 */
 * 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.
 */
@@ -25,12 +25,7 @@ import eu.etaxonomy.cdm.model.taxon.TaxonNode;
  * @created 14.01.2009
  * @version 1.0
  */
  * @created 14.01.2009
  * @version 1.0
  */
-public abstract class AbstractPostTaxonOperation extends AbstractPostOperation {
-       
-       /** 
-        * A reference to the taxon the concrete operation is working on 
-        */
-       protected Taxon taxon;
+public abstract class AbstractPostTaxonOperation extends AbstractPostOperation<Taxon> {
 
        /**
         * A reference to the taxons TaxonNode
 
        /**
         * A reference to the taxons TaxonNode
@@ -39,31 +34,7 @@ public abstract class AbstractPostTaxonOperation extends AbstractPostOperation {
 
        protected UUID parentNodeUuid;
 
 
        protected UUID parentNodeUuid;
 
-       /**
-        * <p>Constructor for AbstractPostOperation.</p>
-        *
-        * @param label a {@link java.lang.String} object.
-        * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
-        */
-       protected AbstractPostTaxonOperation(String label, IUndoContext undoContext) {
-               super(label);
-               addContext(undoContext);
-       }
-       
-       /**
-        * <p>Constructor for AbstractPostOperation.</p>
-        *
-        * @param label 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.
-        */
-       public AbstractPostTaxonOperation(String label, IUndoContext undoContext,
-                       Taxon taxon) {
-               this(label, undoContext);
-               
-               this.taxon = taxon;
-       }
-       
+
        /**
         * <p>Constructor for AbstractPostOperation.</p>
         *
        /**
         * <p>Constructor for AbstractPostOperation.</p>
         *
@@ -74,10 +45,9 @@ public abstract class AbstractPostTaxonOperation extends AbstractPostOperation {
         */
        public AbstractPostTaxonOperation(String label, IUndoContext undoContext,
                        Taxon taxon, IPostOperationEnabled postOperationEnabled) {
         */
        public AbstractPostTaxonOperation(String label, IUndoContext undoContext,
                        Taxon taxon, IPostOperationEnabled postOperationEnabled) {
-               this(label, undoContext, taxon);
-               this.postOperationEnabled = postOperationEnabled;
+               super(label, undoContext, taxon, postOperationEnabled);
        }
        }
-       
+
        /**
         * <p>Constructor for AbstractPostOperation.</p>
         *
        /**
         * <p>Constructor for AbstractPostOperation.</p>
         *
@@ -90,7 +60,7 @@ public abstract class AbstractPostTaxonOperation extends AbstractPostOperation {
                this(label, undoContext, taxonNode.getTaxon(), postOperationEnabled);
                this.taxonNode = taxonNode;
        }
                this(label, undoContext, taxonNode.getTaxon(), postOperationEnabled);
                this.taxonNode = taxonNode;
        }
-       
+
        /**
         * <p>Constructor for AbstractPostOperation.</p>
         *
        /**
         * <p>Constructor for AbstractPostOperation.</p>
         *
@@ -100,12 +70,10 @@ public abstract class AbstractPostTaxonOperation extends AbstractPostOperation {
         * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
         */
        public AbstractPostTaxonOperation(String label, IUndoContext undoContext, UUID parentNodeUuid, IPostOperationEnabled postOperationEnabled){
         * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
         */
        public AbstractPostTaxonOperation(String label, IUndoContext undoContext, UUID parentNodeUuid, IPostOperationEnabled postOperationEnabled){
-               this(label, undoContext);
-               
+               super(label, undoContext, null, postOperationEnabled);
                this.parentNodeUuid = parentNodeUuid;
                this.parentNodeUuid = parentNodeUuid;
-               this.postOperationEnabled = postOperationEnabled;
        }
        }
-       
+
        /**
         * <p>Constructor for AbstractPostOperation.</p>
         *
        /**
         * <p>Constructor for AbstractPostOperation.</p>
         *
@@ -115,9 +83,15 @@ public abstract class AbstractPostTaxonOperation extends AbstractPostOperation {
         */
        public AbstractPostTaxonOperation(String label, IUndoContext undoContext,
                        IPostOperationEnabled postOperationEnabled) {
         */
        public AbstractPostTaxonOperation(String label, IUndoContext undoContext,
                        IPostOperationEnabled postOperationEnabled) {
-               this(label, undoContext);
-               this.postOperationEnabled = postOperationEnabled;
+               super(label, undoContext, null, postOperationEnabled);
        }
        }
-       
-       
+
+    /**
+     * @param text
+     * @param undoContext
+     * @param taxon
+     */
+    public AbstractPostTaxonOperation(String label, IUndoContext undoContext, Taxon taxon) {
+        this(label, undoContext, taxon, null);
+    }
 }
 }