2 * Copyright (C) 2007 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.
10 package eu
.etaxonomy
.taxeditor
.preference
;
12 import org
.eclipse
.jface
.preference
.PreferencePage
;
13 import org
.eclipse
.swt
.SWT
;
14 import org
.eclipse
.swt
.events
.SelectionAdapter
;
15 import org
.eclipse
.swt
.events
.SelectionEvent
;
16 import org
.eclipse
.swt
.layout
.GridLayout
;
17 import org
.eclipse
.swt
.widgets
.Button
;
18 import org
.eclipse
.swt
.widgets
.Composite
;
19 import org
.eclipse
.swt
.widgets
.Control
;
20 import org
.eclipse
.ui
.IWorkbench
;
21 import org
.eclipse
.ui
.IWorkbenchPreferencePage
;
23 import eu
.etaxonomy
.taxeditor
.model
.Resources
;
30 public class InitializeDbPreferences
extends PreferencePage
implements
31 IWorkbenchPreferencePage
{
33 public static final String PLUGIN_ID
= "eu.etaxonomy.taxeditor.preferences.initdb";
35 private Button btnInit
;
36 // private Button btnTestData;
38 public InitializeDbPreferences() {
40 setDescription("If you choose this option, taxonomic tree will be empty next time the Editor is started.");
44 * Create contents of the preference page
48 public Control
createContents(Composite parent
) {
50 Composite container
= new Composite(parent
, SWT
.NULL
);
51 container
.setLayout(new GridLayout());
53 btnInit
= new Button(container
, SWT
.CHECK
);
54 btnInit
.setText("Initialize datastore on next application start");
55 btnInit
.addSelectionListener(new SelectionAdapter() {
58 public void widgetSelected(SelectionEvent e
) {
59 if (btnInit
.getSelection() == true) {
61 // Enable test data option
62 // btnTestData.setEnabled(true);
66 // Disable test data option, set selected to "false"
67 // btnTestData.setEnabled(false);
68 // btnTestData.setSelection(false);
74 // btnTestData = new Button(container, SWT.CHECK);
75 // btnTestData.setEnabled(false);
76 // final GridData gridData = new GridData();
77 // gridData.horizontalIndent = 20;
78 // btnTestData.setLayoutData(gridData);
79 // btnTestData.setText("Initialize with Palmweb test data");
85 * Initialize the preference page
87 public void init(IWorkbench workbench
) {
88 setPreferenceStore(PreferencesUtil
.getPreferenceStore());
92 protected void performDefaults() {
93 btnInit
.setSelection(false);
94 // btnTestData.setSelection(false);
95 super.performDefaults();
99 public boolean performOk() {
100 boolean doReinitialize
= !(btnInit
.getSelection());
101 // boolean doInitTestdata = btnTestData.getSelection();
103 PreferencesUtil
.getPreferenceStore().setValue(Resources
.INITIALIZED
, doReinitialize
);
104 // UiUtil.getPrefStore().setValue(ITaxEditorConstants.INITIALIZE_W_TESTDATA, doInitTestdata);