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