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
.store
.preference
;
12 import org
.apache
.log4j
.Logger
;
13 import org
.eclipse
.jface
.preference
.PreferencePage
;
14 import org
.eclipse
.swt
.SWT
;
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
.model
.Resources
;
31 public class InitializeDbPreferences
extends PreferencePage
implements
32 IWorkbenchPreferencePage
{
33 private static final Logger logger
= Logger
34 .getLogger(InitializeDbPreferences
.class);
36 public static final String PLUGIN_ID
= "eu.etaxonomy.taxeditor.preferences.initdb";
38 private Button btnInit
;
39 // private Button btnTestData;
41 public InitializeDbPreferences() {
43 setDescription("If you choose this option, taxonomic tree will be empty next time the Editor is started.");
47 * Create contents of the preference page
51 public Control
createContents(Composite parent
) {
53 Composite container
= new Composite(parent
, SWT
.NULL
);
54 container
.setLayout(new GridLayout());
56 btnInit
= new Button(container
, SWT
.CHECK
);
57 btnInit
.setText("Initialize datastore on next application start");
58 btnInit
.addSelectionListener(new SelectionAdapter() {
61 public void widgetSelected(SelectionEvent e
) {
62 if (btnInit
.getSelection() == true) {
64 // Enable test data option
65 // btnTestData.setEnabled(true);
69 // Disable test data option, set selected to "false"
70 // btnTestData.setEnabled(false);
71 // btnTestData.setSelection(false);
77 // btnTestData = new Button(container, SWT.CHECK);
78 // btnTestData.setEnabled(false);
79 // final GridData gridData = new GridData();
80 // gridData.horizontalIndent = 20;
81 // btnTestData.setLayoutData(gridData);
82 // btnTestData.setText("Initialize with Palmweb test data");
88 * Initialize the preference page
90 public void init(IWorkbench workbench
) {
91 setPreferenceStore(PreferencesUtil
.getPrefStore());
95 protected void performDefaults() {
96 btnInit
.setSelection(false);
97 // btnTestData.setSelection(false);
98 super.performDefaults();
102 public boolean performOk() {
103 boolean doReinitialize
= !(btnInit
.getSelection());
104 // boolean doInitTestdata = btnTestData.getSelection();
106 PreferencesUtil
.getPrefStore().setValue(Resources
.INITIALIZED
, doReinitialize
);
107 // UiUtil.getPrefStore().setValue(ITaxEditorConstants.INITIALIZE_W_TESTDATA, doInitTestdata);