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.jface.preference.FieldEditorPreferencePage;
|
14
|
import org.eclipse.jface.preference.StringFieldEditor;
|
15
|
import org.eclipse.swt.SWT;
|
16
|
import org.eclipse.swt.events.SelectionAdapter;
|
17
|
import org.eclipse.swt.events.SelectionEvent;
|
18
|
import org.eclipse.swt.layout.GridData;
|
19
|
import org.eclipse.swt.layout.RowLayout;
|
20
|
import org.eclipse.swt.widgets.Combo;
|
21
|
import org.eclipse.swt.widgets.Composite;
|
22
|
import org.eclipse.swt.widgets.Label;
|
23
|
import org.eclipse.ui.IWorkbench;
|
24
|
import org.eclipse.ui.IWorkbenchPreferencePage;
|
25
|
|
26
|
import eu.etaxonomy.cdm.persistence.query.MatchMode;
|
27
|
|
28
|
/**
|
29
|
* <p>
|
30
|
* TaxonomicEditorGeneralPreferences class.
|
31
|
* </p>
|
32
|
*
|
33
|
* @author n.hoffmann
|
34
|
* @created Sep 1, 2009
|
35
|
* @version 1.0
|
36
|
*/
|
37
|
public class TaxonomicEditorGeneralPreferences extends
|
38
|
FieldEditorPreferencePage implements IWorkbenchPreferencePage {
|
39
|
|
40
|
/*
|
41
|
* (non-Javadoc)
|
42
|
*
|
43
|
* @see
|
44
|
* org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors
|
45
|
* ()
|
46
|
*/
|
47
|
@Override
|
48
|
protected void createFieldEditors() {
|
49
|
addField(new BooleanFieldEditor(IPreferenceKeys.SHOW_DEBUG_INFORMATION,
|
50
|
"Show UUID and object ID in supplemental data view.",
|
51
|
getFieldEditorParent()));
|
52
|
addField(new BooleanFieldEditor(IPreferenceKeys.SHOW_ID_IN_ENTITY_SELECTION_DIAOLOG,
|
53
|
"Show object id in entity selection dialogs.",
|
54
|
getFieldEditorParent()));
|
55
|
addField(new BooleanFieldEditor(
|
56
|
IPreferenceKeys.SHOULD_EXPAND_SECTION_WHEN_DATA_AVAILABLE,
|
57
|
"Should expand sections when data is available (Details View). This might make the Editor slow.",
|
58
|
getFieldEditorParent()));
|
59
|
addField(new StringFieldEditor(
|
60
|
IPreferenceKeys.EDIT_MAP_SERVICE_ACCES_POINT,
|
61
|
"EDIT Map Service Access Point:", getFieldEditorParent()));
|
62
|
addField(new BooleanFieldEditor(
|
63
|
IPreferenceKeys.SHOULD_CONNECT_AT_STARTUP,
|
64
|
"Connect to last used datasource when launching",
|
65
|
getFieldEditorParent()));
|
66
|
addField(new BooleanFieldEditor(
|
67
|
IPreferenceKeys.SHOW_EXPERIMENTAL_FEATURES,
|
68
|
"Show experimental features", getFieldEditorParent()));
|
69
|
addField(new BooleanFieldEditor(IPreferenceKeys.SEARCH_OPEN_RESULTS_IN_SEPARATE_WINDOWS,
|
70
|
"Open search results in separate windows",
|
71
|
getFieldEditorParent()));
|
72
|
// addField(new BooleanFieldEditor(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION,
|
73
|
// "Show only a simple name details view",
|
74
|
// getFieldEditorParent()));
|
75
|
|
76
|
Composite composite = new Composite(getFieldEditorParent(), SWT.NULL);
|
77
|
composite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1));
|
78
|
composite.setLayout(new RowLayout(1));
|
79
|
|
80
|
// final Label label = new Label(composite, SWT.NONE);
|
81
|
// label.setText("Choose the prefered match mode for searches.");
|
82
|
//
|
83
|
// final Combo combo_MatchMode = new Combo(composite, SWT.NONE);
|
84
|
//
|
85
|
// MatchMode[] matchModes = MatchMode.values();
|
86
|
// int currentSelectionIndex = 0;
|
87
|
// for(int i = 0; i < matchModes.length; i++){
|
88
|
// MatchMode mode = matchModes[i];
|
89
|
// combo_MatchMode.add(mode.name(),i);
|
90
|
// //TODO:the correct preselection is needed here!!
|
91
|
// if (mode.equals(PreferencesUtil.getSearchConfigurator().getMatchMode())){
|
92
|
// currentSelectionIndex = i;
|
93
|
// }
|
94
|
// }
|
95
|
//
|
96
|
// combo_MatchMode.select(currentSelectionIndex);
|
97
|
//
|
98
|
// combo_MatchMode.addSelectionListener(new SelectionAdapter() {
|
99
|
// /* (non-Javadoc)
|
100
|
// * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
|
101
|
// */
|
102
|
// @Override
|
103
|
// public void widgetSelected(SelectionEvent e) {
|
104
|
// int selectionIndex = combo_MatchMode.getSelectionIndex();
|
105
|
// PreferencesUtil.getSearchConfigurator().setMatchMode(MatchMode.valueOf(combo_MatchMode.getItem(selectionIndex)));
|
106
|
// }
|
107
|
// });
|
108
|
|
109
|
|
110
|
|
111
|
|
112
|
}
|
113
|
|
114
|
/*
|
115
|
* (non-Javadoc)
|
116
|
*
|
117
|
* @see
|
118
|
* org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
|
119
|
*/
|
120
|
@Override
|
121
|
public void init(IWorkbench workbench) {
|
122
|
setPreferenceStore(PreferencesUtil.getPreferenceStore());
|
123
|
}
|
124
|
|
125
|
}
|