ref #7352: adapt property path for synonyms and taxon relations
authorKatja Luther <k.luther@bgbm.org>
Wed, 18 Apr 2018 13:15:57 +0000 (15:15 +0200)
committerKatja Luther <k.luther@bgbm.org>
Wed, 18 Apr 2018 13:17:07 +0000 (15:17 +0200)
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/e4/TaxonEditorInputE4.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/TaxonNameEditorE4.java

index 206f6416393576bc82aadf1fb24f155b12bdec7f..c054e26278d6ca46a2307d3ae85f816772568ce6 100644 (file)
@@ -19,6 +19,8 @@ import java.util.Map.Entry;
 import java.util.Set;
 import java.util.UUID;
 
+import org.eclipse.e4.ui.di.UISynchronize;
+
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
 import eu.etaxonomy.cdm.api.service.IClassificationService;
@@ -39,9 +41,12 @@ import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
 import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
 import eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput;
 import eu.etaxonomy.taxeditor.editor.ChooseFromMultipleTaxonNodesDialog;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
 import eu.etaxonomy.taxeditor.editor.l10n.Messages;
 import eu.etaxonomy.taxeditor.model.DataChangeBridge;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 
@@ -62,10 +67,19 @@ public class TaxonEditorInputE4  extends CdmEntitySessionInput implements IConve
 
     private Map<TaxonBase, TaxonBaseDeletionConfigurator> toDelete = new HashMap<>();
 
+    private Set<AbstractPostTaxonOperation> operations = new HashSet<>();
+
     private TaxonEditorInputDataChangeBehaviourE4 dataChangeBehavior;
 
     private TaxonBase initiallySelectedTaxonBase;
 
+    UISynchronize sync;
+
+
+    public void setSync(UISynchronize sync) {
+        this.sync = sync;
+    }
+
     private enum CdmType {
         TAXON_NODE,
         TAXON_BASE,
@@ -272,6 +286,18 @@ public class TaxonEditorInputE4  extends CdmEntitySessionInput implements IConve
         return initiallySelectedTaxonBase;
     }
 
+    public Set<AbstractPostTaxonOperation> getOperations() {
+        return operations;
+    }
+
+    public void setOperations(Set<AbstractPostTaxonOperation> operations) {
+        this.operations = operations;
+    }
+
+    public void addOperation(AbstractPostTaxonOperation operation) {
+        this.operations.add(operation);
+    }
+
     @Override
     public List<TaxonNode> getRootEntities() {
         return Arrays.asList(taxonNode);
@@ -286,6 +312,11 @@ public class TaxonEditorInputE4  extends CdmEntitySessionInput implements IConve
             delete(entry.getKey(), entry.getValue());
         }
         toDelete.clear();
+        for(AbstractPostOperation entry:operations){
+            EditorUtil.executeOperation(entry,sync);
+        }
+        operations.clear();
+
         CdmStore.getService(ITaxonNodeService.class).merge(taxonNode, true);
 
     }
@@ -327,9 +358,14 @@ public class TaxonEditorInputE4  extends CdmEntitySessionInput implements IConve
                 "extensions", //$NON-NLS-1$
                 "rights", //$NON-NLS-1$
                 "sources", //$NON-NLS-1$
+                "identifiers",
                 "descriptions", //$NON-NLS-1$
-                "relationsToThisTaxon", //$NON-NLS-1$
-                "relationsFromThisTaxon", //$NON-NLS-1$
+                "relationsToThisTaxon.relatedFrom.name.taxonBases.taxonNodes", //$NON-NLS-1$
+                "relationsToThisTaxon.relatedFrom.name.taxonBases.relationsFromThisTaxon", //$NON-NLS-1$
+                "relationsToThisTaxon.relatedFrom.name.taxonBases.relationsToThisTaxon", //$NON-NLS-1$
+                "relationsFromThisTaxon.relatedTo.name.taxonBases.taxonNodes", //$NON-NLS-1$
+                "relationsFromThisTaxon.relatedTo.name.taxonBases.relationsFromThisTaxon", //$NON-NLS-1$
+                "relationsFromThisTaxon.relatedTo.name.taxonBases.relationsToThisTaxon", //$NON-NLS-1$
                 "taxonNodes", //$NON-NLS-1$
                 "descriptions.descriptionElements.feature", //$NON-NLS-1$
                 "descriptions.descriptionElements.area", //$NON-NLS-1$
@@ -342,13 +378,15 @@ public class TaxonEditorInputE4  extends CdmEntitySessionInput implements IConve
                 "name.taxonBases.taxonNodes", //$NON-NLS-1$
                 "name.relationsFromThisName", //$NON-NLS-1$
                 "name.relationsToThisName", //$NON-NLS-1$
-                "name.homotypicalGroup.typifiedNames.taxonBases.synonymRelations.synonym.name.status", //$NON-NLS-1$
+                "name.homotypicalGroup.typifiedNames.taxonBases.synonyms.synonym.name.status", //$NON-NLS-1$
                 "name.homotypicalGroup.typifiedNames.relationsToThisName.fromName", //$NON-NLS-1$
-                "synonymRelations.synonym.name.status.type", //$NON-NLS-1$
-                "synonymRelations.synonym.name.relationsToThisName.fromName", //$NON-NLS-1$
-                "synonymRelations.synonym.name.nomenclaturalReference.inReference.authorship", //$NON-NLS-1$
-                "synonymRelations.synonym.name.nomenclaturalReference.authorship", //$NON-NLS-1$
-                "synonymRelations.synonym.name.homotypicalGroup.typifiedNames.taxonBases.synonymRelations" //$NON-NLS-1$
+                "synonyms.name.status.type", //$NON-NLS-1$
+                "synonyms.name.relationsToThisName.fromName", //$NON-NLS-1$
+                "synonyms.name.nomenclaturalReference.inReference.authorship", //$NON-NLS-1$
+                "synonyms.name.nomenclaturalReference.authorship", //$NON-NLS-1$
+//                "synonyms.name.homotypicalGroup", //$NON-NLS-1$
+//                "synonyms.synonym.name.homotypicalGroup.typifiedNames", //$NON-NLS-1$
+                "synonyms.name.homotypicalGroup.typifiedNames.taxonBases.synonyms" //$NON-NLS-1$
         });
 
         return taxonBasePropertyPaths;
index 44ca738656e004fb063160372e1f2dc9d79e5606..828f810b50117af22634d260c1adb9bb9238d3bb 100644 (file)
@@ -29,6 +29,7 @@ import org.eclipse.e4.core.services.events.IEventBroker;
 import org.eclipse.e4.ui.di.Focus;
 import org.eclipse.e4.ui.di.Persist;
 import org.eclipse.e4.ui.di.UIEventTopic;
+import org.eclipse.e4.ui.di.UISynchronize;
 import org.eclipse.e4.ui.model.application.ui.MDirtyable;
 import org.eclipse.e4.ui.model.application.ui.basic.MPart;
 import org.eclipse.e4.ui.services.EMenuService;
@@ -120,6 +121,9 @@ public class TaxonNameEditorE4 implements IConversationEnabled, IDirtyMarkable,
 
        private DropTarget target;
 
+       @Inject
+       UISynchronize sync;
+
        private TaxonBase objectAffectedByLastOperation;
 
        @Inject
@@ -385,6 +389,7 @@ public class TaxonNameEditorE4 implements IConversationEnabled, IDirtyMarkable,
                monitor.worked(1);
 
            }
+           input.setSync(sync);
            input.merge();
            // commit the conversation and start a new transaction immediately
         conversation.commit(true);