avoid NPE in check for dirty editors
authorKatja Luther <k.luther@bgbm.org>
Mon, 10 Jul 2017 06:59:41 +0000 (08:59 +0200)
committerKatja Luther <k.luther@bgbm.org>
Mon, 10 Jul 2017 10:38:33 +0000 (12:38 +0200)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbstractImportWizard.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/GenericConfiguratorWizardPage.java

index 313ce1e793c404dab1c93fcec02d31d0b32b17b3..b77dbb8f4c32cf2578a3d0206968e7ffc079a718 100644 (file)
@@ -78,8 +78,10 @@ public abstract class AbstractImportWizard<CONFIG extends IIoConfigurator> exten
                if(activePage != null){
                        for (IEditorReference reference : activePage.getEditorReferences()) {
                                IEditorPart editor = reference.getEditor(false);
-                               if(editor.isDirty()){
-                                       return true;
+                               if (editor!= null){
+                                       if(editor.isDirty()){
+                                               return true;
+                                       }
                                }
                        }
                }
@@ -88,7 +90,7 @@ public abstract class AbstractImportWizard<CONFIG extends IIoConfigurator> exten
 
        @Override
        public boolean canFinish() {
-           return !existUnsavedEditors() && super.canFinish();
+               return !existUnsavedEditors() && super.canFinish();
        }
 
        public abstract CONFIG getConfigurator();
index 6651d3ecd32af560109448fcdef96467a77535bf..f08e478159c0549921a2857de30833d5fdce1945 100644 (file)
@@ -185,13 +185,13 @@ public class GenericConfiguratorWizardPage extends WizardPage {
         final String methodName = method.getName();
         final Button checkBox = new Button(parent, SWT.CHECK);
 
-        if(configurator.getClass().equals(Abcd206ImportConfigurator.class)){
+       // if(configurator.getClass().equals(Abcd206ImportConfigurator.class)){
             String[] r = methodName.split("set")[1].split("(?=\\p{Upper})");
             checkBox.setText(getLabel(StringUtils.join(r," ")));
-        }
-        else{
-            checkBox.setText(getLabel(methodName));
-        }
+//        }
+//        else{
+//            checkBox.setText(getLabel(methodName));
+//        }
         // retrieve the default values and set the checkbox accordingly
         boolean defaultSelection = executeBooleanGetMethod(configurator, "is"
                 + methodName.substring(3));