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