a little bug fixed in the switch labels
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / PHPEclipseParserPreferencePage.java
1 package net.sourceforge.phpeclipse;
2
3 import net.sourceforge.phpeclipse.preferences.PHPPreferencesMessages;
4
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;
18
19 public class PHPEclipseParserPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
20
21 //  private SelectionListener SelectionListener;
22 //  private ModifyListener ModifyListener;
23 //  private ModifyListener TextModifyListener;
24 //
25 //  private ArrayList CheckBoxes = new ArrayList();
26 //  private ArrayList ComboBoxes = new ArrayList();
27 //  private ArrayList TextBoxes = new ArrayList();
28 //  private ArrayList RadioButtons = new ArrayList();
29
30
31   RadioGroupFieldEditor chooseParser;
32   StringFieldEditor externalParserSFE;
33  // BooleanFieldEditor parseOnSave;
34
35   public PHPEclipseParserPreferencePage() {
36     super();
37     setPreferenceStore(PHPeclipsePlugin.getDefault().getPreferenceStore());
38     setDescription(PHPPreferencesMessages.getString("PHPBasePreferencePage.description")); //$NON-NLS-1$
39   }
40   public void init(IWorkbench workbench) {
41   }
42   protected void performDefaults() {
43     chooseParser.loadDefault();
44     externalParserSFE.loadDefault();
45 //    parseOnSave.loadDefault();
46     super.performDefaults();
47   }
48
49   public boolean performOk() {
50     chooseParser.store();
51     externalParserSFE.store();
52 //    parseOnSave.store();
53     return super.performOk();
54   }
55
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());
62     //Create Websettings
63     //    Composite webSettingsComposite = new Composite(composite, SWT.NONE);
64     //    webSettingsComposite.setLayout(new GridLayout());
65     //    webSettingsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
66
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));
75
76     chooseParser =
77       new RadioGroupFieldEditor(
78         IPreferenceConstants.PHP_PARSER_DEFAULT,
79         PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.choose"),
80         1,
81         new String[][] {
82           { PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.internal"), IPreferenceConstants.PHP_INTERNAL_PARSER },
83           {
84         PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.external"), IPreferenceConstants.PHP_EXTERNAL_PARSER }
85     }, parserSettingsGroup);
86     chooseParser.setPreferencePage(this);
87     chooseParser.setPreferenceStore(getPreferenceStore());
88     chooseParser.load();
89     //create a copmposte just for the StringEditor - makes layout simpler
90     Composite externalParserCompo = new Composite(parserSettingsGroup, SWT.NONE);
91     externalParserSFE =
92       new StringFieldEditor(
93         IPreferenceConstants.EXTERNAL_PARSER_PREF,
94         PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.extcommand"),
95         externalParserCompo
96     /*parserSettingsGroup*/
97     );
98     externalParserSFE.setPreferencePage(this);
99     externalParserSFE.setPreferenceStore(getPreferenceStore());
100     externalParserSFE.load();
101
102 //    parseOnSave =
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());
109 //    parseOnSave.load();
110
111     return composite;
112   }
113 }