1 package net.sourceforge.phpeclipse;
3 import net.sourceforge.phpeclipse.preferences.PHPPreferencesMessages;
5 import org.eclipse.jface.preference.BooleanFieldEditor;
6 import org.eclipse.jface.preference.IPreferenceStore;
7 import org.eclipse.jface.preference.PreferencePage;
8 import org.eclipse.jface.preference.RadioGroupFieldEditor;
9 import org.eclipse.jface.preference.StringFieldEditor;
10 import org.eclipse.swt.SWT;
11 import org.eclipse.swt.layout.GridData;
12 import org.eclipse.swt.layout.GridLayout;
13 import org.eclipse.swt.widgets.Composite;
14 import org.eclipse.swt.widgets.Control;
15 import org.eclipse.swt.widgets.Group;
16 import org.eclipse.ui.IWorkbench;
17 import org.eclipse.ui.IWorkbenchPreferencePage;
19 public class PHPEclipseParserPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
21 // private SelectionListener SelectionListener;
22 // private ModifyListener ModifyListener;
23 // private ModifyListener TextModifyListener;
25 // private ArrayList CheckBoxes = new ArrayList();
26 // private ArrayList ComboBoxes = new ArrayList();
27 // private ArrayList TextBoxes = new ArrayList();
28 // private ArrayList RadioButtons = new ArrayList();
31 RadioGroupFieldEditor chooseParser;
32 StringFieldEditor externalParserSFE;
33 BooleanFieldEditor parseOnSave;
35 public PHPEclipseParserPreferencePage() {
37 setPreferenceStore(PHPeclipsePlugin.getDefault().getPreferenceStore());
38 setDescription(PHPPreferencesMessages.getString("PHPBasePreferencePage.description")); //$NON-NLS-1$
40 public void init(IWorkbench workbench) {
42 protected void performDefaults() {
43 chooseParser.loadDefault();
44 externalParserSFE.loadDefault();
45 parseOnSave.loadDefault();
46 super.performDefaults();
49 public boolean performOk() {
51 externalParserSFE.store();
53 return super.performOk();
56 protected Control createContents(Composite parent) {
57 initializeDialogUnits(parent);
58 final IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore();
59 Composite composite = new Composite(parent, SWT.LEFT);
60 composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
61 composite.setLayout(new GridLayout());
63 // Composite webSettingsComposite = new Composite(composite, SWT.NONE);
64 // webSettingsComposite.setLayout(new GridLayout());
65 // webSettingsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
67 //Create parser settings composite
68 Composite parserSettingsComposite = new Composite(composite, SWT.NONE);
69 parserSettingsComposite.setLayout(new GridLayout());
70 parserSettingsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
71 Group parserSettingsGroup = new Group(parserSettingsComposite, SWT.NONE);
72 parserSettingsGroup.setText(PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers"));
73 parserSettingsGroup.setLayout(new GridLayout());
74 parserSettingsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
77 new RadioGroupFieldEditor(
78 IPreferenceConstants.PHP_PARSER_DEFAULT,
79 PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.choose"),
82 { PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.internal"), IPreferenceConstants.PHP_INTERNAL_PARSER },
84 PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.external"), IPreferenceConstants.PHP_EXTERNAL_PARSER }
85 }, parserSettingsGroup);
86 chooseParser.setPreferencePage(this);
87 chooseParser.setPreferenceStore(getPreferenceStore());
89 //create a copmposte just for the StringEditor - makes layout simpler
90 Composite externalParserCompo = new Composite(parserSettingsGroup, SWT.NONE);
92 new StringFieldEditor(
93 IPreferenceConstants.EXTERNAL_PARSER_PREF,
94 PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.extcommand"),
96 /*parserSettingsGroup*/
98 externalParserSFE.setPreferencePage(this);
99 externalParserSFE.setPreferenceStore(getPreferenceStore());
100 externalParserSFE.load();
103 new BooleanFieldEditor(
104 PHPeclipsePlugin.PHP_PARSE_ON_SAVE,
105 PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.pos"),
106 parserSettingsGroup);
107 parseOnSave.setPreferencePage(this);
108 parseOnSave.setPreferenceStore(getPreferenceStore());