2 * Copyright (C) 2016 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
9 package eu
.etaxonomy
.taxeditor
.databaseAdmin
.wizard
;
11 import java
.util
.List
;
13 import org
.eclipse
.jface
.preference
.IPreferenceStore
;
14 import org
.eclipse
.jface
.wizard
.IWizard
;
15 import org
.eclipse
.jface
.wizard
.IWizardPage
;
16 import org
.eclipse
.jface
.wizard
.WizardPage
;
17 import org
.eclipse
.swt
.SWT
;
18 import org
.eclipse
.swt
.events
.SelectionAdapter
;
19 import org
.eclipse
.swt
.events
.SelectionEvent
;
20 import org
.eclipse
.swt
.layout
.GridData
;
21 import org
.eclipse
.swt
.layout
.GridLayout
;
22 import org
.eclipse
.swt
.widgets
.Button
;
23 import org
.eclipse
.swt
.widgets
.Combo
;
24 import org
.eclipse
.swt
.widgets
.Composite
;
25 import org
.eclipse
.swt
.widgets
.Label
;
26 import org
.eclipse
.swt
.widgets
.TabFolder
;
27 import org
.eclipse
.swt
.widgets
.TabItem
;
29 import eu
.etaxonomy
.cdm
.model
.metadata
.CdmPreference
;
30 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalCode
;
31 import eu
.etaxonomy
.taxeditor
.model
.NomenclaturalCodeHelper
;
32 import eu
.etaxonomy
.taxeditor
.preference
.IPreferenceKeys
;
33 import eu
.etaxonomy
.taxeditor
.preference
.NameDetailsConfigurator
;
34 import eu
.etaxonomy
.taxeditor
.preference
.PreferencesUtil
;
41 public class DatabasePreferencesPage
extends WizardPage
implements IWizardPage
{
45 CdmPreference preferedNomenclaturalCode
;
46 NameDetailsConfigurator config
;
48 // private int maxNumOfColumns;
49 IPreferenceStore preferenceStore
;
51 boolean isSimpleDetailsViewActivated
;
54 private Combo nomenclaturalCodeCombo
;
56 private Label nomenclaturalCodeLabel
;
58 String
[][] labelAndValues
;
63 public DatabasePreferencesPage(String pageName
) {
65 this.preferedNomenclaturalCode
= PreferencesUtil
.setPreferredNomenclaturalCode(null, false);
66 this.config
= PreferencesUtil
.setPreferredNameDetailsConfiguration( false);
67 setPreferenceStore(PreferencesUtil
.getPreferenceStore());
71 protected void setPreferenceStore(IPreferenceStore store
){
72 this.preferenceStore
= store
;
76 // protected void createFieldEditors() {
77 // setMessage("Choose the preferences for the whole cdm store.");
78 // tabFolder = new TabFolder(getFieldEditorParent(), SWT.NONE);
80 // createNomenclaturalCodeTab();
81 // createNameDetailsConfiguration();
90 // * Adjust the layout of the field editors so that they are properly aligned.
93 // protected void adjustGridLayout() {
94 // if (tabFolder != null){
95 // TabItem[] items = tabFolder.getItems();
96 // for (int j = 0; j < items.length; j++){
97 // GridLayout layout = ((GridLayout) ((Composite) items[j].getControl()).getLayout());
98 // layout.numColumns = this.maxNumOfColumns;
99 // layout.marginHeight = 5;
100 // layout.marginWidth = 5;
103 // // need to call super.adjustGridLayout() since fieldEditor.adjustForNumColumns() is protected
104 // super.adjustGridLayout();
106 // // reset the main container to a single column
107 // ((GridLayout) super.getFieldEditorParent().getLayout()).numColumns = 1;
111 // * Returns a parent composite for a field editor.
113 // * This value must not be cached since a new parent may be created each time this method called. Thus this method
114 // * must be called each time a field editor is constructed.
116 // * @return a parent
119 // protected Composite getEditorParent(){
120 // if (tabFolder == null || tabFolder.getItemCount() == 0){
121 // return super.getWizard();
123 // return (Composite) tabFolder.getItem(tabFolder.getItemCount() - 1).getControl();
127 * Adds a tab to the page.
128 * @param text the tab label
130 public Composite
addTab(String text
) {
131 if (tabFolder
== null){
132 // initialize tab folder
133 if (composite
== null) {
134 composite
= new Composite(getShell(), SWT
.NONE
);
136 tabFolder
= new TabFolder(composite
, SWT
.NONE
);
137 tabFolder
.setLayoutData(new GridData(GridData
.FILL_BOTH
));
140 TabItem item
= new TabItem(tabFolder
, SWT
.NONE
);
143 Composite currentTab
= new Composite(tabFolder
, SWT
.NULL
);
144 GridLayout layout
= new GridLayout();
145 currentTab
.setLayout(layout
);
146 currentTab
.setFont(composite
.getFont());
147 currentTab
.setLayoutData(new GridData(GridData
.FILL_HORIZONTAL
));
149 item
.setControl(currentTab
);
156 private void createNameDetailsConfiguration(Composite parent
) {
157 if (composite
== null){
160 composite
= addTab("Name Details View Configuration");
161 // TabItem tbtmNameDetailsConfiguration = new TabItem(tabFolder, SWT.NONE);
162 // Composite c2 = new Composite(tabFolder, SWT.BORDER);
163 // c2.setLayout(new GridLayout(1, true));
164 // tbtmNameDetailsConfiguration.setControl(c2);
165 // composite.setLayout(new GridLayout(1, true));
166 config
= new NameDetailsConfigurator(true);
168 // Composite composite = new Composite(parent, SWT.NULL);
169 composite
.setLayout(new GridLayout());
171 isSimpleDetailsViewActivated
= PreferencesUtil
.getPreferenceStore().getBoolean(IPreferenceKeys
.SHOW_SIMPLE_NAME_DETAILS_SECTION
);
172 final Button activateCheckButton
= new Button(composite
, SWT
.CHECK
);
173 activateCheckButton
.setText("Show only a simple name details view");
174 activateCheckButton
.setSelection(isSimpleDetailsViewActivated
);
175 activateCheckButton
.addSelectionListener(new SelectionAdapter(){
177 public void widgetSelected(SelectionEvent e
) {
178 isSimpleDetailsViewActivated
= activateCheckButton
.getSelection();
179 PreferencesUtil
.getPreferenceStore().setValue(IPreferenceKeys
.SHOW_SIMPLE_NAME_DETAILS_SECTION
, isSimpleDetailsViewActivated
);
180 if(isSimpleDetailsViewActivated
){
181 child
.setVisible(true);
182 child
.setEnabled(true);
184 child
.setVisible(false);
185 child
.setEnabled(false);
190 child
= new Composite(composite
, SWT
.NULL
);
191 child
.setLayout(new GridLayout());
192 child
.setVisible(isSimpleDetailsViewActivated
);
194 final Button showTaxon
= new Button(child
, SWT
.CHECK
);
195 boolean isShowTaxon
= PreferencesUtil
.getPreferenceStore().getBoolean(IPreferenceKeys
.SHOW_SIMPLE_NAME_DETAILS_TAXON
);
196 showTaxon
.setText("Show taxon of the name");
197 showTaxon
.setSelection(isShowTaxon
);
198 showTaxon
.addSelectionListener(new SelectionAdapter(){
200 public void widgetSelected(SelectionEvent e
) {
201 boolean isShowTaxon
= showTaxon
.getSelection();
202 PreferencesUtil
.getPreferenceStore().setValue(IPreferenceKeys
.SHOW_SIMPLE_NAME_DETAILS_TAXON
, isShowTaxon
);
206 final Button showLsid
= new Button(child
, SWT
.CHECK
);
207 boolean isShowLSID
= PreferencesUtil
.getPreferenceStore().getBoolean(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_LSID
);
208 showLsid
.setText("Show Lsid of the name");
209 showLsid
.setSelection(isShowLSID
);
210 showLsid
.addSelectionListener(new SelectionAdapter(){
212 public void widgetSelected(SelectionEvent e
) {
213 boolean isShowLSID
= showLsid
.getSelection();
214 PreferencesUtil
.getPreferenceStore().setValue(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_LSID
, isShowLSID
);
218 final Button showNomenclaturalCode
= new Button(child
, SWT
.CHECK
);
219 boolean isShowNomenclaturalCode
= PreferencesUtil
.getPreferenceStore().getBoolean(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE
);
220 showNomenclaturalCode
.setText("Show the nomenclatural code");
221 showNomenclaturalCode
.setSelection(isShowNomenclaturalCode
);
222 showNomenclaturalCode
.addSelectionListener(new SelectionAdapter(){
224 public void widgetSelected(SelectionEvent e
) {
225 boolean isShowNomenclaturalCode
= showNomenclaturalCode
.getSelection();
226 PreferencesUtil
.getPreferenceStore().setValue(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE
, isShowNomenclaturalCode
);
230 final Button showNameCache
= new Button(child
, SWT
.CHECK
);
231 boolean isShowNameCache
= PreferencesUtil
.getPreferenceStore().getBoolean(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_NAMECACHE
);
232 showNameCache
.setText("Show nameCache of the name (only the scientific name without the author and year)");
233 showNameCache
.setSelection(isShowNomenclaturalCode
);
234 showNameCache
.addSelectionListener(new SelectionAdapter(){
236 public void widgetSelected(SelectionEvent e
) {
237 boolean isShowNameCache
= showNameCache
.getSelection();
238 PreferencesUtil
.getPreferenceStore().setValue(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_NAMECACHE
, isShowNameCache
);
241 final Button showAppendedPhrase
= new Button(child
, SWT
.CHECK
);
242 boolean isShowAppendedPhrase
= PreferencesUtil
.getPreferenceStore().getBoolean(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE
);
243 showAppendedPhrase
.setText("Show appended phrase");
244 showAppendedPhrase
.setSelection(isShowAppendedPhrase
);
245 showAppendedPhrase
.addSelectionListener(new SelectionAdapter(){
247 public void widgetSelected(SelectionEvent e
) {
248 boolean isShowAppendedPhrase
= showAppendedPhrase
.getSelection();
249 PreferencesUtil
.getPreferenceStore().setValue(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE
, isShowAppendedPhrase
);
253 final Button showRank
= new Button(child
, SWT
.CHECK
);
254 boolean isShowRank
= PreferencesUtil
.getPreferenceStore().getBoolean(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_RANK
);
255 showRank
.setText("Show rank of the name");
256 showRank
.setSelection(isShowRank
);
257 showRank
.addSelectionListener(new SelectionAdapter(){
259 public void widgetSelected(SelectionEvent e
) {
260 boolean isShowRank
= showRank
.getSelection();
261 PreferencesUtil
.getPreferenceStore().setValue(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_RANK
, isShowRank
);
264 final Button showEpithets
= new Button(child
, SWT
.CHECK
);
265 boolean isShowEpithets
= PreferencesUtil
.getPreferenceStore().getBoolean(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS
);
266 showEpithets
.setText("Show atomised epithets");
267 showEpithets
.setSelection(isShowEpithets
);
268 showEpithets
.addSelectionListener(new SelectionAdapter(){
270 public void widgetSelected(SelectionEvent e
) {
271 boolean isShowEpithets
= showEpithets
.getSelection();
272 PreferencesUtil
.getPreferenceStore().setValue(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS
, isShowEpithets
);
275 final Button showAuthorship
= new Button(child
, SWT
.CHECK
);
276 boolean isShowAuthorship
= PreferencesUtil
.getPreferenceStore().getBoolean(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP
);
277 showAuthorship
.setText("Show authorship section");
278 showAuthorship
.setSelection(isShowAuthorship
);
279 showAuthorship
.addSelectionListener(new SelectionAdapter(){
281 public void widgetSelected(SelectionEvent e
) {
282 boolean isShowAuthorship
= showAuthorship
.getSelection();
283 PreferencesUtil
.getPreferenceStore().setValue(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP
, isShowAuthorship
);
287 final Button showNomenclaturalRef
= new Button(child
, SWT
.CHECK
);
288 boolean isShowNomenclaturalRef
= PreferencesUtil
.getPreferenceStore().getBoolean(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE
);
289 showNomenclaturalRef
.setText("Show nomenclatural reference section");
290 showNomenclaturalRef
.setSelection(isShowNomenclaturalRef
);
291 showNomenclaturalRef
.addSelectionListener(new SelectionAdapter(){
293 public void widgetSelected(SelectionEvent e
) {
294 boolean isShowNomenclaturalRef
= showNomenclaturalRef
.getSelection();
295 PreferencesUtil
.getPreferenceStore().setValue(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE
, isShowNomenclaturalRef
);
299 final Button showNomenclaturalStatus
= new Button(child
, SWT
.CHECK
);
300 boolean isShowNomenclaturalStatus
= PreferencesUtil
.getPreferenceStore().getBoolean(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS
);
301 showNomenclaturalStatus
.setText("Show nomenclatural status section");
302 showNomenclaturalStatus
.setSelection(isShowNomenclaturalStatus
);
303 showNomenclaturalStatus
.addSelectionListener(new SelectionAdapter(){
305 public void widgetSelected(SelectionEvent e
) {
306 boolean isShowNomenclaturalStatus
= showNomenclaturalStatus
.getSelection();
307 PreferencesUtil
.getPreferenceStore().setValue(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS
, isShowNomenclaturalStatus
);
311 final Button showProtologue
= new Button(child
, SWT
.CHECK
);
312 boolean isShowProtologue
= PreferencesUtil
.getPreferenceStore().getBoolean(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE
);
313 showProtologue
.setText("Show protologue section");
314 showProtologue
.setSelection(isShowProtologue
);
315 showProtologue
.addSelectionListener(new SelectionAdapter(){
317 public void widgetSelected(SelectionEvent e
) {
318 boolean isShowProtologue
= showProtologue
.getSelection();
319 PreferencesUtil
.getPreferenceStore().setValue(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE
, isShowProtologue
);
323 final Button showTypeDesignation
= new Button(child
, SWT
.CHECK
);
324 boolean isShowTypeDesignation
= PreferencesUtil
.getPreferenceStore().getBoolean(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION
);
325 showTypeDesignation
.setText("Show name type designation section");
326 showTypeDesignation
.setSelection(isShowTypeDesignation
);
327 showTypeDesignation
.addSelectionListener(new SelectionAdapter(){
329 public void widgetSelected(SelectionEvent e
) {
330 boolean isShowTypeDesignation
= showTypeDesignation
.getSelection();
331 PreferencesUtil
.getPreferenceStore().setValue(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION
, isShowTypeDesignation
);
336 final Button showNameRelationship
= new Button(child
, SWT
.CHECK
);
337 boolean isShowNameRelationship
= PreferencesUtil
.getPreferenceStore().getBoolean(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP
);
338 showNameRelationship
.setText("Show name relationship section");
339 showNameRelationship
.setSelection(isShowNameRelationship
);
340 showNameRelationship
.addSelectionListener(new SelectionAdapter(){
342 public void widgetSelected(SelectionEvent e
) {
343 boolean isShowNameRelationship
= showNameRelationship
.getSelection();
344 PreferencesUtil
.getPreferenceStore().setValue(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP
, isShowNameRelationship
);
348 if(isSimpleDetailsViewActivated
){
349 child
.setEnabled(true);
351 child
.setEnabled(false);
356 // Label emptyLabel = new Label(getFieldEditorParent(), 0);
358 // addField(new BooleanFieldEditor(
359 // IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION, "show simple (configurable) details", getFieldEditorParent()));
360 // addField(new SpacerFieldEditor(getFieldEditorParent()));
362 // addField(new BooleanFieldEditor(
363 // IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON,
364 // "show taxon section",
365 // getFieldEditorParent()));
367 // addField(new BooleanFieldEditor(
368 // IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_CACHE,
369 // "show name cache",
370 // getFieldEditorParent()));
372 // addField(new BooleanFieldEditor(
373 // IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID,
374 // "show LSID of the name",
375 // getFieldEditorParent()));
378 // addField(new BooleanFieldEditor(
379 // IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE,
380 // "show nomenclatural code of the name",
381 // getFieldEditorParent()));
384 // addField(new BooleanFieldEditor(
385 // IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE,
386 // "show appended phrase",
387 // getFieldEditorParent()));
390 // addField(new BooleanFieldEditor(
391 // IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK,
392 // "show rank of the name",
393 // getFieldEditorParent()));
396 // addField(new BooleanFieldEditor(
397 // IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS,
398 // "show atomised epithets of the name",
399 // getFieldEditorParent()));
401 // addField(new BooleanFieldEditor(
402 // IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP,
403 // "show authorship section",
404 // getFieldEditorParent()));
407 // addField(new BooleanFieldEditor(
408 // IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE,
409 // "show nomenclatural reference section",
410 // getFieldEditorParent()));
413 // addField( new BooleanFieldEditor(
414 // IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS,
415 // "show nomenclatural status section",
416 // getFieldEditorParent()));
419 // addField(new BooleanFieldEditor(
420 // IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE,
421 // "show protologue section",
422 // getFieldEditorParent()));
425 // addField(new BooleanFieldEditor(
426 // IPreferenceKeys.ALLOW_OVERRIDE_NAMEDETAILS,
427 // "allow to use local preference",
428 // getFieldEditorParent()));
435 protected IPreferenceStore
doGetPreferenceStore() {
436 return PreferencesUtil
.getPreferenceStore();
442 private String
[][] getLabelAndValues() {
443 List
<NomenclaturalCode
> supportedCodes
= NomenclaturalCodeHelper
444 .getSupportedCodes();
445 labelAndValues
= new String
[supportedCodes
.size()][2];
446 for (int i
= 0; i
< supportedCodes
.size(); i
++) {
447 labelAndValues
[i
][0] = NomenclaturalCodeHelper
448 .getDescription(supportedCodes
.get(i
));
449 labelAndValues
[i
][1] = PreferencesUtil
450 .getPreferenceKey(supportedCodes
.get(i
));
452 return labelAndValues
;
455 // public boolean performOk() {
456 // if (doGetPreferenceStore()== null){
457 // setPreferenceStore(PreferencesUtil.getPreferenceStore());
461 // String value =doGetPreferenceStore().getString(IPreferenceKeys.CDM_NOMENCLATURAL_CODE_KEY);
462 // boolean allowOverride = doGetPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY);
463 // CdmPreference pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.NomenclaturalCode, value);
464 // pref.setAllowOverride(allowOverride);
465 // ICdmApplicationConfiguration controller = CdmStore.getCurrentApplicationConfiguration();
466 // if (controller == null){
469 // IPreferenceService service = controller.getPreferenceService();
470 // service.set(pref);
471 // createNameDetailsViewConfig();
472 // value =config.toString();
473 // allowOverride = doGetPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NAMEDETAILS);
474 // pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.NameDetailsView, value);
475 // pref.setAllowOverride(allowOverride);
476 // service.set(pref);
484 void createNameDetailsViewConfig() {
485 config
.setSimpleDetailsViewActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys
.SHOW_SIMPLE_NAME_DETAILS_SECTION
));
486 config
.setAppendedPhraseActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE
));
487 config
.setAtomisedEpithetsActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS
));
488 config
.setAuthorshipSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP
));
489 config
.setLSIDActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_LSID
));
490 config
.setNameCacheActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_CACHE
));
491 config
.setNameRelationsSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP
));
492 config
.setNomenclaturalCodeActived(doGetPreferenceStore().getBoolean(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE
));
493 config
.setNomenclaturalStatusSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS
));
494 config
.setNomenclaturalReferenceSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE
));
495 config
.setProtologueActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE
));
496 config
.setRankActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_RANK
));
497 config
.setSimpleDetailsViewActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys
.SHOW_SIMPLE_NAME_DETAILS_SECTION
));
498 config
.setTaxonSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys
.SHOW_SIMPLE_NAME_DETAILS_TAXON
));
499 config
.setTypeDesignationSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys
.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION
));
502 public void createNomenclaturalCodeTab(Composite parent
){
503 composite
= addTab("Nomenclatural Code");
504 nomenclaturalCodeCombo
= new Combo(composite
, SWT
.READ_ONLY
);
505 List
<NomenclaturalCode
> supportedCodes
= NomenclaturalCodeHelper
506 .getSupportedCodes();
507 for (NomenclaturalCode code
: supportedCodes
) {
508 nomenclaturalCodeCombo
.add(NomenclaturalCodeHelper
509 .getDescription(code
));
513 nomenclaturalCodeCombo
.addSelectionListener(new SelectionAdapter() {
515 public void widgetSelected(SelectionEvent evt
) {
517 String name
= nomenclaturalCodeCombo
.getText();
518 String selectedPreferenceKey
= null;
519 for (String
[] labelAndValue
: labelAndValues
){
520 if (labelAndValue
[0].equals(name
)){
521 selectedPreferenceKey
= labelAndValue
[1];
526 PreferencesUtil
.getPreferenceStore().setValue(IPreferenceKeys
.CDM_NOMENCLATURAL_CODE_KEY
, selectedPreferenceKey
);
530 nomenclaturalCodeLabel
= new Label(composite
, SWT
.READ_ONLY
);
533 final Button useLocalPreference
= new Button(composite
, SWT
.CHECK
);
534 boolean isUseLocalPreference
= PreferencesUtil
.getPreferenceStore().getBoolean(IPreferenceKeys
.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY
);
535 useLocalPreference
.setText("allow to use local preference");
536 useLocalPreference
.setSelection(isUseLocalPreference
);
537 useLocalPreference
.addSelectionListener(new SelectionAdapter(){
539 public void widgetSelected(SelectionEvent e
) {
540 boolean isUseLocalPreference
= useLocalPreference
.getSelection();
541 PreferencesUtil
.getPreferenceStore().setValue(IPreferenceKeys
.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY
, isUseLocalPreference
);
546 // Label emptyLabel = new Label(getFieldEditorParent(), 0);
548 // addField(new ComboFieldEditor(
549 // IPreferenceKeys.CDM_NOMENCLATURAL_CODE_KEY,
550 // "Choose which nomenclatural code you would like to use for scientific names unless otherwise specified.", getLabelAndValues(),
551 // getFieldEditorParent()));
554 // addField(new BooleanFieldEditor(
555 // IPreferenceKeys.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY,
556 // "allow to use local preference",
557 // getFieldEditorParent()));
558 // adjustGridLayout();
568 public boolean canFlipToNextPage() {
569 // TODO Auto-generated method stub
579 public String
getName() {
580 // TODO Auto-generated method stub
590 public IWizardPage
getNextPage() {
591 // TODO Auto-generated method stub
601 public IWizardPage
getPreviousPage() {
602 // TODO Auto-generated method stub
612 public IWizard
getWizard() {
613 // TODO Auto-generated method stub
623 public boolean isPageComplete() {
634 public void setPreviousPage(IWizardPage page
) {
635 // TODO Auto-generated method stub
645 public void setWizard(IWizard newWizard
) {
646 // TODO Auto-generated method stub
654 public void createControl(Composite parent
) {
655 createNameDetailsConfiguration(parent
);
656 createNomenclaturalCodeTab(parent
);
663 public NameDetailsConfigurator
getConfig() {