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 org
.eclipse
.jface
.wizard
.Wizard
;
13 import eu
.etaxonomy
.cdm
.api
.application
.ICdmApplicationConfiguration
;
14 import eu
.etaxonomy
.cdm
.api
.service
.IPreferenceService
;
15 import eu
.etaxonomy
.cdm
.model
.metadata
.CdmPreference
;
16 import eu
.etaxonomy
.cdm
.model
.metadata
.PreferencePredicate
;
17 import eu
.etaxonomy
.taxeditor
.preference
.IPreferenceKeys
;
18 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
25 public class DatabasePreferencesWizard
extends Wizard
{
28 private final DatabasePreferencesPage preferencePage
;
31 public DatabasePreferencesWizard() {
32 setWindowTitle("Database Preferences Wizard");
34 preferencePage
= new DatabasePreferencesPage("Nomenclatural Code");
35 // preferencePage.setDescription("Choose which nomenclatural code you would like to use for scientific names unless otherwise specified.");
36 // preferencePage.init(PlatformUI.getWorkbench());
45 public boolean performFinish() {
47 // getPreferencePage().performOk();
48 String value
=getPreferencePage().doGetPreferenceStore().getString(IPreferenceKeys
.CDM_NOMENCLATURAL_CODE_KEY
);
50 boolean allowOverride
= getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys
.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY
);
51 CdmPreference pref
= CdmPreference
.NewDatabaseInstance( PreferencePredicate
.NomenclaturalCode
, value
);
52 pref
.setAllowOverride(allowOverride
);
54 ICdmApplicationConfiguration controller
= CdmStore
.getCurrentApplicationConfiguration();
55 if (controller
== null){
58 IPreferenceService service
= controller
.getPreferenceService();
61 getPreferencePage().createNameDetailsViewConfig();
62 value
= getPreferencePage().getConfig().toString();
63 allowOverride
= getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys
.ALLOW_OVERRIDE_NAMEDETAILS
);
64 pref
= CdmPreference
.NewDatabaseInstance( PreferencePredicate
.NameDetailsView
, value
);
65 pref
.setAllowOverride(allowOverride
);
72 * @return the preferencePage
74 public DatabasePreferencesPage
getPreferencePage() {
75 return preferencePage
;
79 public void addPages() {
80 addPage(preferencePage
);