ref #8223: check success before try to open new taxon
authorKatja Luther <k.luther@bgbm.org>
Thu, 11 Apr 2019 08:49:04 +0000 (10:49 +0200)
committerKatja Luther <k.luther@bgbm.org>
Thu, 11 Apr 2019 08:52:13 +0000 (10:52 +0200)
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/NewTaxonNodeHandlerE4.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewTaxonNodeWizard.java

index c3a27ff..780af1a 100644 (file)
@@ -56,7 +56,7 @@ public class NewTaxonNodeHandlerE4 {
                });
                int status = dialog.open();
 
-               if(status == IStatus.OK && wizard.openInEditor()){
+               if(status == IStatus.OK && wizard.openInEditor() && wizard.isSuccess()){
                    EventUtility.postEvent(WorkbenchEventConstants.REFRESH_NAVIGATOR, true);
                        if(wizard.openEmpty()){
                 EditorUtil.openEmptyE4(wizard.getParentTreeNode().getUuid());
index 553438b..e8125dd 100644 (file)
@@ -40,6 +40,7 @@ public class NewTaxonNodeWizard extends AbstractNewEntityWizard<TaxonNode>{
     private UUID generatedTaxonNodeUuid;
     private IWizardPageListener wizardPageListener;
     private boolean isOpenInEditor = false;
+    private boolean success = true;
 
     /**
      * <p>Constructor for AbstractNewEntityWizard.</p>
@@ -83,12 +84,14 @@ public class NewTaxonNodeWizard extends AbstractNewEntityWizard<TaxonNode>{
                                 .fireChangeEvent(new CdmChangeEvent(Action.Create, result.getUpdatedObjects(), NewTaxonNodeWizard.class), true);
 
                     }else{
+                        setSuccess(false);
                         if (!result.isOk()){
                             if (!result.getExceptions().isEmpty()){
                                 MessagingUtils.error(getClass(), "Taxon could not be created", result.getExceptions().iterator().next());
                             }else{
                                 MessagingUtils.warn(getClass(), "Taxon could not be created");
                             }
+
                         }
                     }
           }catch(IllegalArgumentException e){
@@ -167,5 +170,15 @@ public class NewTaxonNodeWizard extends AbstractNewEntityWizard<TaxonNode>{
     }
 
 
+    public boolean isSuccess() {
+        return success;
+    }
+
+
+    public void setSuccess(boolean success) {
+        this.success = success;
+    }
+
+
 
 }