Project

General

Profile

Download (1.87 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2017 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.wizard;
10

    
11
import org.eclipse.jface.wizard.Wizard;
12

    
13
import eu.etaxonomy.cdm.api.application.ICdmRepository;
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.io.wizard.AbcdImportConfiguratorWizardPage;
18
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
19
import eu.etaxonomy.taxeditor.store.CdmStore;
20

    
21
/**
22
 * @author k.luther
23
 * @date 19.04.2017
24
 *
25
 */
26
public class ImportPreferencesWizard extends Wizard {
27

    
28
    public AbcdImportConfiguratorWizardPage configPage;
29

    
30
    public ImportPreferencesWizard() {
31
        setWindowTitle("Abcd Import Configuration Wizard");
32

    
33
        configPage = AbcdImportConfiguratorWizardPage.createPreferencePage(PreferencesUtil.getAbcdImportConfigurationPreference());
34

    
35
    }
36
    @Override
37
    public void addPages() {
38
        addPage(configPage);
39
    }
40
    /**
41
     * {@inheritDoc}
42
     */
43
    @Override
44
    public boolean performFinish() {
45
        String configString = "";
46
        this.configPage.saveConfigToPrefernceStore();
47
        configString = this.configPage.createConfigString();
48

    
49
        CdmPreference pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.AbcdImportConfig, configString);
50
        pref.setAllowOverride(true);
51

    
52
        ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration();
53
        if (controller == null){
54
            return false;
55
        }
56
        IPreferenceService service = controller.getPreferenceService();
57
        service.set(pref);
58

    
59

    
60
       return true;
61
    }
62

    
63

    
64

    
65
}
(7-7/11)