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
.IWizardPage
;
12 import org
.eclipse
.jface
.wizard
.Wizard
;
14 import eu
.etaxonomy
.cdm
.api
.application
.ICdmRepository
;
15 import eu
.etaxonomy
.cdm
.api
.service
.IPreferenceService
;
16 import eu
.etaxonomy
.cdm
.model
.metadata
.CdmPreference
;
17 import eu
.etaxonomy
.cdm
.model
.metadata
.PreferencePredicate
;
18 import eu
.etaxonomy
.taxeditor
.preference
.IPreferenceKeys
;
19 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
26 public class DatabasePreferencesWizard
extends Wizard
{
29 public DatabasePreferencesPage preferencePage
;
33 public DatabasePreferencesWizard() {
34 setWindowTitle("Database Preferences Wizard");
36 preferencePage
= new DatabasePreferencesPage("Database Preferences");
44 * @return the preferencePage
46 public DatabasePreferencesPage
getPreferencePage() {
47 return preferencePage
;
53 public boolean performFinish() {
55 // getPreferencePage().performOk();
56 String value
=getPreferencePage().doGetPreferenceStore().getString(IPreferenceKeys
.CDM_NOMENCLATURAL_CODE_KEY
);
58 boolean allowOverride
= getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys
.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY
);
59 CdmPreference pref
= CdmPreference
.NewDatabaseInstance( PreferencePredicate
.NomenclaturalCode
, value
);
60 pref
.setAllowOverride(allowOverride
);
62 ICdmRepository controller
= CdmStore
.getCurrentApplicationConfiguration();
63 if (controller
== null){
66 IPreferenceService service
= controller
.getPreferenceService();
69 value
= getPreferencePage().getNameDetailsConfig().createNameDetailsViewConfig().toString();
70 allowOverride
= getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys
.ALLOW_OVERRIDE_NAMEDETAILS
);
71 pref
= CdmPreference
.NewDatabaseInstance( PreferencePredicate
.NameDetailsView
, value
);
72 pref
.setAllowOverride(allowOverride
);
76 boolean isDeterminationOnlyForFieldUnit
= getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys
.DETERMINATION_ONLY_FOR_FIELD_UNITS
);
77 pref
= CdmPreference
.NewDatabaseInstance( PreferencePredicate
.DeterminationOnlyForFieldUnits
, String
.valueOf(isDeterminationOnlyForFieldUnit
));
78 pref
.setAllowOverride(false);
81 boolean isShowCollectingAreasInGeneralsecion
= getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys
.SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION
);
82 pref
= CdmPreference
.NewDatabaseInstance( PreferencePredicate
.ShowCollectingAreasInGeneralSection
, String
.valueOf(isShowCollectingAreasInGeneralsecion
));
83 pref
.setAllowOverride(false);
86 boolean isShowTaxonAssociations
= getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys
.SHOW_TAXON_ASSOCIATIONS
);
87 pref
= CdmPreference
.NewDatabaseInstance( PreferencePredicate
.ShowTaxonAssociations
, String
.valueOf(isShowTaxonAssociations
));
88 pref
.setAllowOverride(false);
91 String biocaseProviderList
= this.getPreferencePage().getBiocaseProviderList().createAllProviderString();
92 if (biocaseProviderList
== null){
93 getPreferencePage().doGetPreferenceStore().setValue(IPreferenceKeys
.BIOCASE_PROVIDER_LIST
,"");
95 getPreferencePage().doGetPreferenceStore().setValue(IPreferenceKeys
.BIOCASE_PROVIDER_LIST
, biocaseProviderList
);
98 pref
= CdmPreference
.NewDatabaseInstance( PreferencePredicate
.BioCaseProvider
, String
.valueOf(biocaseProviderList
));
99 pref
.setAllowOverride(false);
101 // getPreferencePage().createAbcdImportConfig();
102 // value = getPreferencePage().getAbcdImportConfig().toString();
103 // allowOverride = getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_ABCD_IMPORT_CONFIG);
104 // pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.AbcdImportConfig, value);
105 // pref.setAllowOverride(allowOverride);
106 // service.set(pref);
114 public void addPages() {
115 addPage(preferencePage
);
120 public IWizardPage
getNextPage(IWizardPage currentPage
) {