ref #7440: filter common name references only when preference is set
authorKatja Luther <k.luther@bgbm.org>
Mon, 1 Oct 2018 12:22:04 +0000 (14:22 +0200)
committerKatja Luther <k.luther@bgbm.org>
Mon, 1 Oct 2018 12:22:04 +0000 (14:22 +0200)
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/LifeCycleManager.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/supplemental/AbstractReferencedEntityElement.java

index 8b8f12aafc958d81a64f0581568d20a12a411176..382829e30834399068d0a07d09df8ed07a74d76b 100644 (file)
@@ -34,6 +34,7 @@ import org.eclipse.ui.IMemento;
 import org.osgi.service.event.Event;
 
 import eu.etaxonomy.taxeditor.model.IContextListener;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 
 /**
@@ -63,6 +64,7 @@ public class LifeCycleManager implements IContextListener{
     private void processAdditions(MApplication application) {
         this.application = application;
         hideParts();
+
     }
 
     @ProcessRemovals
@@ -124,6 +126,7 @@ public class LifeCycleManager implements IContextListener{
      */
     @Override
     public void contextStart(IMemento memento, IProgressMonitor monitor) {
+        PreferencesUtil.updateDBPreferences();
         hideParts();
     }
 
index 0f787302508cf9869925c7957b51131944966bab..2c5eaf5954531c94bddf59aab0498e79c593fde5 100644 (file)
@@ -235,6 +235,8 @@ public interface IPreferenceKeys {
     public static final String INHERIT_FROM_PARENT = "PARENT";
     public static final String PUBLISH = "PUBLISH";
 
+    public static final String FILTER_COMMON_NAME_REFERENCES = "eu.etaxonomy.taxeditor.references.selection.filterCommonNameReferences";
+
 
 
 
index 35889bca0d064cbd08c936ea3567b46a8a7944cd..1e1deedae30940e990fa4a2cef2b99d5c22d8a20 100644 (file)
@@ -600,6 +600,7 @@ public class PreferencesUtil implements IPreferenceKeys {
                getPreferenceStore().setDefault(OVERRIDE_SPECIMEN_PREF, false);
                getPreferenceStore().setDefault(OVERRIDE_NAME_DETAILS, false);
                getPreferenceStore().setDefault(DISTRIBUTION_AREA_PREFRENCES_ACTIVE_OVERRIDE, false);
+               getPreferenceStore().setDefault(FILTER_COMMON_NAME_REFERENCES, false);
 
 
        }
@@ -1602,6 +1603,10 @@ public static String getPreferredVocabulariesForDistributionEditor(boolean local
 
 }
 
+public static boolean getFilterCommonNameReferences(){
+    return getPreferenceStore().getBoolean(PreferencesUtil.FILTER_COMMON_NAME_REFERENCES);
+}
+
 /**
  *
  */
index d94df521895c78bc3f462333e22b04d344dfa5e8..2255fdd2624f0618018220aa21ea19999fb4bf2f 100644 (file)
@@ -14,6 +14,7 @@ import org.eclipse.swt.events.SelectionListener;
 
 import eu.etaxonomy.cdm.model.common.ReferencedEntityBase;
 import eu.etaxonomy.cdm.model.reference.Reference;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
@@ -64,7 +65,7 @@ public abstract class AbstractReferencedEntityElement<T extends ReferencedEntity
        /** {@inheritDoc} */
        @Override
        public void createControls(ICdmFormElement formElement, int style) {
-           if (isCommonNameReference){
+           if (isCommonNameReference && PreferencesUtil.getFilterCommonNameReferences()){
                selection_reference = formFactory
                     .createCommonNameReferenceSelectionElement(formElement, "Reference",
                             null, EntitySelectionElement.ALL, style);