code-template needs new context type
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / preferences / PHPEclipseParserPreferencePage.java
1 package net.sourceforge.phpeclipse.preferences;
2
3 import net.sourceforge.phpeclipse.IPreferenceConstants;
4 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
5
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   
41   public void init(IWorkbench workbench) {
42   }
43   protected void performDefaults() {
44 //    chooseParser.loadDefault();
45     externalParserSFE.loadDefault();
46 //    parseOnSave.loadDefault();
47     super.performDefaults();
48   }
49
50   public boolean performOk() {
51 //    chooseParser.store();
52     externalParserSFE.store();
53 //    parseOnSave.store();
54     return super.performOk();
55   }
56
57   protected Control createContents(Composite parent) {
58     initializeDialogUnits(parent);
59     final IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore();
60     Composite composite = new Composite(parent, SWT.LEFT);
61     composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
62     composite.setLayout(new GridLayout());
63
64     //Create parser settings composite
65     Composite parserSettingsComposite = new Composite(composite, SWT.NONE);
66     parserSettingsComposite.setLayout(new GridLayout());
67     parserSettingsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
68     Group parserSettingsGroup = new Group(parserSettingsComposite, SWT.NONE);
69     parserSettingsGroup.setText(PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers"));
70     parserSettingsGroup.setLayout(new GridLayout());
71     parserSettingsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
72
73 //    chooseParser =
74 //      new RadioGroupFieldEditor(
75 //        IPreferenceConstants.PHP_PARSER_DEFAULT,
76 //        PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.choose"),
77 //        1,
78 //        new String[][] {
79 //          { PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.internal"), IPreferenceConstants.PHP_INTERNAL_PARSER },
80 //          {
81 //        PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.external"), IPreferenceConstants.PHP_EXTERNAL_PARSER }
82 //    }, parserSettingsGroup);
83 //    chooseParser.setPreferencePage(this);
84 //    chooseParser.setPreferenceStore(getPreferenceStore());
85 //    chooseParser.load();
86     //create a copmposte just for the StringEditor - makes layout simpler
87     Composite externalParserCompo = new Composite(parserSettingsGroup, SWT.NONE);
88     externalParserSFE =
89       new StringFieldEditor(
90         IPreferenceConstants.EXTERNAL_PARSER_PREF,
91         PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.extcommand"),
92         externalParserCompo
93     /*parserSettingsGroup*/
94     );
95     externalParserSFE.setPreferencePage(this);
96     externalParserSFE.setPreferenceStore(getPreferenceStore());
97     externalParserSFE.load();
98
99 //    parseOnSave =
100 //      new BooleanFieldEditor(
101 //        PHPeclipsePlugin.PHP_PARSE_ON_SAVE,
102 //        PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.pos"),
103 //        parserSettingsGroup);
104 //    parseOnSave.setPreferencePage(this);
105 //    parseOnSave.setPreferenceStore(getPreferenceStore());
106 //    parseOnSave.load();
107
108     return composite;
109   }
110 }