1) Fixed stackoverflow when clicking on entry in PHPeclipse Error Log: OverrideIndica...
[phpeclipse.git] / net.sourceforge.phpeclipse.externaltools / src / net / sourceforge / phpdt / externaltools / preferences / MySQLPreferencePage.java
1 package net.sourceforge.phpdt.externaltools.preferences;
2
3 import net.sourceforge.phpeclipse.externaltools.ExternalToolsPlugin;
4
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;
17
18 public class MySQLPreferencePage extends PreferencePage implements
19                 IWorkbenchPreferencePage {
20
21         StringFieldEditor mySQLCommandSFE;
22
23         FileFieldEditor mysqlRunFFE;
24
25         BooleanFieldEditor mysqlStartBFE;
26
27         public MySQLPreferencePage() {
28                 super();
29
30         if (ExternalToolsPlugin.getDefault () != null) {
31             setPreferenceStore (ExternalToolsPlugin.getDefault().getPreferenceStore());
32         }
33         }
34
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());
40
41                 mysqlStartBFE = new BooleanFieldEditor(
42                                 ExternalToolsPlugin.MYSQL_START_BACKGROUND,
43                                 PHPPreferencesMessages
44                                                 .getString("PHPBasePreferencePage.mySQLGroup.start_background"),
45                                 composite);
46                 mysqlStartBFE.setPage(this);
47                 mysqlStartBFE.setPreferenceStore(getPreferenceStore());
48                 mysqlStartBFE.load();
49                 new Label(composite, SWT.NONE);
50                 new Label(composite, SWT.NONE);
51
52                 mySQLCommandSFE = new StringFieldEditor(ExternalToolsPlugin.MYSQL_PREF,
53                                 PHPPreferencesMessages
54                                                 .getString("PHPBasePreferencePage.mySQLGroup.command"),
55                                 composite);
56                 mySQLCommandSFE.setPage(this);
57                 mySQLCommandSFE.setPreferenceStore(getPreferenceStore());
58                 mySQLCommandSFE.load();
59                 new Label(composite, SWT.NONE);
60
61                 mysqlRunFFE = new FileFieldEditor(ExternalToolsPlugin.MYSQL_RUN_PREF,
62                                 PHPPreferencesMessages
63                                                 .getString("PHPBasePreferencePage.mySQLGroup.run"),
64                                 composite);
65                 mysqlRunFFE.setPage(this);
66                 mysqlRunFFE.setPreferenceStore(getPreferenceStore());
67                 mysqlRunFFE.load();
68
69                 return composite;
70         }
71
72         public void init(IWorkbench workbench) {
73         }
74
75         protected void performDefaults() {
76                 mySQLCommandSFE.loadDefault();
77                 mysqlRunFFE.loadDefault();
78                 mysqlStartBFE.loadDefault();
79                 super.performDefaults();
80         }
81
82         public boolean performOk() {
83                 mySQLCommandSFE.store();
84                 mysqlRunFFE.store();
85                 mysqlStartBFE.store();
86                 return super.performOk();
87         }
88
89 }