Project

General

Profile

Download (3.13 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
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
import org.eclipse.swt.custom.CLabel;
13
import org.eclipse.swt.layout.GridData;
14
import org.eclipse.swt.widgets.Composite;
15
import org.eclipse.swt.widgets.Control;
16

    
17
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
18
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
19
import eu.etaxonomy.taxeditor.l10n.Messages;
20
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
21
import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
22
import eu.etaxonomy.taxeditor.ui.element.CommandHandlerButton;
23

    
24
/**
25
 * @author k.luther
26
 * @since 05.10.2018
27
 *
28
 */
29
public class VocabularyAdminPreferences extends CdmPreferencePage implements IE4AdminPreferencePage {
30

    
31
    boolean allowOverride;
32
    CdmPreference pref = null;
33

    
34
    @Override
35
    protected Control createContents(Composite parent) {
36
        this.isAdminPreference = true;
37
        Composite composite = createComposite(parent);
38
        //pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.CommonNameAreaVocabularies);
39

    
40

    
41
        final CLabel commonNameAreaLabel = new CLabel(composite, SWT.NULL);
42
        commonNameAreaLabel.setText(Messages.VokabularyAdminPreferences_SELECT_VOCABULARY_TEXT);
43

    
44
        GridData gridData = new GridData();
45
        gridData.horizontalSpan = 2;
46
        commonNameAreaLabel.setLayoutData(gridData);
47

    
48
        final CommandHandlerButton button_opencommonNameAreaWizard = new CommandHandlerButton(composite, SWT.PUSH,
49
                "eu.etaxonomy.taxeditor.store.open.OpenCommonNameAreaWizardAdminHandler"); //$NON-NLS-1$
50

    
51
        button_opencommonNameAreaWizard.setText(Messages.GeneralPreference_open_common_name_area_selection);
52
//        final Button allowOverrideCommonNameAreaCheckButton = createAllowOverrideButton(composite);
53
//
54
//        if (pref != null){
55
//            allowOverride = pref.isAllowOverride();
56
//            allowOverrideCommonNameAreaCheckButton.setSelection(allowOverride);
57
//        }
58
//        else{
59
//            allowOverrideCommonNameAreaCheckButton.setSelection(true);
60
//        }
61
//
62
//        allowOverrideCommonNameAreaCheckButton.addSelectionListener(new SelectionAdapter(){
63
//            @Override
64
//            public void widgetSelected(SelectionEvent e) {
65
//                setApply(true);
66
//                allowOverride = allowOverrideCommonNameAreaCheckButton.getSelection();
67
//
68
//            }
69
//        });
70

    
71
        return composite;
72
    }
73

    
74
    @Override
75
    public boolean performOk() {
76
        if (pref == null){
77
            return true;
78
        }
79
        PreferencesUtil.setPreferenceToDB(pref);
80
        PreferencesUtil.updateDBPreferences();
81

    
82
        return true;
83

    
84
    }
85

    
86
    @Override
87
    protected void performDefaults() {
88
        pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.CommonNameAreaVocabularies, null);
89
        pref.setAllowOverride(true);
90

    
91
        super.performDefaults();
92
    }
93
}
(13-13/13)