fixed ID bug
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / preferences / php / PHPSQLTemplatesPreferencePage.java
1 package com.quantum.preferences.php;
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 PHPSQLTemplatesPreferencePage
16   extends PreferencePage
17   implements IWorkbenchPreferencePage {
18
19   StringFieldEditor fPHPSelectSFE;
20   StringFieldEditor fPHPInsertSFE;
21   StringFieldEditor fPHPUpdateSFE;
22   StringFieldEditor fPHPDeleteSFE;
23
24   public PHPSQLTemplatesPreferencePage() {
25     super();
26     setPreferenceStore(QuantumPlugin.getDefault().getPreferenceStore());
27     //  setDescription("PHP SQL templates"); //$NON-NLS-1$
28   }
29   
30   public void init(IWorkbench workbench) {
31     setPreferenceStore(QuantumPlugin.getDefault().getPreferenceStore());
32   }
33   
34   protected void performDefaults() {
35     fPHPSelectSFE.loadDefault();
36     fPHPInsertSFE.loadDefault();
37     fPHPUpdateSFE.loadDefault();
38     fPHPDeleteSFE.loadDefault();
39     super.performDefaults();
40   }
41
42   public boolean performOk() {
43     fPHPSelectSFE.store();
44     fPHPInsertSFE.store();
45     fPHPUpdateSFE.store();
46     fPHPDeleteSFE.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     composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
55     composite.setLayout(new GridLayout());
56
57     fPHPSelectSFE =
58       new StringFieldEditor(
59         "phpeclipse.sql.select.template",
60         "SELECT template:",
61         composite);
62     fPHPSelectSFE.setPreferencePage(this);
63     fPHPSelectSFE.setPreferenceStore(getPreferenceStore());
64     fPHPSelectSFE.load();
65
66     fPHPInsertSFE =
67       new StringFieldEditor(
68         "phpeclipse.sql.insert.template",
69         "INSERT template:",
70         composite);
71     fPHPInsertSFE.setPreferencePage(this);
72     fPHPInsertSFE.setPreferenceStore(getPreferenceStore());
73     fPHPInsertSFE.load();
74
75     fPHPUpdateSFE =
76       new StringFieldEditor(
77         "phpeclipse.sql.update.template",
78         "UPDATE template:",
79         composite);
80     fPHPUpdateSFE.setPreferencePage(this);
81     fPHPUpdateSFE.setPreferenceStore(getPreferenceStore());
82     fPHPUpdateSFE.load();
83
84     fPHPDeleteSFE =
85       new StringFieldEditor(
86         "phpeclipse.sql.delete.template",
87         "DELETE template:",
88         composite);
89     fPHPDeleteSFE.setPreferencePage(this);
90     fPHPDeleteSFE.setPreferenceStore(getPreferenceStore());
91     fPHPDeleteSFE.load();
92     return composite;
93   }
94 }