3 * Copyright (C) 2014 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.taxeditor
.preference
;
12 import org
.eclipse
.jface
.preference
.PreferencePage
;
13 import org
.eclipse
.swt
.SWT
;
14 import org
.eclipse
.swt
.custom
.CLabel
;
15 import org
.eclipse
.swt
.events
.SelectionAdapter
;
16 import org
.eclipse
.swt
.events
.SelectionEvent
;
17 import org
.eclipse
.swt
.layout
.GridLayout
;
18 import org
.eclipse
.swt
.widgets
.Button
;
19 import org
.eclipse
.swt
.widgets
.Composite
;
20 import org
.eclipse
.swt
.widgets
.Control
;
21 import org
.eclipse
.ui
.IWorkbench
;
22 import org
.eclipse
.ui
.IWorkbenchPreferencePage
;
24 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
25 import eu
.etaxonomy
.taxeditor
.ui
.element
.CommandHandlerButton
;
32 public class ChecklistEditorGeneralPreference
extends PreferencePage
implements IWorkbenchPreferencePage
{
34 boolean isEditorActivated
;
40 * org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors
44 protected Control
createContents(Composite parent
) {
46 Composite composite
= new Composite(parent
, SWT
.NULL
);
47 composite
.setLayout(new GridLayout());
48 isEditorActivated
= PreferencesUtil
.getPreferenceStore().getBoolean(IPreferenceKeys
.DISTRIBUTION_AREA_PREFRENCES_ACTIVE
);
49 final Button activateCheckButton
= new Button(composite
, SWT
.CHECK
);
50 activateCheckButton
.setText("Enable Checklist Editor");
51 activateCheckButton
.setSelection(isEditorActivated
);
52 activateCheckButton
.addSelectionListener(new SelectionAdapter(){
54 public void widgetSelected(SelectionEvent e
) {
55 isEditorActivated
= activateCheckButton
.getSelection();
56 PreferencesUtil
.getPreferenceStore().setValue(IPreferenceKeys
.DISTRIBUTION_AREA_PREFRENCES_ACTIVE
, isEditorActivated
);
57 if(isEditorActivated
){
58 child
.setVisible(true);
59 child
.setEnabled(true);
61 child
.setVisible(false);
62 child
.setEnabled(false);
68 child
= new Composite(composite
, SWT
.NULL
);
69 child
.setLayout(new GridLayout());
70 child
.setVisible(isEditorActivated
);
71 final CLabel label
= new CLabel(child
, SWT
.NULL
);
72 label
.setText("Please open the wizard below, in order to \n" + "choose the areas for the Checklist Editor");
73 final CommandHandlerButton button_openFeatureTree
= new CommandHandlerButton(child
, SWT
.PUSH
,
74 "eu.etaxonomy.taxeditor.store.open.OpenDistributionEditorWizardHandler");
76 button_openFeatureTree
.setText("Open Distribution Selection Wizard");
77 PreferencesUtil
.recursiveSetEnabled(button_openFeatureTree
, CdmStore
.isActive());
79 if(isEditorActivated
){
80 child
.setEnabled(true);
82 child
.setEnabled(false);
92 * org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
95 public void init(IWorkbench workbench
) {