1 package com.quantum.preferences.php;
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 PHPSQLTemplatesPreferencePage
16 extends PreferencePage
17 implements IWorkbenchPreferencePage {
19 StringFieldEditor fPHPSelectSFE;
20 StringFieldEditor fPHPInsertSFE;
21 StringFieldEditor fPHPUpdateSFE;
22 StringFieldEditor fPHPDeleteSFE;
24 public PHPSQLTemplatesPreferencePage() {
26 setPreferenceStore(QuantumPlugin.getDefault().getPreferenceStore());
27 // setDescription("PHP SQL templates"); //$NON-NLS-1$
30 public void init(IWorkbench workbench) {
31 setPreferenceStore(QuantumPlugin.getDefault().getPreferenceStore());
34 protected void performDefaults() {
35 fPHPSelectSFE.loadDefault();
36 fPHPInsertSFE.loadDefault();
37 fPHPUpdateSFE.loadDefault();
38 fPHPDeleteSFE.loadDefault();
39 super.performDefaults();
42 public boolean performOk() {
43 fPHPSelectSFE.store();
44 fPHPInsertSFE.store();
45 fPHPUpdateSFE.store();
46 fPHPDeleteSFE.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 composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
55 composite.setLayout(new GridLayout());
58 new StringFieldEditor(
59 "phpeclipse.sql.select.template",
62 fPHPSelectSFE.setPreferencePage(this);
63 fPHPSelectSFE.setPreferenceStore(getPreferenceStore());
67 new StringFieldEditor(
68 "phpeclipse.sql.insert.template",
71 fPHPInsertSFE.setPreferencePage(this);
72 fPHPInsertSFE.setPreferenceStore(getPreferenceStore());
76 new StringFieldEditor(
77 "phpeclipse.sql.update.template",
80 fPHPUpdateSFE.setPreferencePage(this);
81 fPHPUpdateSFE.setPreferenceStore(getPreferenceStore());
85 new StringFieldEditor(
86 "phpeclipse.sql.delete.template",
89 fPHPDeleteSFE.setPreferencePage(this);
90 fPHPDeleteSFE.setPreferenceStore(getPreferenceStore());