1 package net.sourceforge.phpdt.externaltools.preferences;
4 import net.sourceforge.phpeclipse.externaltools.ExternalToolsPlugin;
6 import org.eclipse.jface.preference.BooleanFieldEditor;
7 import org.eclipse.jface.preference.FileFieldEditor;
8 import org.eclipse.jface.preference.IPreferenceStore;
9 import org.eclipse.jface.preference.PreferencePage;
10 import org.eclipse.jface.preference.StringFieldEditor;
11 import org.eclipse.swt.SWT;
12 import org.eclipse.swt.layout.GridData;
13 import org.eclipse.swt.layout.GridLayout;
14 import org.eclipse.swt.widgets.Composite;
15 import org.eclipse.swt.widgets.Control;
16 import org.eclipse.swt.widgets.Group;
17 import org.eclipse.swt.widgets.Label;
18 import org.eclipse.ui.IWorkbench;
19 import org.eclipse.ui.IWorkbenchPreferencePage;
21 public class PHPExternalToolsPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
23 // StringFieldEditor phpParserExtensionsSFE;
24 StringFieldEditor xamppStartSFE;
25 StringFieldEditor xamppStopSFE;
26 StringFieldEditor apacheStartSFE;
28 StringFieldEditor apacheStopSFE;
30 StringFieldEditor apacheRestartSFE;
32 StringFieldEditor mySQLCommandSFE;
34 StringFieldEditor externalParserSFE;
36 FileFieldEditor apacheRunFFE;
38 FileFieldEditor mysqlRunFFE;
40 FileFieldEditor phpRunFFE;
42 BooleanFieldEditor apacheStartBFE;
44 BooleanFieldEditor apacheStopBFE;
46 BooleanFieldEditor apacheRestartBFE;
48 BooleanFieldEditor mysqlStartBFE;
50 public PHPExternalToolsPreferencePage() {
52 setPreferenceStore(ExternalToolsPlugin.getDefault().getPreferenceStore());
53 setDescription(PHPPreferencesMessages.getString("PHPBasePreferencePage.description")); //$NON-NLS-1$
56 public void init(IWorkbench workbench) {
59 protected void performDefaults() {
60 // phpParserExtensionsSFE.loadDefault();
61 xamppStartSFE.loadDefault();
62 xamppStopSFE.loadDefault();
63 apacheStartSFE.loadDefault();
64 apacheStopSFE.loadDefault();
65 apacheRestartSFE.loadDefault();
66 mySQLCommandSFE.loadDefault();
67 externalParserSFE.loadDefault();
68 phpRunFFE.loadDefault();
69 apacheRunFFE.loadDefault();
70 mysqlRunFFE.loadDefault();
71 apacheStartBFE.loadDefault();
72 apacheStopBFE.loadDefault();
73 apacheRestartBFE.loadDefault();
74 mysqlStartBFE.loadDefault();
75 super.performDefaults();
78 public boolean performOk() {
79 // PHPFileUtil.setExtensions(null);
80 // phpParserExtensionsSFE.store();
81 xamppStartSFE.store();
83 apacheStartSFE.store();
84 apacheStopSFE.store();
85 apacheRestartSFE.store();
86 mySQLCommandSFE.store();
87 externalParserSFE.store();
92 apacheStartBFE.store();
93 apacheStopBFE.store();
94 apacheRestartBFE.store();
95 mysqlStartBFE.store();
96 return super.performOk();
99 protected Control createContents(Composite parent) {
100 initializeDialogUnits(parent);
101 final IPreferenceStore store = ExternalToolsPlugin.getDefault().getPreferenceStore();
102 Composite composite = new Composite(parent, SWT.LEFT);
103 composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
104 composite.setLayout(new GridLayout());
107 Composite apacheSettingsComposite = new Composite(composite, SWT.NULL);
108 apacheSettingsComposite.setLayout(new GridLayout());
109 apacheSettingsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
110 Group apacheSettingsGroup = new Group(apacheSettingsComposite, SWT.NONE);
111 apacheSettingsGroup.setText(PHPPreferencesMessages.getString("PHPBasePreferencePage.apacheGroup"));
112 apacheSettingsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
113 apacheSettingsGroup.setLayout(new GridLayout());
116 xamppStartSFE = new StringFieldEditor(ExternalToolsPlugin.XAMPP_START_PREF, PHPPreferencesMessages
117 .getString("PHPBasePreferencePage.apacheGroup.xampp_start"), apacheSettingsGroup);
118 xamppStartSFE.setPreferencePage(this);
119 xamppStartSFE.setPreferenceStore(getPreferenceStore());
120 xamppStartSFE.load();
121 new Label(apacheSettingsGroup, SWT.NONE);
123 xamppStopSFE = new StringFieldEditor(ExternalToolsPlugin.XAMPP_STOP_PREF, PHPPreferencesMessages
124 .getString("PHPBasePreferencePage.apacheGroup.xampp_stop"), apacheSettingsGroup);
125 xamppStopSFE.setPreferencePage(this);
126 xamppStopSFE.setPreferenceStore(getPreferenceStore());
128 new Label(apacheSettingsGroup, SWT.NONE);
130 apacheStartBFE = new BooleanFieldEditor(ExternalToolsPlugin.APACHE_START_BACKGROUND, PHPPreferencesMessages
131 .getString("PHPBasePreferencePage.apacheGroup.start_background"), apacheSettingsGroup);
132 apacheStartBFE.setPreferencePage(this);
133 apacheStartBFE.setPreferenceStore(getPreferenceStore());
134 apacheStartBFE.load();
136 new Label(apacheSettingsGroup, SWT.NONE);
137 new Label(apacheSettingsGroup, SWT.NONE);
138 apacheStartSFE = new StringFieldEditor(ExternalToolsPlugin.APACHE_START_PREF, PHPPreferencesMessages
139 .getString("PHPBasePreferencePage.apacheGroup.start"), apacheSettingsGroup);
140 apacheStartSFE.setPreferencePage(this);
141 apacheStartSFE.setPreferenceStore(getPreferenceStore());
142 apacheStartSFE.load();
143 new Label(apacheSettingsGroup, SWT.NONE);
145 apacheStopBFE = new BooleanFieldEditor(ExternalToolsPlugin.APACHE_STOP_BACKGROUND, PHPPreferencesMessages
146 .getString("PHPBasePreferencePage.apacheGroup.stop_background"), apacheSettingsGroup);
147 apacheStopBFE.setPreferencePage(this);
148 apacheStopBFE.setPreferenceStore(getPreferenceStore());
149 apacheStopBFE.load();
150 new Label(apacheSettingsGroup, SWT.NONE);
151 new Label(apacheSettingsGroup, SWT.NONE);
152 apacheStopSFE = new StringFieldEditor(ExternalToolsPlugin.APACHE_STOP_PREF, PHPPreferencesMessages
153 .getString("PHPBasePreferencePage.apacheGroup.stop"), apacheSettingsGroup);
154 apacheStopSFE.setPreferencePage(this);
155 apacheStopSFE.setPreferenceStore(getPreferenceStore());
156 apacheStopSFE.load();
157 new Label(apacheSettingsGroup, SWT.NONE);
159 apacheRestartBFE = new BooleanFieldEditor(ExternalToolsPlugin.APACHE_RESTART_BACKGROUND, PHPPreferencesMessages
160 .getString("PHPBasePreferencePage.apacheGroup.restart_background"), apacheSettingsGroup);
161 apacheRestartBFE.setPreferencePage(this);
162 apacheRestartBFE.setPreferenceStore(getPreferenceStore());
163 apacheRestartBFE.load();
164 new Label(apacheSettingsGroup, SWT.NONE);
165 new Label(apacheSettingsGroup, SWT.NONE);
166 apacheRestartSFE = new StringFieldEditor(ExternalToolsPlugin.APACHE_RESTART_PREF, PHPPreferencesMessages
167 .getString("PHPBasePreferencePage.apacheGroup.restart"), apacheSettingsGroup);
168 apacheRestartSFE.setPreferencePage(this);
169 apacheRestartSFE.setPreferenceStore(getPreferenceStore());
170 apacheRestartSFE.load();
171 new Label(apacheSettingsGroup, SWT.NONE);
173 apacheRunFFE = new FileFieldEditor(ExternalToolsPlugin.APACHE_RUN_PREF, PHPPreferencesMessages
174 .getString("PHPBasePreferencePage.apacheGroup.run"), apacheSettingsGroup);
175 apacheRunFFE.setPreferencePage(this);
176 apacheRunFFE.setPreferenceStore(getPreferenceStore());
179 phpRunFFE = new FileFieldEditor(ExternalToolsPlugin.PHP_RUN_PREF, PHPPreferencesMessages
180 .getString("PHPBasePreferencePage.console.php"), apacheSettingsGroup);
181 phpRunFFE.setPreferencePage(this);
182 phpRunFFE.setPreferenceStore(getPreferenceStore());
186 Composite mySQLSettingsComposite = new Composite(composite, SWT.NULL);
187 mySQLSettingsComposite.setLayout(new GridLayout());
188 mySQLSettingsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
190 Group mySQLSettingsGroup = new Group(mySQLSettingsComposite, SWT.NONE);
191 mySQLSettingsGroup.setText(PHPPreferencesMessages.getString("PHPBasePreferencePage.mySQLGroup"));
192 mySQLSettingsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
193 mySQLSettingsGroup.setLayout(new GridLayout());
195 mysqlStartBFE = new BooleanFieldEditor(ExternalToolsPlugin.MYSQL_START_BACKGROUND, PHPPreferencesMessages
196 .getString("PHPBasePreferencePage.mySQLGroup.start_background"), mySQLSettingsGroup);
197 mysqlStartBFE.setPreferencePage(this);
198 mysqlStartBFE.setPreferenceStore(getPreferenceStore());
199 mysqlStartBFE.load();
200 new Label(mySQLSettingsGroup, SWT.NONE);
201 new Label(mySQLSettingsGroup, SWT.NONE);
203 mySQLCommandSFE = new StringFieldEditor(ExternalToolsPlugin.MYSQL_PREF, PHPPreferencesMessages
204 .getString("PHPBasePreferencePage.mySQLGroup.command"), mySQLSettingsGroup);
205 mySQLCommandSFE.setPreferencePage(this);
206 mySQLCommandSFE.setPreferenceStore(getPreferenceStore());
207 mySQLCommandSFE.load();
208 new Label(mySQLSettingsGroup, SWT.NONE);
210 mysqlRunFFE = new FileFieldEditor(ExternalToolsPlugin.MYSQL_RUN_PREF, PHPPreferencesMessages
211 .getString("PHPBasePreferencePage.mySQLGroup.run"), mySQLSettingsGroup);
212 mysqlRunFFE.setPreferencePage(this);
213 mysqlRunFFE.setPreferenceStore(getPreferenceStore());
216 Composite parserSettingsComposite = new Composite(composite, SWT.NULL);
217 parserSettingsComposite.setLayout(new GridLayout());
218 parserSettingsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
220 Group parserSettingsGroup = new Group(parserSettingsComposite, SWT.NONE);
221 parserSettingsGroup.setText("External parser command");
222 parserSettingsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
223 parserSettingsGroup.setLayout(new GridLayout());
226 new StringFieldEditor(
227 ExternalToolsPlugin.EXTERNAL_PARSER_PREF,
228 PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.extcommand"),
231 externalParserSFE.setPreferencePage(this);
232 externalParserSFE.setPreferenceStore(getPreferenceStore());
233 externalParserSFE.load();