package com.quantum.php.preferences; import org.eclipse.jface.preference.PreferencePage; import org.eclipse.jface.preference.StringFieldEditor; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; import com.quantum.QuantumPlugin; public class PHPSQLTemplatesPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { StringFieldEditor fPHPSelectSFE; StringFieldEditor fPHPInsertSFE; StringFieldEditor fPHPUpdateSFE; StringFieldEditor fPHPDeleteSFE; public PHPSQLTemplatesPreferencePage() { super(); setPreferenceStore(QuantumPlugin.getDefault().getPreferenceStore()); // setDescription("PHP SQL templates"); //$NON-NLS-1$ } public void init(IWorkbench workbench) { setPreferenceStore(QuantumPlugin.getDefault().getPreferenceStore()); } protected void performDefaults() { fPHPSelectSFE.loadDefault(); fPHPInsertSFE.loadDefault(); fPHPUpdateSFE.loadDefault(); fPHPDeleteSFE.loadDefault(); super.performDefaults(); } public boolean performOk() { fPHPSelectSFE.store(); fPHPInsertSFE.store(); fPHPUpdateSFE.store(); fPHPDeleteSFE.store(); return super.performOk(); } protected Control createContents(Composite parent) { initializeDialogUnits(parent); // final IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore(); Composite composite = new Composite(parent, SWT.LEFT); composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); composite.setLayout(new GridLayout()); fPHPSelectSFE = new StringFieldEditor( "phpeclipse.sql.select.template", "SELECT template:", composite); fPHPSelectSFE.setPreferencePage(this); fPHPSelectSFE.setPreferenceStore(getPreferenceStore()); fPHPSelectSFE.load(); fPHPInsertSFE = new StringFieldEditor( "phpeclipse.sql.insert.template", "INSERT template:", composite); fPHPInsertSFE.setPreferencePage(this); fPHPInsertSFE.setPreferenceStore(getPreferenceStore()); fPHPInsertSFE.load(); fPHPUpdateSFE = new StringFieldEditor( "phpeclipse.sql.update.template", "UPDATE template:", composite); fPHPUpdateSFE.setPreferencePage(this); fPHPUpdateSFE.setPreferenceStore(getPreferenceStore()); fPHPUpdateSFE.load(); fPHPDeleteSFE = new StringFieldEditor( "phpeclipse.sql.delete.template", "DELETE template:", composite); fPHPDeleteSFE.setPreferencePage(this); fPHPDeleteSFE.setPreferenceStore(getPreferenceStore()); fPHPDeleteSFE.load(); return composite; } }