Some refactor to use the PHPSegmentWithChildren instead of PHPClassDeclaration
[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       BooleanFieldEditor outlineShowClass =
83         new BooleanFieldEditor(PHPeclipsePlugin.PHP_OUTLINE_CLASS, "Show classes in outline", getFieldEditorParent());
84       BooleanFieldEditor outlineShowFunc =
85         new BooleanFieldEditor(PHPeclipsePlugin.PHP_OUTLINE_FUNC, "Show functions in outline", getFieldEditorParent());
86       BooleanFieldEditor outlineShowVar =
87         new BooleanFieldEditor(PHPeclipsePlugin.PHP_OUTLINE_VAR, "Show variables in outline", getFieldEditorParent());
88
89     
90     addField(localhost);
91     addField(documentRoot);
92     addField(useExternalBrowser);
93     addField(externalBrowser);
94     addField(startMySQL);
95     addField(startApache);
96
97     addField(stopApache);
98     addField(restartApache);
99     
100     addField(externalParser);
101     
102     addField(chooseParser);
103     addField(parseOnSave);
104     addField(outlineShowClass) ;
105     addField(outlineShowFunc);
106     addField(outlineShowVar);
107   }
108
109   /**
110    * @see IWorkbenchPreferencePage#init
111    */
112   public void init(IWorkbench workbench) {
113   }
114
115 }