1 |
2c89337b
|
Katja Luther
|
/**
|
2 |
|
|
* Copyright (C) 2018 EDIT
|
3 |
|
|
* European Distributed Institute of Taxonomy
|
4 |
|
|
* http://www.e-taxonomy.eu
|
5 |
|
|
*
|
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.
|
8 |
|
|
*/
|
9 |
|
|
package eu.etaxonomy.taxeditor.databaseAdmin.preferencePage;
|
10 |
|
|
|
11 |
|
|
import org.eclipse.swt.SWT;
|
12 |
1844c796
|
Katja Luther
|
import org.eclipse.swt.custom.CLabel;
|
13 |
2c89337b
|
Katja Luther
|
import org.eclipse.swt.layout.GridLayout;
|
14 |
|
|
import org.eclipse.swt.widgets.Composite;
|
15 |
|
|
import org.eclipse.swt.widgets.Control;
|
16 |
|
|
|
17 |
|
|
import eu.etaxonomy.cdm.api.application.ICdmRepository;
|
18 |
|
|
import eu.etaxonomy.cdm.api.service.IPreferenceService;
|
19 |
|
|
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
|
20 |
|
|
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
|
21 |
|
|
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
|
22 |
1844c796
|
Katja Luther
|
import eu.etaxonomy.taxeditor.l10n.Messages;
|
23 |
2c89337b
|
Katja Luther
|
import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
|
24 |
|
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
25 |
|
|
|
26 |
|
|
/**
|
27 |
|
|
* @author k.luther
|
28 |
|
|
* @since 23.03.2018
|
29 |
|
|
*
|
30 |
|
|
*/
|
31 |
|
|
public class AbcdImportProvider extends CdmPreferencePage implements IE4AdminPreferencePage{
|
32 |
|
|
|
33 |
|
|
private Abcd206ImportConfigurator configurator;
|
34 |
|
|
|
35 |
|
|
ListComponent biocaseProviderList;
|
36 |
|
|
|
37 |
|
|
/**
|
38 |
|
|
* {@inheritDoc}
|
39 |
|
|
*/
|
40 |
|
|
@Override
|
41 |
|
|
protected Control createContents(Composite parent) {
|
42 |
|
|
final Composite composite = new Composite(parent, SWT.NULL);
|
43 |
1844c796
|
Katja Luther
|
final CLabel description = new CLabel(composite, SWT.NULL);
|
44 |
|
|
description.setText(Messages.AbcdImportProvider_description);
|
45 |
2c89337b
|
Katja Luther
|
GridLayout gridLayout = new GridLayout();
|
46 |
|
|
composite.setLayout(gridLayout);
|
47 |
|
|
|
48 |
|
|
gridLayout.numColumns = 3;
|
49 |
|
|
gridLayout.horizontalSpacing= 10;
|
50 |
|
|
gridLayout.makeColumnsEqualWidth = true;
|
51 |
|
|
|
52 |
|
|
|
53 |
|
|
composite.setLayout(gridLayout);
|
54 |
|
|
biocaseProviderList = new ListComponent(composite, SWT.SCROLL_LINE);
|
55 |
|
|
|
56 |
|
|
return composite;
|
57 |
|
|
}
|
58 |
|
|
|
59 |
|
|
public ListComponent getBiocaseProviderList() {
|
60 |
|
|
return biocaseProviderList;
|
61 |
|
|
}
|
62 |
|
|
|
63 |
|
|
|
64 |
|
|
@Override
|
65 |
|
|
public boolean performOk() {
|
66 |
|
|
String providerList = null;
|
67 |
59246837
|
Katja Luther
|
if (biocaseProviderList != null){
|
68 |
|
|
providerList = biocaseProviderList.createAllProviderString();
|
69 |
2c89337b
|
Katja Luther
|
|
70 |
59246837
|
Katja Luther
|
CdmPreference pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.BioCaseProvider, providerList);
|
71 |
|
|
pref.setAllowOverride(true);
|
72 |
|
|
|
73 |
|
|
ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration();
|
74 |
|
|
if (controller == null){
|
75 |
|
|
return false;
|
76 |
|
|
}
|
77 |
|
|
IPreferenceService service = controller.getPreferenceService();
|
78 |
|
|
service.set(pref);
|
79 |
2c89337b
|
Katja Luther
|
|
80 |
|
|
}
|
81 |
|
|
|
82 |
|
|
return true;
|
83 |
|
|
}
|
84 |
|
|
|
85 |
|
|
|
86 |
|
|
|
87 |
|
|
|
88 |
|
|
}
|