2 * Copyright (C) 2018 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
.preferencePage
;
11 import org
.apache
.commons
.lang
.StringUtils
;
12 import org
.eclipse
.swt
.SWT
;
13 import org
.eclipse
.swt
.custom
.CLabel
;
14 import org
.eclipse
.swt
.layout
.GridLayout
;
15 import org
.eclipse
.swt
.widgets
.Composite
;
16 import org
.eclipse
.swt
.widgets
.Control
;
18 import eu
.etaxonomy
.cdm
.api
.application
.ICdmRepository
;
19 import eu
.etaxonomy
.cdm
.api
.service
.IPreferenceService
;
20 import eu
.etaxonomy
.cdm
.model
.metadata
.CdmPreference
;
21 import eu
.etaxonomy
.cdm
.model
.metadata
.PreferencePredicate
;
22 import eu
.etaxonomy
.taxeditor
.l10n
.Messages
;
23 import eu
.etaxonomy
.taxeditor
.preference
.AbcdImportProvider
;
24 import eu
.etaxonomy
.taxeditor
.preference
.ListComponent
;
25 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
32 public class AbcdImportProviderAdminPreferencePage
extends AbcdImportProvider
implements IE4AdminPreferencePage
{
37 protected Control
createContents(Composite parent
) {
38 final Composite composite
= new Composite(parent
, SWT
.NULL
);
39 final CLabel description
= new CLabel(composite
, SWT
.NULL
);
40 description
.setText(Messages
.AbcdImportProvider_description
);
41 GridLayout gridLayout
= new GridLayout();
42 composite
.setLayout(gridLayout
);
44 gridLayout
.numColumns
= 3;
45 //gridLayout.horizontalSpacing= 5;
46 //gridLayout.makeColumnsEqualWidth = true;
48 composite
.setLayout(gridLayout
);
49 biocaseProviderList
= new ListComponent(composite
, SWT
.SCROLL_LINE
,true, this);
55 public boolean performOk() {
56 String providerList
= null;
57 if (biocaseProviderList
!= null){
58 providerList
= biocaseProviderList
.createAllProviderString();
60 CdmPreference pref
= CdmPreference
.NewTaxEditorInstance(PreferencePredicate
.BioCaseProvider
, providerList
);
61 pref
.setAllowOverride(true);
63 ICdmRepository controller
= CdmStore
.getCurrentApplicationConfiguration();
64 if (controller
== null){
67 IPreferenceService service
= controller
.getPreferenceService();
68 if (StringUtils
.isBlank(providerList
)){
69 service
.remove(pref
.getKey());