ref #7063: fix NPE in local preferences
authorKatja Luther <k.luther@bgbm.org>
Tue, 16 Oct 2018 12:24:19 +0000 (14:24 +0200)
committerKatja Luther <k.luther@bgbm.org>
Tue, 16 Oct 2018 12:24:19 +0000 (14:24 +0200)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/e4/OpenDistributionEditorWizardHandlerE4.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/wizard/AvailableVocabularyWizard.java

index eed2fc9ce9a9a4b77b4e8623bd4056e04ab87717..7a1d941189a0f677e134646e537bd1c5b11a3009 100755 (executable)
@@ -15,6 +15,8 @@ import org.eclipse.e4.ui.services.IServiceConstants;
 import org.eclipse.jface.wizard.WizardDialog;
 import org.eclipse.swt.widgets.Shell;
 
+import eu.etaxonomy.cdm.model.metadata.CdmPreference;
+import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
 import eu.etaxonomy.taxeditor.preference.wizard.AvailableVocabularyWizard;
 
 /**
@@ -29,8 +31,8 @@ public class OpenDistributionEditorWizardHandlerE4 {
 
         @Execute
         public void execute(@Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
-
-            AvailableVocabularyWizard wizard = new AvailableVocabularyWizard(true, null, "Distribution");
+            CdmPreference pref = CdmPreference.NewDatabaseInstance(PreferencePredicate.AvailableDistributionAreaVocabularies, null);
+            AvailableVocabularyWizard wizard = new AvailableVocabularyWizard(true, pref, "Distribution");
 
             WizardDialog dialog = new WizardDialog(shell,
                     wizard);
index fa71101fa4749509b32c6c43ba2ec36dc7493690..9583c11f519ac608cfdbccc57ebbf3ed23bf78e1 100755 (executable)
@@ -124,7 +124,10 @@ public class AvailableVocabularyWizard extends Wizard implements IConversationEn
                 }
             }
            String saveCheckedElements = StringUtils.join(listUIIDChecked, ";");
-          //
+           String predicate = null;
+           if (pref != null){
+               predicate = pref.getPredicate();
+           }
            CdmPreference savePref = CdmPreference.NewInstance(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.getByKey(pref.getPredicate()), saveCheckedElements);
            PreferencesUtil.setPreferenceToDB(savePref);