Cosmetic
[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.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;
17
18 public class PHPEclipseParserPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
19
20 //  private SelectionListener SelectionListener;
21 //  private ModifyListener ModifyListener;
22 //  private ModifyListener TextModifyListener;
23 //
24 //  private ArrayList CheckBoxes = new ArrayList();
25 //  private ArrayList ComboBoxes = new ArrayList();
26 //  private ArrayList TextBoxes = new ArrayList();
27 //  private ArrayList RadioButtons = new ArrayList();
28
29
30 //  RadioGroupFieldEditor chooseParser;
31   StringFieldEditor externalParserSFE;
32  // BooleanFieldEditor parseOnSave;
33
34   public PHPEclipseParserPreferencePage() {
35     super();
36     setPreferenceStore(PHPeclipsePlugin.getDefault().getPreferenceStore());
37     setDescription(PHPPreferencesMessages.getString("PHPBasePreferencePage.description")); //$NON-NLS-1$
38   }
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
63     //Create parser settings composite
64     Composite parserSettingsComposite = new Composite(composite, SWT.NONE);
65     parserSettingsComposite.setLayout(new GridLayout());
66     parserSettingsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
67     Group parserSettingsGroup = new Group(parserSettingsComposite, SWT.NONE);
68     parserSettingsGroup.setText(PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers"));
69     parserSettingsGroup.setLayout(new GridLayout());
70     parserSettingsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
71
72 //    chooseParser =
73 //      new RadioGroupFieldEditor(
74 //        IPreferenceConstants.PHP_PARSER_DEFAULT,
75 //        PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.choose"),
76 //        1,
77 //        new String[][] {
78 //          { PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.internal"), IPreferenceConstants.PHP_INTERNAL_PARSER },
79 //          {
80 //        PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.external"), IPreferenceConstants.PHP_EXTERNAL_PARSER }
81 //    }, parserSettingsGroup);
82 //    chooseParser.setPreferencePage(this);
83 //    chooseParser.setPreferenceStore(getPreferenceStore());
84 //    chooseParser.load();
85     //create a copmposte just for the StringEditor - makes layout simpler
86     Composite externalParserCompo = new Composite(parserSettingsGroup, SWT.NONE);
87     externalParserSFE =
88       new StringFieldEditor(
89         IPreferenceConstants.EXTERNAL_PARSER_PREF,
90         PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.extcommand"),
91         externalParserCompo
92     /*parserSettingsGroup*/
93     );
94     externalParserSFE.setPreferencePage(this);
95     externalParserSFE.setPreferenceStore(getPreferenceStore());
96     externalParserSFE.load();
97
98 //    parseOnSave =
99 //      new BooleanFieldEditor(
100 //        PHPeclipsePlugin.PHP_PARSE_ON_SAVE,
101 //        PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.pos"),
102 //        parserSettingsGroup);
103 //    parseOnSave.setPreferencePage(this);
104 //    parseOnSave.setPreferenceStore(getPreferenceStore());
105 //    parseOnSave.load();
106
107     return composite;
108   }
109 }