Update MANIFEST.MF, replaced deprecated Eclipse-LazyStart with Bundle-ActivationPolicy.
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / php / preferences / PHPSQLConnectionPreferencePage.java
1 package com.quantum.php.preferences;
2
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;
12
13 import com.quantum.QuantumPlugin;
14
15 public class PHPSQLConnectionPreferencePage
16   extends PreferencePage
17   implements IWorkbenchPreferencePage {
18
19   StringFieldEditor fUserNameSFE;
20   StringFieldEditor fConnectSFE;
21   StringFieldEditor fDriverSFE;
22   StringFieldEditor fTypeSFE;
23   StringFieldEditor fDriverFileFFE;
24
25   public PHPSQLConnectionPreferencePage() {
26         super();
27         setPreferenceStore(QuantumPlugin.getDefault().getPreferenceStore());
28   }
29   public void init(IWorkbench workbench) {
30         setPreferenceStore(QuantumPlugin.getDefault().getPreferenceStore());
31   }
32   protected void performDefaults() {
33         fUserNameSFE.loadDefault();
34         fConnectSFE.loadDefault();
35         fDriverSFE.loadDefault();
36         fTypeSFE.loadDefault();
37         fDriverFileFFE.loadDefault();
38         super.performDefaults();
39   }
40
41   public boolean performOk() {
42         fUserNameSFE.store();
43         fConnectSFE.store();
44         fDriverSFE.store();
45         fTypeSFE.store();
46         fDriverFileFFE.store();
47         return super.performOk();
48   }
49
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;
58
59         fUserNameSFE =
60           new StringFieldEditor(
61                 "phpeclipse.sql.username.connect",
62                 "Default User name:",
63                 composite);
64         fUserNameSFE.setPreferencePage(this);
65         fUserNameSFE.setPreferenceStore(getPreferenceStore());
66         fUserNameSFE.load();
67
68         fConnectSFE =
69           new StringFieldEditor(
70                 "phpeclipse.sql.connect.connect",
71                 "Connect:",
72                 composite);
73         fConnectSFE.setPreferencePage(this);
74         fConnectSFE.setPreferenceStore(getPreferenceStore());
75         fConnectSFE.load();
76
77         fDriverSFE =
78           new StringFieldEditor(
79                 "phpeclipse.sql.driver.connect",
80                 "Driver:",
81                 composite);
82         fDriverSFE.setPreferencePage(this);
83         fDriverSFE.setPreferenceStore(getPreferenceStore());
84         fDriverSFE.load();
85
86         fTypeSFE =
87           new StringFieldEditor("phpeclipse.sql.type.connect", "Type:", composite);
88         fTypeSFE.setPreferencePage(this);
89         fTypeSFE.setPreferenceStore(getPreferenceStore());
90         fTypeSFE.load();
91
92         //    fDriverFileFFE =
93         //      new FileFieldEditor(
94         //        "phpeclipse.sql.filename.connect",
95         //        "Driver filename:",
96         //        composite);
97         fDriverFileFFE =
98           new StringFieldEditor(
99                 "phpeclipse.sql.filename.connect",
100                 "Driver filename:",
101                 composite);
102         fDriverFileFFE.setPreferencePage(this);
103         fDriverFileFFE.setPreferenceStore(getPreferenceStore());
104         fDriverFileFFE.load();
105
106         return composite;
107   }
108 }