1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.taxeditor.preference;
|
11
|
|
12
|
import org.eclipse.jface.preference.BooleanFieldEditor;
|
13
|
import org.eclipse.swt.SWT;
|
14
|
import org.eclipse.swt.layout.GridData;
|
15
|
import org.eclipse.swt.layout.RowLayout;
|
16
|
import org.eclipse.swt.widgets.Composite;
|
17
|
import org.eclipse.ui.internal.IPreferenceConstants;
|
18
|
import org.eclipse.ui.internal.Workbench;
|
19
|
|
20
|
import eu.etaxonomy.taxeditor.l10n.Messages;
|
21
|
import eu.etaxonomy.taxeditor.preference.menu.FieldEditorPreferencePageE4;
|
22
|
|
23
|
/**
|
24
|
* <p>
|
25
|
* TaxonomicEditorGeneralPreferences class.
|
26
|
* </p>
|
27
|
*
|
28
|
* @author n.hoffmann
|
29
|
* @created Sep 1, 2009
|
30
|
* @version 1.0
|
31
|
*/
|
32
|
public class TaxonomicEditorGeneralPreferences extends
|
33
|
FieldEditorPreferencePageE4 {
|
34
|
|
35
|
private BooleanFieldEditor runInBackgroundEditor;
|
36
|
|
37
|
@Override
|
38
|
protected void createFieldEditors() {
|
39
|
runInBackgroundEditor = new BooleanFieldEditor(IPreferenceConstants.RUN_IN_BACKGROUND,
|
40
|
Messages.TaxonomicEditorGeneralPreferences_background,
|
41
|
getFieldEditorParent());
|
42
|
addField(runInBackgroundEditor);
|
43
|
|
44
|
// addField(new BooleanFieldEditor(PreferencesUtil.createPreferenceString(IPreferenceKeys.SHOW_DEBUG_INFORMATION),
|
45
|
// "Show UUID and object ID in supplemental data view",
|
46
|
// getFieldEditorParent()));
|
47
|
// addField(new BooleanFieldEditor(PreferencesUtil.createPreferenceString(IPreferenceKeys.SHOW_ID_IN_ENTITY_SELECTION_DIAOLOG),
|
48
|
// "Show object id in entity selection dialogs",
|
49
|
// getFieldEditorParent()));
|
50
|
// addField(new BooleanFieldEditor(PreferencesUtil.createPreferenceString(
|
51
|
// IPreferenceKeys.SHOULD_EXPAND_SECTION_WHEN_DATA_AVAILABLE),
|
52
|
// "Should expand sections when data is available (Details View). This might make the Editor slow.",
|
53
|
// getFieldEditorParent()));
|
54
|
// addField(new StringFieldEditor(PreferencesUtil.createPreferenceString(
|
55
|
// IPreferenceKeys.EDIT_MAP_SERVICE_ACCES_POINT),
|
56
|
// "EDIT Map Service Access Point:", getFieldEditorParent()));
|
57
|
addField(new BooleanFieldEditor(PreferencesUtil.createPreferenceString(
|
58
|
IPreferenceKeys.SHOULD_CONNECT_AT_STARTUP),
|
59
|
Messages.TaxonomicEditorGeneralPreferences_connect,
|
60
|
getFieldEditorParent()));
|
61
|
// addField(new BooleanFieldEditor(PreferencesUtil.createPreferenceString(
|
62
|
// IPreferenceKeys.SHOW_EXPERIMENTAL_FEATURES),
|
63
|
// "Show experimental features", getFieldEditorParent()));
|
64
|
// addField(new BooleanFieldEditor(IPreferenceKeys.SEARCH_OPEN_RESULTS_IN_SEPARATE_WINDOWS,
|
65
|
// "Open search results in separate windows",
|
66
|
// getFieldEditorParent()));
|
67
|
// addField(new BooleanFieldEditor(PreferencesUtil.createPreferenceString(IPreferenceKeys.SORT_TAXA_BY_RANK_AND_NAME),
|
68
|
// "In selection dialogs for taxa, sort by rank and name",
|
69
|
// getFieldEditorParent()));
|
70
|
// addField(new BooleanFieldEditor(PreferencesUtil.createPreferenceString(
|
71
|
// IPreferenceKeys.FILTER_COMMON_NAME_REFERENCES),
|
72
|
// "Filter common name references", getFieldEditorParent()));
|
73
|
|
74
|
Composite composite = new Composite(getFieldEditorParent(), SWT.NULL);
|
75
|
composite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1));
|
76
|
composite.setLayout(new RowLayout(1));
|
77
|
|
78
|
// final Label label = new Label(composite, SWT.NONE);
|
79
|
// label.setText("Choose the prefered match mode for searches.");
|
80
|
//
|
81
|
// final Combo combo_MatchMode = new Combo(composite, SWT.NONE);
|
82
|
//
|
83
|
// MatchMode[] matchModes = MatchMode.values();
|
84
|
// int currentSelectionIndex = 0;
|
85
|
// for(int i = 0; i < matchModes.length; i++){
|
86
|
// MatchMode mode = matchModes[i];
|
87
|
// combo_MatchMode.add(mode.name(),i);
|
88
|
// //TODO:the correct preselection is needed here!!
|
89
|
// if (mode.equals(PreferencesUtil.getSearchConfigurator().getMatchMode())){
|
90
|
// currentSelectionIndex = i;
|
91
|
// }
|
92
|
// }
|
93
|
//
|
94
|
// combo_MatchMode.select(currentSelectionIndex);
|
95
|
//
|
96
|
// combo_MatchMode.addSelectionListener(new SelectionAdapter() {
|
97
|
// /* (non-Javadoc)
|
98
|
// * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
|
99
|
// */
|
100
|
// @Override
|
101
|
// public void widgetSelected(SelectionEvent e) {
|
102
|
// int selectionIndex = combo_MatchMode.getSelectionIndex();
|
103
|
// PreferencesUtil.getSearchConfigurator().setMatchMode(MatchMode.valueOf(combo_MatchMode.getItem(selectionIndex)));
|
104
|
// }
|
105
|
// });
|
106
|
}
|
107
|
|
108
|
@Override
|
109
|
protected void initialize() {
|
110
|
super.initialize();
|
111
|
//TODO this is a q&d hack to make the e3 preference work
|
112
|
runInBackgroundEditor.setPreferenceStore(Workbench.getInstance().getPreferenceStore());
|
113
|
runInBackgroundEditor.load();
|
114
|
}
|
115
|
|
116
|
}
|