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() {
29 setPreferenceStore(ExternalToolsPlugin.getDefault()
30 .getPreferenceStore());
33 protected Control createContents(Composite parent) {
34 initializeDialogUnits(parent);
35 Composite composite = new Composite(parent, SWT.LEFT);
36 composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
37 composite.setLayout(new GridLayout());
39 mysqlStartBFE = new BooleanFieldEditor(
40 ExternalToolsPlugin.MYSQL_START_BACKGROUND,
41 PHPPreferencesMessages
42 .getString("PHPBasePreferencePage.mySQLGroup.start_background"),
44 mysqlStartBFE.setPage(this);
45 mysqlStartBFE.setPreferenceStore(getPreferenceStore());
47 new Label(composite, SWT.NONE);
48 new Label(composite, SWT.NONE);
50 mySQLCommandSFE = new StringFieldEditor(ExternalToolsPlugin.MYSQL_PREF,
51 PHPPreferencesMessages
52 .getString("PHPBasePreferencePage.mySQLGroup.command"),
54 mySQLCommandSFE.setPage(this);
55 mySQLCommandSFE.setPreferenceStore(getPreferenceStore());
56 mySQLCommandSFE.load();
57 new Label(composite, SWT.NONE);
59 mysqlRunFFE = new FileFieldEditor(ExternalToolsPlugin.MYSQL_RUN_PREF,
60 PHPPreferencesMessages
61 .getString("PHPBasePreferencePage.mySQLGroup.run"),
63 mysqlRunFFE.setPage(this);
64 mysqlRunFFE.setPreferenceStore(getPreferenceStore());
70 public void init(IWorkbench workbench) {
73 protected void performDefaults() {
74 mySQLCommandSFE.loadDefault();
75 mysqlRunFFE.loadDefault();
76 mysqlStartBFE.loadDefault();
77 super.performDefaults();
80 public boolean performOk() {
81 mySQLCommandSFE.store();
83 mysqlStartBFE.store();
84 return super.performOk();