Revision 64cd2572
Added by Patrick Plitzner almost 9 years ago
- added preferences for vocabulary names in term labels #4448
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/DescriptionPreferences.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* Copyright (C) 2007 EDIT |
3 |
* European Distributed Institute of Taxonomy
|
|
3 |
* European Distributed Institute of Taxonomy |
|
4 | 4 |
* http://www.e-taxonomy.eu |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
9 | 9 |
|
10 | 10 |
package eu.etaxonomy.taxeditor.preference; |
11 | 11 |
|
12 |
import org.eclipse.jface.preference.PreferencePage; |
|
12 |
import org.eclipse.jface.preference.BooleanFieldEditor; |
|
13 |
import org.eclipse.jface.preference.FieldEditorPreferencePage; |
|
13 | 14 |
import org.eclipse.swt.SWT; |
14 | 15 |
import org.eclipse.swt.layout.GridLayout; |
15 | 16 |
import org.eclipse.swt.widgets.Composite; |
... | ... | |
24 | 25 |
* @created 20.05.2008 |
25 | 26 |
* @version 1.0 |
26 | 27 |
*/ |
27 |
public class DescriptionPreferences extends PreferencePage implements |
|
28 |
public class DescriptionPreferences extends FieldEditorPreferencePage implements
|
|
28 | 29 |
IWorkbenchPreferencePage { |
29 | 30 |
|
30 | 31 |
/** Constant <code>PLUGIN_ID="eu.etaxonomy.taxeditor.preferences.desc"{trunked}</code> */ |
31 | 32 |
public static final String PLUGIN_ID = "eu.etaxonomy.taxeditor.preferences.description"; |
32 |
|
|
33 |
/* (non-Javadoc) |
|
34 |
* @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite) |
|
35 |
*/ |
|
33 |
|
|
36 | 34 |
/** {@inheritDoc} */ |
37 | 35 |
@Override |
38 | 36 |
protected Control createContents(Composite parent) { |
39 |
|
|
37 |
|
|
40 | 38 |
Composite container = new Composite(parent, SWT.NULL); |
41 | 39 |
container.setLayout(new GridLayout()); |
42 | 40 |
|
... | ... | |
44 | 42 |
return container; |
45 | 43 |
} |
46 | 44 |
|
47 |
/* (non-Javadoc) |
|
48 |
* @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) |
|
49 |
*/ |
|
50 | 45 |
/** {@inheritDoc} */ |
51 |
public void init(IWorkbench workbench) { |
|
46 |
@Override |
|
47 |
public void init(IWorkbench workbench) { |
|
52 | 48 |
|
53 | 49 |
} |
50 |
|
|
51 |
@Override |
|
52 |
protected void createFieldEditors() { |
|
53 |
addField(new BooleanFieldEditor(IPreferenceKeys.SHOW_VOCABULARY_ID_FOR_TERM_LABELS, |
|
54 |
"Show vocabulary id for term labels.", |
|
55 |
getFieldEditorParent())); |
|
56 |
} |
|
54 | 57 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java | ||
---|---|---|
51 | 51 |
public static final String SHOW_DEBUG_INFORMATION = "eu.etaxonomy.taxeditor.showDebugInformation"; |
52 | 52 |
|
53 | 53 |
/** |
54 |
* Whether to show UUID and database id in the supplemental data view.
|
|
54 |
* Whether to show database id in the entity selection dialogs.
|
|
55 | 55 |
*/ |
56 | 56 |
public static final String SHOW_ID_IN_ENTITY_SELECTION_DIAOLOG = "eu.etaxonomy.taxeditor.showIdInEntitySelectionDiaolog"; |
57 | 57 |
|
58 |
/** |
|
59 |
* Whether to show vocabulary of the term when displaying it's label. |
|
60 |
*/ |
|
61 |
public static final String SHOW_VOCABULARY_ID_FOR_TERM_LABELS = "eu.etaxonomy.taxeditor.showVocabularyIdForTermLabels"; |
|
62 |
|
|
58 | 63 |
/** |
59 | 64 |
* |
60 | 65 |
*/ |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/TermComboElement.java | ||
---|---|---|
25 | 25 |
import eu.etaxonomy.cdm.model.common.TermType; |
26 | 26 |
import eu.etaxonomy.cdm.model.common.TermVocabulary; |
27 | 27 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
28 |
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys; |
|
28 | 29 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
29 | 30 |
import eu.etaxonomy.taxeditor.preference.Resources; |
30 | 31 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
... | ... | |
283 | 284 |
return ""; |
284 | 285 |
}else{ |
285 | 286 |
String termLabel = term.getLabel(CdmStore.getDefaultLanguage()); |
286 |
if(term.getVocabulary()!=null){ |
|
287 |
if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_VOCABULARY_ID_FOR_TERM_LABELS) |
|
288 |
&& term.getVocabulary()!=null){ |
|
287 | 289 |
termLabel += " ["+term.getVocabulary().getLabel(CdmStore.getDefaultLanguage())+"]"; |
288 | 290 |
} |
289 | 291 |
return termLabel; |
Also available in: Unified diff