1 package eu
.etaxonomy
.taxeditor
.preference
;
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
;
12 import org
.eclipse
.ui
.IWorkbench
;
13 import org
.eclipse
.ui
.IWorkbenchPreferencePage
;
14 import org
.eclipse
.jface
.preference
.PreferencePage
;
17 public class NameDetailsViewConfiguration
extends PreferencePage
implements IWorkbenchPreferencePage
{
18 boolean isSimpleDetailsViewActivated
;
21 public void init(IWorkbench workbench
) {
29 * org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors
33 protected Control
createContents(Composite parent
) {
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(){
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);
50 child
.setVisible(false);
51 child
.setEnabled(false);
56 child
= new Composite(composite
, SWT
.NULL
);
57 child
.setLayout(new GridLayout());
58 child
.setVisible(isSimpleDetailsViewActivated
);
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(){
66 public void widgetSelected(SelectionEvent e
) {
67 boolean isShowTaxon
= showTaxon
.getSelection();
68 PreferencesUtil
.getPreferenceStore().setValue(IPreferenceKeys
.SHOW_SIMPLE_NAME_DETAILS_TAXON
, isShowTaxon
);
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(){
78 public void widgetSelected(SelectionEvent e
) {
79 boolean isShowLSID
= showLsid
.getSelection();
80 PreferencesUtil
.getPreferenceStore().setValue(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_LSID
, isShowLSID
);
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(){
90 public void widgetSelected(SelectionEvent e
) {
91 boolean isShowNomenclaturalCode
= showNomenclaturalCode
.getSelection();
92 PreferencesUtil
.getPreferenceStore().setValue(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE
, isShowNomenclaturalCode
);
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(){
102 public void widgetSelected(SelectionEvent e
) {
103 boolean isShowNameCache
= showNameCache
.getSelection();
104 PreferencesUtil
.getPreferenceStore().setValue(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_NAMECACHE
, isShowNameCache
);
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(){
113 public void widgetSelected(SelectionEvent e
) {
114 boolean isShowAppendedPhrase
= showAppendedPhrase
.getSelection();
115 PreferencesUtil
.getPreferenceStore().setValue(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_NAMECACHE
, isShowAppendedPhrase
);
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(){
125 public void widgetSelected(SelectionEvent e
) {
126 boolean isShowRank
= showRank
.getSelection();
127 PreferencesUtil
.getPreferenceStore().setValue(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_RANK
, isShowRank
);
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(){
136 public void widgetSelected(SelectionEvent e
) {
137 boolean isShowEpithets
= showEpithets
.getSelection();
138 PreferencesUtil
.getPreferenceStore().setValue(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS
, isShowEpithets
);
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(){
147 public void widgetSelected(SelectionEvent e
) {
148 boolean isShowAuthorship
= showAuthorship
.getSelection();
149 PreferencesUtil
.getPreferenceStore().setValue(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP
, isShowAuthorship
);
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(){
159 public void widgetSelected(SelectionEvent e
) {
160 boolean isShowNomenclaturalRef
= showNomenclaturalRef
.getSelection();
161 PreferencesUtil
.getPreferenceStore().setValue(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE
, isShowNomenclaturalRef
);
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(){
171 public void widgetSelected(SelectionEvent e
) {
172 boolean isShowNomenclaturalStatus
= showNomenclaturalStatus
.getSelection();
173 PreferencesUtil
.getPreferenceStore().setValue(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS
, isShowNomenclaturalStatus
);
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(){
183 public void widgetSelected(SelectionEvent e
) {
184 boolean isShowProtologue
= showProtologue
.getSelection();
185 PreferencesUtil
.getPreferenceStore().setValue(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE
, isShowProtologue
);
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(){
195 public void widgetSelected(SelectionEvent e
) {
196 boolean isShowTypeDesignation
= showTypeDesignation
.getSelection();
197 PreferencesUtil
.getPreferenceStore().setValue(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION
, isShowTypeDesignation
);
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(){
208 public void widgetSelected(SelectionEvent e
) {
209 boolean isShowNameRelationship
= showNameRelationship
.getSelection();
210 PreferencesUtil
.getPreferenceStore().setValue(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION
, isShowNameRelationship
);
214 if(isSimpleDetailsViewActivated
){
215 child
.setEnabled(true);
217 child
.setEnabled(false);