1 package net.sourceforge.phpdt.sql.preferences;
3 import net.sourceforge.phpdt.sql.PHPEclipseSQLPlugin;
5 import org.eclipse.jface.preference.FileFieldEditor;
6 import org.eclipse.jface.preference.PreferencePage;
7 import org.eclipse.jface.preference.StringFieldEditor;
8 import org.eclipse.swt.SWT;
9 import org.eclipse.swt.layout.GridData;
10 import org.eclipse.swt.layout.GridLayout;
11 import org.eclipse.swt.widgets.Composite;
12 import org.eclipse.swt.widgets.Control;
13 import org.eclipse.ui.IWorkbench;
14 import org.eclipse.ui.IWorkbenchPreferencePage;
16 public class PHPSQLConnectionPreferencePage
17 extends PreferencePage
18 implements IWorkbenchPreferencePage {
20 StringFieldEditor fUserNameSFE;
21 StringFieldEditor fConnectSFE;
22 StringFieldEditor fDriverSFE;
23 StringFieldEditor fTypeSFE;
24 StringFieldEditor fDriverFileFFE;
26 public PHPSQLConnectionPreferencePage() {
28 setPreferenceStore(PHPEclipseSQLPlugin.getDefault().getPreferenceStore());
30 public void init(IWorkbench workbench) {
31 setPreferenceStore(PHPEclipseSQLPlugin.getDefault().getPreferenceStore());
33 protected void performDefaults() {
34 fUserNameSFE.loadDefault();
35 fConnectSFE.loadDefault();
36 fDriverSFE.loadDefault();
37 fTypeSFE.loadDefault();
38 fDriverFileFFE.loadDefault();
39 super.performDefaults();
42 public boolean performOk() {
47 fDriverFileFFE.store();
48 return super.performOk();
51 protected Control createContents(Composite parent) {
52 initializeDialogUnits(parent);
53 // final IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore();
54 Composite composite = new Composite(parent, SWT.LEFT);
55 GridLayout layout = new GridLayout();
56 composite.setLayout(layout);
57 composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
58 // layout.numColumns = 1;
61 new StringFieldEditor(
62 "phpeclipse.sql.username.connect",
65 fUserNameSFE.setPreferencePage(this);
66 fUserNameSFE.setPreferenceStore(getPreferenceStore());
70 new StringFieldEditor(
71 "phpeclipse.sql.connect.connect",
74 fConnectSFE.setPreferencePage(this);
75 fConnectSFE.setPreferenceStore(getPreferenceStore());
79 new StringFieldEditor(
80 "phpeclipse.sql.driver.connect",
83 fDriverSFE.setPreferencePage(this);
84 fDriverSFE.setPreferenceStore(getPreferenceStore());
88 new StringFieldEditor("phpeclipse.sql.type.connect", "Type:", composite);
89 fTypeSFE.setPreferencePage(this);
90 fTypeSFE.setPreferenceStore(getPreferenceStore());
94 // new FileFieldEditor(
95 // "phpeclipse.sql.filename.connect",
96 // "Driver filename:",
99 new StringFieldEditor(
100 "phpeclipse.sql.filename.connect",
103 fDriverFileFFE.setPreferencePage(this);
104 fDriverFileFFE.setPreferenceStore(getPreferenceStore());
105 fDriverFileFFE.load();