1
|
package eu.etaxonomy.taxeditor.preference;
|
2
|
|
3
|
|
4
|
import org.eclipse.jface.preference.PreferencePage;
|
5
|
import org.eclipse.swt.SWT;
|
6
|
import org.eclipse.swt.events.SelectionAdapter;
|
7
|
import org.eclipse.swt.events.SelectionEvent;
|
8
|
import org.eclipse.swt.layout.GridLayout;
|
9
|
import org.eclipse.swt.widgets.Button;
|
10
|
import org.eclipse.swt.widgets.Composite;
|
11
|
import org.eclipse.swt.widgets.Control;
|
12
|
import org.eclipse.swt.widgets.Label;
|
13
|
import org.eclipse.ui.IWorkbench;
|
14
|
import org.eclipse.ui.IWorkbenchPreferencePage;
|
15
|
|
16
|
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
|
17
|
|
18
|
|
19
|
public class NameDetailsViewConfiguration extends PreferencePage implements IWorkbenchPreferencePage {
|
20
|
boolean isSimpleDetailsViewActivated;
|
21
|
boolean isUseLocalSettings;
|
22
|
Composite child ;
|
23
|
@Override
|
24
|
public void init(IWorkbench workbench) {
|
25
|
|
26
|
}
|
27
|
|
28
|
/*
|
29
|
* (non-Javadoc)
|
30
|
*
|
31
|
* @see
|
32
|
* org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors
|
33
|
* ()
|
34
|
*/
|
35
|
@Override
|
36
|
protected Control createContents(Composite parent) {
|
37
|
|
38
|
Composite composite = new Composite(parent, SWT.NULL);
|
39
|
composite.setLayout(new GridLayout());
|
40
|
|
41
|
boolean isAllowOverride = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.NameDetailsView).isAllowOverride();
|
42
|
|
43
|
|
44
|
if (isAllowOverride){
|
45
|
|
46
|
final Button activateLocalButton = new Button(composite, SWT.CHECK);
|
47
|
activateLocalButton.setText("Use local settings for display of name details");
|
48
|
activateLocalButton.setSelection( PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.OVERRIDE_NAME_DETAILS));
|
49
|
activateLocalButton.addSelectionListener(new SelectionAdapter(){
|
50
|
@Override
|
51
|
public void widgetSelected(SelectionEvent e) {
|
52
|
isUseLocalSettings = activateLocalButton.getSelection();
|
53
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.OVERRIDE_NAME_DETAILS, isUseLocalSettings);
|
54
|
if(isUseLocalSettings ){
|
55
|
child.setVisible(true);
|
56
|
child.setEnabled(true);
|
57
|
}else{
|
58
|
child.setVisible(false);
|
59
|
child.setEnabled(false);
|
60
|
}
|
61
|
}
|
62
|
});
|
63
|
|
64
|
isSimpleDetailsViewActivated = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION);
|
65
|
final Button activateCheckButton = new Button(composite, SWT.CHECK);
|
66
|
activateCheckButton.setText("Show only a simple name details view");
|
67
|
activateCheckButton.setSelection(isSimpleDetailsViewActivated);
|
68
|
activateCheckButton.addSelectionListener(new SelectionAdapter(){
|
69
|
@Override
|
70
|
public void widgetSelected(SelectionEvent e) {
|
71
|
isSimpleDetailsViewActivated = activateCheckButton.getSelection();
|
72
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION, isSimpleDetailsViewActivated);
|
73
|
if(isSimpleDetailsViewActivated){
|
74
|
child.setVisible(true);
|
75
|
child.setEnabled(true);
|
76
|
}else{
|
77
|
child.setVisible(false);
|
78
|
child.setEnabled(false);
|
79
|
}
|
80
|
}
|
81
|
});
|
82
|
|
83
|
child = new Composite(composite, SWT.H_SCROLL);
|
84
|
child.setLayout(new GridLayout());
|
85
|
child.setVisible(isSimpleDetailsViewActivated);
|
86
|
|
87
|
final Button showTaxon = new Button(child, SWT.CHECK);
|
88
|
boolean isShowTaxon = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON);
|
89
|
showTaxon.setText("Show taxon of the name");
|
90
|
showTaxon.setSelection(isShowTaxon);
|
91
|
showTaxon.addSelectionListener(new SelectionAdapter(){
|
92
|
@Override
|
93
|
public void widgetSelected(SelectionEvent e) {
|
94
|
boolean isShowTaxon = showTaxon.getSelection();
|
95
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON, isShowTaxon);
|
96
|
}
|
97
|
});
|
98
|
|
99
|
final Button showLsid = new Button(child, SWT.CHECK);
|
100
|
boolean isShowLSID = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID);
|
101
|
showLsid.setText("Show Lsid of the name");
|
102
|
showLsid.setSelection(isShowLSID);
|
103
|
showLsid.addSelectionListener(new SelectionAdapter(){
|
104
|
@Override
|
105
|
public void widgetSelected(SelectionEvent e) {
|
106
|
boolean isShowLSID = showLsid.getSelection();
|
107
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID, isShowLSID);
|
108
|
}
|
109
|
});
|
110
|
|
111
|
final Button showNomenclaturalCode = new Button(child, SWT.CHECK);
|
112
|
boolean isShowNomenclaturalCode = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE);
|
113
|
showNomenclaturalCode.setText("Show the nomenclatural code");
|
114
|
showNomenclaturalCode.setSelection(isShowNomenclaturalCode);
|
115
|
showNomenclaturalCode.addSelectionListener(new SelectionAdapter(){
|
116
|
@Override
|
117
|
public void widgetSelected(SelectionEvent e) {
|
118
|
boolean isShowNomenclaturalCode = showNomenclaturalCode.getSelection();
|
119
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE, isShowNomenclaturalCode);
|
120
|
}
|
121
|
});
|
122
|
|
123
|
final Button showNameCache = new Button(child, SWT.CHECK);
|
124
|
boolean isShowNameCache = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE);
|
125
|
showNameCache.setText("Show nameCache of the name (only the scientific name without the author and year)");
|
126
|
showNameCache.setSelection(isShowNomenclaturalCode);
|
127
|
showNameCache.addSelectionListener(new SelectionAdapter(){
|
128
|
@Override
|
129
|
public void widgetSelected(SelectionEvent e) {
|
130
|
boolean isShowNameCache = showNameCache.getSelection();
|
131
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE, isShowNameCache);
|
132
|
}
|
133
|
});
|
134
|
final Button showAppendedPhrase = new Button(child, SWT.CHECK);
|
135
|
boolean isShowAppendedPhrase = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE);
|
136
|
showAppendedPhrase.setText("Show appended phrase");
|
137
|
showAppendedPhrase.setSelection(isShowAppendedPhrase);
|
138
|
showAppendedPhrase.addSelectionListener(new SelectionAdapter(){
|
139
|
@Override
|
140
|
public void widgetSelected(SelectionEvent e) {
|
141
|
boolean isShowAppendedPhrase = showAppendedPhrase.getSelection();
|
142
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE, isShowAppendedPhrase);
|
143
|
}
|
144
|
});
|
145
|
|
146
|
final Button showRank = new Button(child, SWT.CHECK);
|
147
|
boolean isShowRank = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK);
|
148
|
showRank.setText("Show rank of the name");
|
149
|
showRank.setSelection(isShowRank);
|
150
|
showRank.addSelectionListener(new SelectionAdapter(){
|
151
|
@Override
|
152
|
public void widgetSelected(SelectionEvent e) {
|
153
|
boolean isShowRank = showRank.getSelection();
|
154
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK, isShowRank);
|
155
|
}
|
156
|
});
|
157
|
final Button showEpithets = new Button(child, SWT.CHECK);
|
158
|
boolean isShowEpithets = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS);
|
159
|
showEpithets.setText("Show atomised epithets");
|
160
|
showEpithets.setSelection(isShowEpithets);
|
161
|
showEpithets.addSelectionListener(new SelectionAdapter(){
|
162
|
@Override
|
163
|
public void widgetSelected(SelectionEvent e) {
|
164
|
boolean isShowEpithets = showEpithets.getSelection();
|
165
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS, isShowEpithets);
|
166
|
}
|
167
|
});
|
168
|
final Button showAuthorship = new Button(child, SWT.CHECK);
|
169
|
boolean isShowAuthorship = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP);
|
170
|
showAuthorship.setText("Show authorship section");
|
171
|
showAuthorship.setSelection(isShowAuthorship);
|
172
|
showAuthorship.addSelectionListener(new SelectionAdapter(){
|
173
|
@Override
|
174
|
public void widgetSelected(SelectionEvent e) {
|
175
|
boolean isShowAuthorship = showAuthorship.getSelection();
|
176
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP, isShowAuthorship);
|
177
|
}
|
178
|
});
|
179
|
|
180
|
final Button showNomenclaturalRef = new Button(child, SWT.CHECK);
|
181
|
boolean isShowNomenclaturalRef = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE);
|
182
|
showNomenclaturalRef.setText("Show nomenclatural reference section");
|
183
|
showNomenclaturalRef.setSelection(isShowNomenclaturalRef);
|
184
|
showNomenclaturalRef.addSelectionListener(new SelectionAdapter(){
|
185
|
@Override
|
186
|
public void widgetSelected(SelectionEvent e) {
|
187
|
boolean isShowNomenclaturalRef = showNomenclaturalRef.getSelection();
|
188
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE, isShowNomenclaturalRef);
|
189
|
}
|
190
|
});
|
191
|
|
192
|
final Button showNomenclaturalStatus = new Button(child, SWT.CHECK);
|
193
|
boolean isShowNomenclaturalStatus = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS);
|
194
|
showNomenclaturalStatus.setText("Show nomenclatural status section");
|
195
|
showNomenclaturalStatus.setSelection(isShowNomenclaturalStatus);
|
196
|
showNomenclaturalStatus.addSelectionListener(new SelectionAdapter(){
|
197
|
@Override
|
198
|
public void widgetSelected(SelectionEvent e) {
|
199
|
boolean isShowNomenclaturalStatus = showNomenclaturalStatus.getSelection();
|
200
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS, isShowNomenclaturalStatus);
|
201
|
}
|
202
|
});
|
203
|
|
204
|
final Button showProtologue = new Button(child, SWT.CHECK);
|
205
|
boolean isShowProtologue = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE);
|
206
|
showProtologue.setText("Show protologue section");
|
207
|
showProtologue.setSelection(isShowProtologue);
|
208
|
showProtologue.addSelectionListener(new SelectionAdapter(){
|
209
|
@Override
|
210
|
public void widgetSelected(SelectionEvent e) {
|
211
|
boolean isShowProtologue = showProtologue.getSelection();
|
212
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE, isShowProtologue);
|
213
|
}
|
214
|
});
|
215
|
|
216
|
final Button showTypeDesignation = new Button(child, SWT.CHECK);
|
217
|
boolean isShowTypeDesignation = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION);
|
218
|
showTypeDesignation.setText("Show name type designation section");
|
219
|
showTypeDesignation.setSelection(isShowTypeDesignation);
|
220
|
showTypeDesignation.addSelectionListener(new SelectionAdapter(){
|
221
|
@Override
|
222
|
public void widgetSelected(SelectionEvent e) {
|
223
|
boolean isShowTypeDesignation = showTypeDesignation.getSelection();
|
224
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION, isShowTypeDesignation);
|
225
|
}
|
226
|
});
|
227
|
|
228
|
|
229
|
final Button showNameRelationship = new Button(child, SWT.CHECK);
|
230
|
boolean isShowNameRelationship = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP);
|
231
|
showNameRelationship.setText("Show name relationship section");
|
232
|
showNameRelationship.setSelection(isShowNameRelationship);
|
233
|
showNameRelationship.addSelectionListener(new SelectionAdapter(){
|
234
|
@Override
|
235
|
public void widgetSelected(SelectionEvent e) {
|
236
|
boolean isShowNameRelationship = showNameRelationship.getSelection();
|
237
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP, isShowNameRelationship);
|
238
|
}
|
239
|
});
|
240
|
|
241
|
final Button showHybrid = new Button(child, SWT.CHECK);
|
242
|
boolean isShowHybrid = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_HYBRID);
|
243
|
showHybrid.setText("Show hybrid section");
|
244
|
showHybrid.setSelection(isShowHybrid);
|
245
|
showHybrid.addSelectionListener(new SelectionAdapter(){
|
246
|
@Override
|
247
|
public void widgetSelected(SelectionEvent e) {
|
248
|
boolean isShowHybrid = showHybrid.getSelection();
|
249
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_HYBRID, isShowHybrid);
|
250
|
}
|
251
|
});
|
252
|
final Button showNameApprobiation = new Button(child, SWT.CHECK);
|
253
|
boolean isShowNameApprobiation = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_APPROBATION);
|
254
|
showNameApprobiation.setText("Show name approbiation (for bacterial names)");
|
255
|
showNameApprobiation.setSelection(isShowNameApprobiation);
|
256
|
showNameApprobiation.addSelectionListener(new SelectionAdapter(){
|
257
|
@Override
|
258
|
public void widgetSelected(SelectionEvent e) {
|
259
|
boolean isShowNameApprobiation = showNameApprobiation.getSelection();
|
260
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_APPROBATION, isShowNameApprobiation);
|
261
|
}
|
262
|
});
|
263
|
|
264
|
|
265
|
if(isSimpleDetailsViewActivated){
|
266
|
child.setEnabled(true);
|
267
|
}else{
|
268
|
child.setEnabled(false);
|
269
|
}
|
270
|
}else{
|
271
|
Label label = new Label(composite, SWT.NONE);
|
272
|
label.setText("The CDM settings don't allow to set the preferences for the display of name details locally. If you need to make local settings, please ask an administrator.");
|
273
|
}
|
274
|
return composite;
|
275
|
|
276
|
|
277
|
|
278
|
}
|
279
|
|
280
|
}
|