3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
11 package eu
.etaxonomy
.taxeditor
.preference
;
13 import org
.eclipse
.jface
.preference
.BooleanFieldEditor
;
14 import org
.eclipse
.jface
.preference
.FieldEditorPreferencePage
;
15 import org
.eclipse
.jface
.preference
.StringFieldEditor
;
16 import org
.eclipse
.swt
.SWT
;
17 import org
.eclipse
.swt
.events
.SelectionAdapter
;
18 import org
.eclipse
.swt
.events
.SelectionEvent
;
19 import org
.eclipse
.swt
.layout
.GridData
;
20 import org
.eclipse
.swt
.layout
.RowLayout
;
21 import org
.eclipse
.swt
.widgets
.Combo
;
22 import org
.eclipse
.swt
.widgets
.Composite
;
23 import org
.eclipse
.swt
.widgets
.Label
;
24 import org
.eclipse
.ui
.IWorkbench
;
25 import org
.eclipse
.ui
.IWorkbenchPreferencePage
;
27 import eu
.etaxonomy
.cdm
.persistence
.query
.MatchMode
;
31 * TaxonomicEditorGeneralPreferences class.
35 * @created Sep 1, 2009
38 public class TaxonomicEditorGeneralPreferences
extends
39 FieldEditorPreferencePage
implements IWorkbenchPreferencePage
{
45 * org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors
49 protected void createFieldEditors() {
50 addField(new BooleanFieldEditor(IPreferenceKeys
.SHOW_DEBUG_INFORMATION
,
51 "Show UUID and object ID in supplemental data view.",
52 getFieldEditorParent()));
53 addField(new BooleanFieldEditor(IPreferenceKeys
.SHOW_ID_IN_ENTITY_SELECTION_DIAOLOG
,
54 "Show object id in entity selection dialogs.",
55 getFieldEditorParent()));
56 addField(new BooleanFieldEditor(
57 IPreferenceKeys
.SHOULD_EXPAND_SECTION_WHEN_DATA_AVAILABLE
,
58 "Should expand sections when data is available (Details View). This might make the Editor slow.",
59 getFieldEditorParent()));
60 addField(new StringFieldEditor(
61 IPreferenceKeys
.EDIT_MAP_SERVICE_ACCES_POINT
,
62 "EDIT Map Service Access Point:", getFieldEditorParent()));
63 addField(new BooleanFieldEditor(
64 IPreferenceKeys
.SHOULD_CONNECT_AT_STARTUP
,
65 "Connect to last used datasource when launching",
66 getFieldEditorParent()));
67 addField(new BooleanFieldEditor(
68 IPreferenceKeys
.SHOW_EXPERIMENTAL_FEATURES
,
69 "Show experimental features", getFieldEditorParent()));
70 addField(new BooleanFieldEditor(IPreferenceKeys
.SEARCH_OPEN_RESULTS_IN_SEPARATE_WINDOWS
,
71 "Open search results in separate windows",
72 getFieldEditorParent()));
73 addField(new BooleanFieldEditor(IPreferenceKeys
.SHOW_SIMPLE_NAME_DETAILS_SECTION
,
74 "Show only a simple name details view",
75 getFieldEditorParent()));
77 Composite composite
= new Composite(getFieldEditorParent(), SWT
.NULL
);
78 composite
.setLayoutData(new GridData(SWT
.FILL
, SWT
.TOP
, true, false, 2, 1));
79 composite
.setLayout(new RowLayout(1));
81 final Label label
= new Label(composite
, SWT
.NONE
);
82 label
.setText("Choose the prefered match mode for searches.");
84 final Combo combo_MatchMode
= new Combo(composite
, SWT
.NONE
);
86 MatchMode
[] matchModes
= MatchMode
.values();
87 int currentSelectionIndex
= 0;
88 for(int i
= 0; i
< matchModes
.length
; i
++){
89 MatchMode mode
= matchModes
[i
];
90 combo_MatchMode
.add(mode
.name(),i
);
91 //TODO:the correct preselection is needed here!!
92 if (mode
.equals(PreferencesUtil
.getSearchConfigurator().getMatchMode())){
93 currentSelectionIndex
= i
;
97 combo_MatchMode
.select(currentSelectionIndex
);
99 combo_MatchMode
.addSelectionListener(new SelectionAdapter() {
101 * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
104 public void widgetSelected(SelectionEvent e
) {
105 int selectionIndex
= combo_MatchMode
.getSelectionIndex();
106 PreferencesUtil
.getSearchConfigurator().setMatchMode(MatchMode
.valueOf(combo_MatchMode
.getItem(selectionIndex
)));
119 * org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
122 public void init(IWorkbench workbench
) {
123 setPreferenceStore(PreferencesUtil
.getPreferenceStore());