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 313ce1e..b77dbb8 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 6651d3e..f08e478 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));