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