fix #8234: moveDescriptionOperation should be executed while saving
authorKatja Luther <k.luther@bgbm.org>
Wed, 10 Apr 2019 08:25:41 +0000 (10:25 +0200)
committerKatja Luther <k.luther@bgbm.org>
Wed, 10 Apr 2019 08:25:41 +0000 (10:25 +0200)
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/e4/handler/MoveDescriptionToOtherTaxonHandlerE4.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/MoveDescriptionToOtherTaxonOperation.java

index 53807c3..19e8f53 100644 (file)
@@ -40,7 +40,6 @@ import eu.etaxonomy.taxeditor.editor.l10n.Messages;
 import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
 import eu.etaxonomy.taxeditor.editor.view.descriptive.e4.FactualDataPartE4;
 import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.MoveDescriptionToOtherTaxonOperation;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
@@ -145,7 +144,11 @@ public class MoveDescriptionToOtherTaxonHandlerE4 implements IPostOperationEnabl
                     this,
                     editor,
                     editor.getEditorInput());
-            AbstractUtility.executeOperation(operation, sync);
+            editor.getEditorInput().addOperation(operation);
+            editor.setDirty();
+            editor.getTaxon().removeDescription(taxonDescription);
+            editor.redraw();
+           // AbstractUtility.executeOperation(operation, sync);
         }
 
 
@@ -159,20 +162,8 @@ public class MoveDescriptionToOtherTaxonHandlerE4 implements IPostOperationEnabl
             @Override
             public void run() {
                 //FIXME E4 migrate
-//                AbstractUtility.close(editor);
-//
                 try {
-//                    MultiPageTaxonEditor possibleOpenEditor = (MultiPageTaxonEditor) EditorUtil.findEditorByTaxonNodeUuid(newAcceptedTaxonNodeUuid);
-//                    if(possibleOpenEditor != null){
-//                        AbstractUtility.close(possibleOpenEditor);
-//                    }
-//                    EventUtility.postEvent(WorkbenchEventConstants.REFRESH_NAME_EDITOR, oldAcceptedTaxonNodeUuid);
-//                    EventUtility.postEvent(WorkbenchEventConstants.REFRESH_NAME_EDITOR, newAcceptedTaxonNodeUuid);
                     EditorUtil.openTaxonNodeE4(newAcceptedTaxonNodeUuid, modelService, partService, application);
-                    EditorUtil.openTaxonNodeE4(oldAcceptedTaxonNodeUuid, modelService, partService, application);
-//                } catch (PartInitException e) {
-//                    MessagingUtils.error(this.getClass(), e);
-//                    throw new RuntimeException(e);
                 } catch (Exception e) {
                     MessagingUtils.warningDialog(Messages.MoveDescriptionToOtherTaxonHandler_CREATE_FAILED, this, e.getMessage());
                 }
index 8234599..52247f5 100644 (file)
@@ -67,10 +67,14 @@ public class MoveDescriptionToOtherTaxonOperation extends
        @Override
        public IStatus execute(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
-               monitor.worked(20);
+           if (monitor != null){
+               monitor.worked(20);
+           }
                bind();
                CdmStore.getService(IDescriptionService.class).moveTaxonDescription(description.getUuid(), newAcceptedTaxonNode.getTaxon().getUuid());
-               monitor.worked(40);
+               if (monitor != null){
+            monitor.worked(40);
+        }
 
                return postExecute(description);
        }