- added preferences for vocabulary names in term labels #4448
authorPatric Plitzner <p.plitzner@bgbm.org>
Wed, 27 May 2015 07:12:05 +0000 (07:12 +0000)
committerPatric Plitzner <p.plitzner@bgbm.org>
Wed, 27 May 2015 07:12:05 +0000 (07:12 +0000)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/DescriptionPreferences.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/TermComboElement.java

index f689bbf5b7222b1efcc96b254171b4ce3e087208..acd6f33429ca44e4376bcd7b26d5f1bc008ea159 100644 (file)
@@ -1,15 +1,16 @@
 /**
 * Copyright (C) 2007 EDIT
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
 
 package eu.etaxonomy.taxeditor.preference;
 
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
 
 package eu.etaxonomy.taxeditor.preference;
 
-import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Composite;
@@ -24,19 +25,16 @@ import org.eclipse.ui.IWorkbenchPreferencePage;
  * @created 20.05.2008
  * @version 1.0
  */
  * @created 20.05.2008
  * @version 1.0
  */
-public class DescriptionPreferences extends PreferencePage implements
+public class DescriptionPreferences extends FieldEditorPreferencePage implements
                IWorkbenchPreferencePage {
 
        /** Constant <code>PLUGIN_ID="eu.etaxonomy.taxeditor.preferences.desc"{trunked}</code> */
        public static final String PLUGIN_ID = "eu.etaxonomy.taxeditor.preferences.description";
                IWorkbenchPreferencePage {
 
        /** Constant <code>PLUGIN_ID="eu.etaxonomy.taxeditor.preferences.desc"{trunked}</code> */
        public static final String PLUGIN_ID = "eu.etaxonomy.taxeditor.preferences.description";
-       
-       /* (non-Javadoc)
-        * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
-        */
+
        /** {@inheritDoc} */
        @Override
        protected Control createContents(Composite parent) {
        /** {@inheritDoc} */
        @Override
        protected Control createContents(Composite parent) {
-               
+
                Composite container = new Composite(parent, SWT.NULL);
                container.setLayout(new GridLayout());
 
                Composite container = new Composite(parent, SWT.NULL);
                container.setLayout(new GridLayout());
 
@@ -44,11 +42,16 @@ public class DescriptionPreferences extends PreferencePage implements
                return container;
        }
 
                return container;
        }
 
-       /* (non-Javadoc)
-        * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
-        */
        /** {@inheritDoc} */
        /** {@inheritDoc} */
-       public void init(IWorkbench workbench) {
+       @Override
+    public void init(IWorkbench workbench) {
 
        }
 
        }
+
+       @Override
+       protected void createFieldEditors() {
+           addField(new BooleanFieldEditor(IPreferenceKeys.SHOW_VOCABULARY_ID_FOR_TERM_LABELS,
+                   "Show vocabulary id for term labels.",
+                getFieldEditorParent()));
+       }
 }
 }
index 337849c0f206aaca2beced51edfbcfd21d351468..fc2422da97852185043d89dd3254ebce88d9377f 100644 (file)
@@ -51,10 +51,15 @@ public interface IPreferenceKeys {
        public static final String SHOW_DEBUG_INFORMATION = "eu.etaxonomy.taxeditor.showDebugInformation";
 
        /**
        public static final String SHOW_DEBUG_INFORMATION = "eu.etaxonomy.taxeditor.showDebugInformation";
 
        /**
-        * Whether to show UUID and database id in the supplemental data view.
+        * Whether to show database id in the entity selection dialogs.
         */
        public static final String SHOW_ID_IN_ENTITY_SELECTION_DIAOLOG = "eu.etaxonomy.taxeditor.showIdInEntitySelectionDiaolog";
 
         */
        public static final String SHOW_ID_IN_ENTITY_SELECTION_DIAOLOG = "eu.etaxonomy.taxeditor.showIdInEntitySelectionDiaolog";
 
+       /**
+        * Whether to show vocabulary of the term when displaying it's label.
+        */
+       public static final String SHOW_VOCABULARY_ID_FOR_TERM_LABELS = "eu.etaxonomy.taxeditor.showVocabularyIdForTermLabels";
+
        /**
         *
         */
        /**
         *
         */
index c93943155657c8ce6167c6d7e411df4a337f257a..39993d70ae5ac5f48f296bf4ce127131f73e28c1 100644 (file)
@@ -25,6 +25,7 @@ import eu.etaxonomy.cdm.model.common.DefinedTermBase;
 import eu.etaxonomy.cdm.model.common.TermType;
 import eu.etaxonomy.cdm.model.common.TermVocabulary;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.cdm.model.common.TermType;
 import eu.etaxonomy.cdm.model.common.TermVocabulary;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.preference.Resources;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.preference.Resources;
 import eu.etaxonomy.taxeditor.store.CdmStore;
@@ -283,7 +284,8 @@ public class TermComboElement<T extends DefinedTermBase>
                        return "";
                }else{
                        String termLabel = term.getLabel(CdmStore.getDefaultLanguage());
                        return "";
                }else{
                        String termLabel = term.getLabel(CdmStore.getDefaultLanguage());
-                       if(term.getVocabulary()!=null){
+                       if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_VOCABULARY_ID_FOR_TERM_LABELS)
+                           && term.getVocabulary()!=null){
                            termLabel += " ["+term.getVocabulary().getLabel(CdmStore.getDefaultLanguage())+"]";
                        }
             return termLabel;
                            termLabel += " ["+term.getVocabulary().getLabel(CdmStore.getDefaultLanguage())+"]";
                        }
             return termLabel;