1 package net.sourceforge.phpdt.externaltools.preferences;
3 import net.sourceforge.phpeclipse.externaltools.ExternalToolsPlugin;
5 import org.eclipse.jface.preference.BooleanFieldEditor;
6 import org.eclipse.jface.preference.FileFieldEditor;
7 import org.eclipse.jface.preference.PreferencePage;
8 import org.eclipse.jface.preference.StringFieldEditor;
9 import org.eclipse.swt.SWT;
10 import org.eclipse.swt.layout.GridData;
11 import org.eclipse.swt.layout.GridLayout;
12 import org.eclipse.swt.widgets.Composite;
13 import org.eclipse.swt.widgets.Control;
14 import org.eclipse.swt.widgets.Label;
15 import org.eclipse.ui.IWorkbench;
16 import org.eclipse.ui.IWorkbenchPreferencePage;
18 public class MySQLPreferencePage extends PreferencePage implements
19 IWorkbenchPreferencePage {
21 StringFieldEditor mySQLCommandSFE;
23 FileFieldEditor mysqlRunFFE;
25 BooleanFieldEditor mysqlStartBFE;
27 public MySQLPreferencePage() {
30 if (ExternalToolsPlugin.getDefault () != null) {
31 setPreferenceStore (ExternalToolsPlugin.getDefault().getPreferenceStore());
35 protected Control createContents(Composite parent) {
36 initializeDialogUnits(parent);
37 Composite composite = new Composite(parent, SWT.LEFT);
38 composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
39 composite.setLayout(new GridLayout());
41 mysqlStartBFE = new BooleanFieldEditor(
42 ExternalToolsPlugin.MYSQL_START_BACKGROUND,
43 PHPPreferencesMessages
44 .getString("PHPBasePreferencePage.mySQLGroup.start_background"),
46 mysqlStartBFE.setPage(this);
47 mysqlStartBFE.setPreferenceStore(getPreferenceStore());
49 new Label(composite, SWT.NONE);
50 new Label(composite, SWT.NONE);
52 mySQLCommandSFE = new StringFieldEditor(ExternalToolsPlugin.MYSQL_PREF,
53 PHPPreferencesMessages
54 .getString("PHPBasePreferencePage.mySQLGroup.command"),
56 mySQLCommandSFE.setPage(this);
57 mySQLCommandSFE.setPreferenceStore(getPreferenceStore());
58 mySQLCommandSFE.load();
59 new Label(composite, SWT.NONE);
61 mysqlRunFFE = new FileFieldEditor(ExternalToolsPlugin.MYSQL_RUN_PREF,
62 PHPPreferencesMessages
63 .getString("PHPBasePreferencePage.mySQLGroup.run"),
65 mysqlRunFFE.setPage(this);
66 mysqlRunFFE.setPreferenceStore(getPreferenceStore());
72 public void init(IWorkbench workbench) {
75 protected void performDefaults() {
76 mySQLCommandSFE.loadDefault();
77 mysqlRunFFE.loadDefault();
78 mysqlStartBFE.loadDefault();
79 super.performDefaults();
82 public boolean performOk() {
83 mySQLCommandSFE.store();
85 mysqlStartBFE.store();
86 return super.performOk();