Syntax Highlighting Prefs work now / Automatic parse on save option available
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / PHPEclipsePreferencePage.java
1 /**********************************************************************
2 Copyright (c) 2000, 2002 IBM Corp. and others.
3 All rights reserved. This program and the accompanying materials
4 are made available under the terms of the Common Public License v1.0
5 which accompanies this distribution, and is available at
6 http://www.eclipse.org/legal/cpl-v10.html
7
8 Contributors:
9     IBM Corporation - Initial implementation
10     Klaus Hartlage - www.eclipseproject.de
11 **********************************************************************/
12 package net.sourceforge.phpeclipse;
13
14 import org.eclipse.jface.preference.BooleanFieldEditor;
15 import org.eclipse.jface.preference.DirectoryFieldEditor;
16 import org.eclipse.jface.preference.FieldEditorPreferencePage;
17 import org.eclipse.jface.preference.IPreferenceStore;
18 import org.eclipse.jface.preference.RadioGroupFieldEditor;
19 import org.eclipse.jface.preference.StringFieldEditor;
20 import org.eclipse.ui.IWorkbench;
21 import org.eclipse.ui.IWorkbenchPreferencePage;
22
23 /**
24  * 
25  * @author khartlage
26  */
27 public class PHPEclipsePreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
28
29   public PHPEclipsePreferencePage() {
30     super(FieldEditorPreferencePage.GRID);
31     //Initialize the preference store we wish to use
32     setPreferenceStore(PHPeclipsePlugin.getDefault().getPreferenceStore());
33   }
34
35   protected void createFieldEditors() {
36     final IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore();
37
38     StringFieldEditor localhost = new StringFieldEditor(PHPeclipsePlugin.LOCALHOST_PREF, "&Localhost:", 60, getFieldEditorParent());
39
40     DirectoryFieldEditor documentRoot =
41       new DirectoryFieldEditor(PHPeclipsePlugin.DOCUMENTROOT_PREF, "&DocumentRoot:", getFieldEditorParent());
42
43     BooleanFieldEditor useExternalBrowser =
44       new BooleanFieldEditor(PHPeclipsePlugin.USE_EXTERNAL_BROWSER_PREF, "&Use External Browser", getFieldEditorParent());
45
46     StringFieldEditor externalBrowser =
47       new StringFieldEditor(PHPeclipsePlugin.EXTERNAL_BROWSER_PREF, "&External Browser command:", 60, getFieldEditorParent());
48
49     StringFieldEditor startMySQL =
50       new StringFieldEditor(PHPeclipsePlugin.MYSQL_PREF, "&MySQL command:", 60, getFieldEditorParent());
51
52     StringFieldEditor startApache =
53       new StringFieldEditor(PHPeclipsePlugin.APACHE_START_PREF, "Start &Apache command:", 60, getFieldEditorParent());
54
55     StringFieldEditor stopApache =
56       new StringFieldEditor(PHPeclipsePlugin.APACHE_STOP_PREF, "&Stop Apache command:", 60, getFieldEditorParent());
57
58     StringFieldEditor restartApache =
59       new StringFieldEditor(PHPeclipsePlugin.APACHE_RESTART_PREF, "&Restart Apache command:", 60, getFieldEditorParent());
60
61     StringFieldEditor externalParser =
62       new StringFieldEditor(PHPeclipsePlugin.EXTERNAL_PARSER_PREF, "&External Parser command:", 60, getFieldEditorParent());
63
64
65   RadioGroupFieldEditor chooseParser = new RadioGroupFieldEditor(
66     IPreferenceConstants.PHP_PARSER_DEFAULT,
67     "Choose PHP parser",
68     1,
69     new String[][] {
70       {"Internal parser", 
71        IPreferenceConstants.PHP_INTERNAL_PARSER
72       },
73       {"External parser", 
74        IPreferenceConstants.PHP_EXTERNAL_PARSER
75       }
76     },
77     this.getFieldEditorParent());
78     
79     BooleanFieldEditor parseOnSave =
80       new BooleanFieldEditor(PHPeclipsePlugin.PHP_PARSE_ON_SAVE, "&Parse automatically on save", getFieldEditorParent());
81
82     
83     
84     addField(localhost);
85     addField(documentRoot);
86     addField(useExternalBrowser);
87     addField(externalBrowser);
88     addField(startMySQL);
89     addField(startApache);
90
91     addField(stopApache);
92     addField(restartApache);
93     
94     addField(externalParser);
95     
96     addField(chooseParser);
97     addField(parseOnSave);
98   }
99
100   /**
101    * @see IWorkbenchPreferencePage#init
102    */
103   public void init(IWorkbench workbench) {
104   }
105
106 }