1 package com.quantum.php.preferences;
3 import org.eclipse.jface.preference.PreferencePage;
4 import org.eclipse.jface.preference.StringFieldEditor;
5 import org.eclipse.swt.SWT;
6 import org.eclipse.swt.layout.GridData;
7 import org.eclipse.swt.layout.GridLayout;
8 import org.eclipse.swt.widgets.Composite;
9 import org.eclipse.swt.widgets.Control;
10 import org.eclipse.ui.IWorkbench;
11 import org.eclipse.ui.IWorkbenchPreferencePage;
13 import com.quantum.QuantumPlugin;
15 public class PHPSQLConnectionPreferencePage
16 extends PreferencePage
17 implements IWorkbenchPreferencePage {
19 StringFieldEditor fUserNameSFE;
20 StringFieldEditor fConnectSFE;
21 StringFieldEditor fDriverSFE;
22 StringFieldEditor fTypeSFE;
23 StringFieldEditor fDriverFileFFE;
25 public PHPSQLConnectionPreferencePage() {
27 setPreferenceStore(QuantumPlugin.getDefault().getPreferenceStore());
29 public void init(IWorkbench workbench) {
30 setPreferenceStore(QuantumPlugin.getDefault().getPreferenceStore());
32 protected void performDefaults() {
33 fUserNameSFE.loadDefault();
34 fConnectSFE.loadDefault();
35 fDriverSFE.loadDefault();
36 fTypeSFE.loadDefault();
37 fDriverFileFFE.loadDefault();
38 super.performDefaults();
41 public boolean performOk() {
46 fDriverFileFFE.store();
47 return super.performOk();
50 protected Control createContents(Composite parent) {
51 initializeDialogUnits(parent);
52 // final IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore();
53 Composite composite = new Composite(parent, SWT.LEFT);
54 GridLayout layout = new GridLayout();
55 composite.setLayout(layout);
56 composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
57 // layout.numColumns = 1;
60 new StringFieldEditor(
61 "phpeclipse.sql.username.connect",
64 fUserNameSFE.setPreferencePage(this);
65 fUserNameSFE.setPreferenceStore(getPreferenceStore());
69 new StringFieldEditor(
70 "phpeclipse.sql.connect.connect",
73 fConnectSFE.setPreferencePage(this);
74 fConnectSFE.setPreferenceStore(getPreferenceStore());
78 new StringFieldEditor(
79 "phpeclipse.sql.driver.connect",
82 fDriverSFE.setPreferencePage(this);
83 fDriverSFE.setPreferenceStore(getPreferenceStore());
87 new StringFieldEditor("phpeclipse.sql.type.connect", "Type:", composite);
88 fTypeSFE.setPreferencePage(this);
89 fTypeSFE.setPreferenceStore(getPreferenceStore());
93 // new FileFieldEditor(
94 // "phpeclipse.sql.filename.connect",
95 // "Driver filename:",
98 new StringFieldEditor(
99 "phpeclipse.sql.filename.connect",
102 fDriverFileFFE.setPreferencePage(this);
103 fDriverFileFFE.setPreferenceStore(getPreferenceStore());
104 fDriverFileFFE.load();