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.ui.IWorkbench;
|
13
|
import org.eclipse.ui.IWorkbenchPreferencePage;
|
14
|
|
15
|
|
16
|
public class NameDetailsViewConfiguration extends PreferencePage implements IWorkbenchPreferencePage {
|
17
|
boolean isSimpleDetailsViewActivated;
|
18
|
Composite child ;
|
19
|
@Override
|
20
|
public void init(IWorkbench workbench) {
|
21
|
|
22
|
}
|
23
|
|
24
|
/*
|
25
|
* (non-Javadoc)
|
26
|
*
|
27
|
* @see
|
28
|
* org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors
|
29
|
* ()
|
30
|
*/
|
31
|
@Override
|
32
|
protected Control createContents(Composite parent) {
|
33
|
|
34
|
Composite composite = new Composite(parent, SWT.NULL);
|
35
|
composite.setLayout(new GridLayout());
|
36
|
|
37
|
//boolean isAllowOverride = PreferencesUtil
|
38
|
isSimpleDetailsViewActivated = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION);
|
39
|
final Button activateCheckButton = new Button(composite, SWT.CHECK);
|
40
|
activateCheckButton.setText("Show only a simple name details view");
|
41
|
activateCheckButton.setSelection(isSimpleDetailsViewActivated);
|
42
|
activateCheckButton.addSelectionListener(new SelectionAdapter(){
|
43
|
@Override
|
44
|
public void widgetSelected(SelectionEvent e) {
|
45
|
isSimpleDetailsViewActivated = activateCheckButton.getSelection();
|
46
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION, isSimpleDetailsViewActivated);
|
47
|
if(isSimpleDetailsViewActivated){
|
48
|
child.setVisible(true);
|
49
|
child.setEnabled(true);
|
50
|
}else{
|
51
|
child.setVisible(false);
|
52
|
child.setEnabled(false);
|
53
|
}
|
54
|
}
|
55
|
});
|
56
|
|
57
|
child = new Composite(composite, SWT.NULL);
|
58
|
child.setLayout(new GridLayout());
|
59
|
child.setVisible(isSimpleDetailsViewActivated);
|
60
|
|
61
|
final Button showTaxon = new Button(child, SWT.CHECK);
|
62
|
boolean isShowTaxon = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON);
|
63
|
showTaxon.setText("Show taxon of the name");
|
64
|
showTaxon.setSelection(isShowTaxon);
|
65
|
showTaxon.addSelectionListener(new SelectionAdapter(){
|
66
|
@Override
|
67
|
public void widgetSelected(SelectionEvent e) {
|
68
|
boolean isShowTaxon = showTaxon.getSelection();
|
69
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON, isShowTaxon);
|
70
|
}
|
71
|
});
|
72
|
|
73
|
final Button showLsid = new Button(child, SWT.CHECK);
|
74
|
boolean isShowLSID = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID);
|
75
|
showLsid.setText("Show Lsid of the name");
|
76
|
showLsid.setSelection(isShowLSID);
|
77
|
showLsid.addSelectionListener(new SelectionAdapter(){
|
78
|
@Override
|
79
|
public void widgetSelected(SelectionEvent e) {
|
80
|
boolean isShowLSID = showLsid.getSelection();
|
81
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID, isShowLSID);
|
82
|
}
|
83
|
});
|
84
|
|
85
|
final Button showNomenclaturalCode = new Button(child, SWT.CHECK);
|
86
|
boolean isShowNomenclaturalCode = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE);
|
87
|
showNomenclaturalCode.setText("Show the nomenclatural code");
|
88
|
showNomenclaturalCode.setSelection(isShowNomenclaturalCode);
|
89
|
showNomenclaturalCode.addSelectionListener(new SelectionAdapter(){
|
90
|
@Override
|
91
|
public void widgetSelected(SelectionEvent e) {
|
92
|
boolean isShowNomenclaturalCode = showNomenclaturalCode.getSelection();
|
93
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE, isShowNomenclaturalCode);
|
94
|
}
|
95
|
});
|
96
|
|
97
|
final Button showNameCache = new Button(child, SWT.CHECK);
|
98
|
boolean isShowNameCache = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE);
|
99
|
showNameCache.setText("Show nameCache of the name (only the scientific name without the author and year)");
|
100
|
showNameCache.setSelection(isShowNomenclaturalCode);
|
101
|
showNameCache.addSelectionListener(new SelectionAdapter(){
|
102
|
@Override
|
103
|
public void widgetSelected(SelectionEvent e) {
|
104
|
boolean isShowNameCache = showNameCache.getSelection();
|
105
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE, isShowNameCache);
|
106
|
}
|
107
|
});
|
108
|
final Button showAppendedPhrase = new Button(child, SWT.CHECK);
|
109
|
boolean isShowAppendedPhrase = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE);
|
110
|
showAppendedPhrase.setText("Show appended phrase");
|
111
|
showAppendedPhrase.setSelection(isShowAppendedPhrase);
|
112
|
showAppendedPhrase.addSelectionListener(new SelectionAdapter(){
|
113
|
@Override
|
114
|
public void widgetSelected(SelectionEvent e) {
|
115
|
boolean isShowAppendedPhrase = showAppendedPhrase.getSelection();
|
116
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE, isShowAppendedPhrase);
|
117
|
}
|
118
|
});
|
119
|
|
120
|
final Button showRank = new Button(child, SWT.CHECK);
|
121
|
boolean isShowRank = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK);
|
122
|
showRank.setText("Show rank of the name");
|
123
|
showRank.setSelection(isShowRank);
|
124
|
showRank.addSelectionListener(new SelectionAdapter(){
|
125
|
@Override
|
126
|
public void widgetSelected(SelectionEvent e) {
|
127
|
boolean isShowRank = showRank.getSelection();
|
128
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK, isShowRank);
|
129
|
}
|
130
|
});
|
131
|
final Button showEpithets = new Button(child, SWT.CHECK);
|
132
|
boolean isShowEpithets = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS);
|
133
|
showEpithets.setText("Show atomised epithets");
|
134
|
showEpithets.setSelection(isShowEpithets);
|
135
|
showEpithets.addSelectionListener(new SelectionAdapter(){
|
136
|
@Override
|
137
|
public void widgetSelected(SelectionEvent e) {
|
138
|
boolean isShowEpithets = showEpithets.getSelection();
|
139
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS, isShowEpithets);
|
140
|
}
|
141
|
});
|
142
|
final Button showAuthorship = new Button(child, SWT.CHECK);
|
143
|
boolean isShowAuthorship = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP);
|
144
|
showAuthorship.setText("Show authorship section");
|
145
|
showAuthorship.setSelection(isShowAuthorship);
|
146
|
showAuthorship.addSelectionListener(new SelectionAdapter(){
|
147
|
@Override
|
148
|
public void widgetSelected(SelectionEvent e) {
|
149
|
boolean isShowAuthorship = showAuthorship.getSelection();
|
150
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP, isShowAuthorship);
|
151
|
}
|
152
|
});
|
153
|
|
154
|
final Button showNomenclaturalRef = new Button(child, SWT.CHECK);
|
155
|
boolean isShowNomenclaturalRef = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE);
|
156
|
showNomenclaturalRef.setText("Show nomenclatural reference section");
|
157
|
showNomenclaturalRef.setSelection(isShowNomenclaturalRef);
|
158
|
showNomenclaturalRef.addSelectionListener(new SelectionAdapter(){
|
159
|
@Override
|
160
|
public void widgetSelected(SelectionEvent e) {
|
161
|
boolean isShowNomenclaturalRef = showNomenclaturalRef.getSelection();
|
162
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE, isShowNomenclaturalRef);
|
163
|
}
|
164
|
});
|
165
|
|
166
|
final Button showNomenclaturalStatus = new Button(child, SWT.CHECK);
|
167
|
boolean isShowNomenclaturalStatus = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS);
|
168
|
showNomenclaturalStatus.setText("Show nomenclatural status section");
|
169
|
showNomenclaturalStatus.setSelection(isShowNomenclaturalStatus);
|
170
|
showNomenclaturalStatus.addSelectionListener(new SelectionAdapter(){
|
171
|
@Override
|
172
|
public void widgetSelected(SelectionEvent e) {
|
173
|
boolean isShowNomenclaturalStatus = showNomenclaturalStatus.getSelection();
|
174
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS, isShowNomenclaturalStatus);
|
175
|
}
|
176
|
});
|
177
|
|
178
|
final Button showProtologue = new Button(child, SWT.CHECK);
|
179
|
boolean isShowProtologue = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE);
|
180
|
showProtologue.setText("Show protologue section");
|
181
|
showProtologue.setSelection(isShowProtologue);
|
182
|
showProtologue.addSelectionListener(new SelectionAdapter(){
|
183
|
@Override
|
184
|
public void widgetSelected(SelectionEvent e) {
|
185
|
boolean isShowProtologue = showProtologue.getSelection();
|
186
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE, isShowProtologue);
|
187
|
}
|
188
|
});
|
189
|
|
190
|
final Button showTypeDesignation = new Button(child, SWT.CHECK);
|
191
|
boolean isShowTypeDesignation = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION);
|
192
|
showTypeDesignation.setText("Show name type designation section");
|
193
|
showTypeDesignation.setSelection(isShowTypeDesignation);
|
194
|
showTypeDesignation.addSelectionListener(new SelectionAdapter(){
|
195
|
@Override
|
196
|
public void widgetSelected(SelectionEvent e) {
|
197
|
boolean isShowTypeDesignation = showTypeDesignation.getSelection();
|
198
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION, isShowTypeDesignation);
|
199
|
}
|
200
|
});
|
201
|
|
202
|
|
203
|
final Button showNameRelationship = new Button(child, SWT.CHECK);
|
204
|
boolean isShowNameRelationship = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP);
|
205
|
showNameRelationship.setText("Show name relationship section");
|
206
|
showNameRelationship.setSelection(isShowNameRelationship);
|
207
|
showNameRelationship.addSelectionListener(new SelectionAdapter(){
|
208
|
@Override
|
209
|
public void widgetSelected(SelectionEvent e) {
|
210
|
boolean isShowNameRelationship = showNameRelationship.getSelection();
|
211
|
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP, isShowNameRelationship);
|
212
|
}
|
213
|
});
|
214
|
|
215
|
if(isSimpleDetailsViewActivated){
|
216
|
child.setEnabled(true);
|
217
|
}else{
|
218
|
child.setEnabled(false);
|
219
|
}
|
220
|
|
221
|
return composite;
|
222
|
|
223
|
|
224
|
|
225
|
}
|
226
|
|
227
|
}
|