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 FileFieldEditor httpdConfFFE;
44 FileFieldEditor etcHostsFFE;
46 BooleanFieldEditor apacheStartBFE;
48 BooleanFieldEditor apacheStopBFE;
50 BooleanFieldEditor apacheRestartBFE;
52 BooleanFieldEditor mysqlStartBFE;
54 public PHPExternalToolsPreferencePage() {
56 setPreferenceStore(ExternalToolsPlugin.getDefault().getPreferenceStore());
57 setDescription(PHPPreferencesMessages.getString("PHPBasePreferencePage.description")); //$NON-NLS-1$
60 public void init(IWorkbench workbench) {
63 protected void performDefaults() {
64 // phpParserExtensionsSFE.loadDefault();
65 xamppStartSFE.loadDefault();
66 xamppStopSFE.loadDefault();
67 apacheStartSFE.loadDefault();
68 apacheStopSFE.loadDefault();
69 apacheRestartSFE.loadDefault();
70 mySQLCommandSFE.loadDefault();
71 externalParserSFE.loadDefault();
72 phpRunFFE.loadDefault();
73 apacheRunFFE.loadDefault();
74 httpdConfFFE.loadDefault();
75 etcHostsFFE.loadDefault();
76 mysqlRunFFE.loadDefault();
77 apacheStartBFE.loadDefault();
78 apacheStopBFE.loadDefault();
79 apacheRestartBFE.loadDefault();
80 mysqlStartBFE.loadDefault();
81 super.performDefaults();
84 public boolean performOk() {
85 // PHPFileUtil.setExtensions(null);
86 // phpParserExtensionsSFE.store();
87 xamppStartSFE.store();
89 apacheStartSFE.store();
90 apacheStopSFE.store();
91 apacheRestartSFE.store();
92 mySQLCommandSFE.store();
93 externalParserSFE.store();
100 apacheStartBFE.store();
101 apacheStopBFE.store();
102 apacheRestartBFE.store();
103 mysqlStartBFE.store();
104 return super.performOk();
107 protected Control createContents(Composite parent) {
108 initializeDialogUnits(parent);
109 final IPreferenceStore store = ExternalToolsPlugin.getDefault().getPreferenceStore();
110 Composite composite = new Composite(parent, SWT.LEFT);
111 composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
112 composite.setLayout(new GridLayout());
115 Composite apacheSettingsComposite = new Composite(composite, SWT.NULL);
116 apacheSettingsComposite.setLayout(new GridLayout());
117 apacheSettingsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
118 Group apacheSettingsGroup = new Group(apacheSettingsComposite, SWT.NONE);
119 apacheSettingsGroup.setText(PHPPreferencesMessages.getString("PHPBasePreferencePage.apacheGroup"));
120 apacheSettingsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
121 apacheSettingsGroup.setLayout(new GridLayout());
124 xamppStartSFE = new StringFieldEditor(ExternalToolsPlugin.XAMPP_START_PREF, PHPPreferencesMessages
125 .getString("PHPBasePreferencePage.apacheGroup.xampp_start"), apacheSettingsGroup);
126 xamppStartSFE.setPage(this);
127 xamppStartSFE.setPreferenceStore(getPreferenceStore());
128 xamppStartSFE.load();
129 new Label(apacheSettingsGroup, SWT.NONE);
131 xamppStopSFE = new StringFieldEditor(ExternalToolsPlugin.XAMPP_STOP_PREF, PHPPreferencesMessages
132 .getString("PHPBasePreferencePage.apacheGroup.xampp_stop"), apacheSettingsGroup);
133 xamppStopSFE.setPage(this);
134 xamppStopSFE.setPreferenceStore(getPreferenceStore());
136 new Label(apacheSettingsGroup, SWT.NONE);
138 apacheStartBFE = new BooleanFieldEditor(ExternalToolsPlugin.APACHE_START_BACKGROUND, PHPPreferencesMessages
139 .getString("PHPBasePreferencePage.apacheGroup.start_background"), apacheSettingsGroup);
140 apacheStartBFE.setPage(this);
141 apacheStartBFE.setPreferenceStore(getPreferenceStore());
142 apacheStartBFE.load();
144 new Label(apacheSettingsGroup, SWT.NONE);
145 new Label(apacheSettingsGroup, SWT.NONE);
146 apacheStartSFE = new StringFieldEditor(ExternalToolsPlugin.APACHE_START_PREF, PHPPreferencesMessages
147 .getString("PHPBasePreferencePage.apacheGroup.start"), apacheSettingsGroup);
148 apacheStartSFE.setPage(this);
149 apacheStartSFE.setPreferenceStore(getPreferenceStore());
150 apacheStartSFE.load();
151 new Label(apacheSettingsGroup, SWT.NONE);
153 apacheStopBFE = new BooleanFieldEditor(ExternalToolsPlugin.APACHE_STOP_BACKGROUND, PHPPreferencesMessages
154 .getString("PHPBasePreferencePage.apacheGroup.stop_background"), apacheSettingsGroup);
155 apacheStopBFE.setPage(this);
156 apacheStopBFE.setPreferenceStore(getPreferenceStore());
157 apacheStopBFE.load();
158 new Label(apacheSettingsGroup, SWT.NONE);
159 new Label(apacheSettingsGroup, SWT.NONE);
160 apacheStopSFE = new StringFieldEditor(ExternalToolsPlugin.APACHE_STOP_PREF, PHPPreferencesMessages
161 .getString("PHPBasePreferencePage.apacheGroup.stop"), apacheSettingsGroup);
162 apacheStopSFE.setPage(this);
163 apacheStopSFE.setPreferenceStore(getPreferenceStore());
164 apacheStopSFE.load();
165 new Label(apacheSettingsGroup, SWT.NONE);
167 apacheRestartBFE = new BooleanFieldEditor(ExternalToolsPlugin.APACHE_RESTART_BACKGROUND, PHPPreferencesMessages
168 .getString("PHPBasePreferencePage.apacheGroup.restart_background"), apacheSettingsGroup);
169 apacheRestartBFE.setPage(this);
170 apacheRestartBFE.setPreferenceStore(getPreferenceStore());
171 apacheRestartBFE.load();
172 new Label(apacheSettingsGroup, SWT.NONE);
173 new Label(apacheSettingsGroup, SWT.NONE);
174 apacheRestartSFE = new StringFieldEditor(ExternalToolsPlugin.APACHE_RESTART_PREF, PHPPreferencesMessages
175 .getString("PHPBasePreferencePage.apacheGroup.restart"), apacheSettingsGroup);
176 apacheRestartSFE.setPage(this);
177 apacheRestartSFE.setPreferenceStore(getPreferenceStore());
178 apacheRestartSFE.load();
179 new Label(apacheSettingsGroup, SWT.NONE);
181 apacheRunFFE = new FileFieldEditor(ExternalToolsPlugin.APACHE_RUN_PREF, PHPPreferencesMessages
182 .getString("PHPBasePreferencePage.apacheGroup.run"), apacheSettingsGroup);
183 apacheRunFFE.setPage(this);
184 apacheRunFFE.setPreferenceStore(getPreferenceStore());
187 httpdConfFFE = new FileFieldEditor(ExternalToolsPlugin.HTTPD_CONF_PATH_PREF,
188 "Path to httpd.conf:", apacheSettingsGroup);
189 httpdConfFFE.setPage(this);
190 httpdConfFFE.setPreferenceStore(getPreferenceStore());
193 etcHostsFFE = new FileFieldEditor(ExternalToolsPlugin.ETC_HOSTS_PATH_PREF,
194 "Path to etc/hosts:", apacheSettingsGroup);
195 etcHostsFFE.setPage(this);
196 etcHostsFFE.setPreferenceStore(getPreferenceStore());
199 phpRunFFE = new FileFieldEditor(ExternalToolsPlugin.PHP_RUN_PREF, PHPPreferencesMessages
200 .getString("PHPBasePreferencePage.console.php"), apacheSettingsGroup);
201 phpRunFFE.setPage(this);
202 phpRunFFE.setPreferenceStore(getPreferenceStore());
206 Composite mySQLSettingsComposite = new Composite(composite, SWT.NULL);
207 mySQLSettingsComposite.setLayout(new GridLayout());
208 mySQLSettingsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
210 Group mySQLSettingsGroup = new Group(mySQLSettingsComposite, SWT.NONE);
211 mySQLSettingsGroup.setText(PHPPreferencesMessages.getString("PHPBasePreferencePage.mySQLGroup"));
212 mySQLSettingsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
213 mySQLSettingsGroup.setLayout(new GridLayout());
215 mysqlStartBFE = new BooleanFieldEditor(ExternalToolsPlugin.MYSQL_START_BACKGROUND, PHPPreferencesMessages
216 .getString("PHPBasePreferencePage.mySQLGroup.start_background"), mySQLSettingsGroup);
217 mysqlStartBFE.setPage(this);
218 mysqlStartBFE.setPreferenceStore(getPreferenceStore());
219 mysqlStartBFE.load();
220 new Label(mySQLSettingsGroup, SWT.NONE);
221 new Label(mySQLSettingsGroup, SWT.NONE);
223 mySQLCommandSFE = new StringFieldEditor(ExternalToolsPlugin.MYSQL_PREF, PHPPreferencesMessages
224 .getString("PHPBasePreferencePage.mySQLGroup.command"), mySQLSettingsGroup);
225 mySQLCommandSFE.setPage(this);
226 mySQLCommandSFE.setPreferenceStore(getPreferenceStore());
227 mySQLCommandSFE.load();
228 new Label(mySQLSettingsGroup, SWT.NONE);
230 mysqlRunFFE = new FileFieldEditor(ExternalToolsPlugin.MYSQL_RUN_PREF, PHPPreferencesMessages
231 .getString("PHPBasePreferencePage.mySQLGroup.run"), mySQLSettingsGroup);
232 mysqlRunFFE.setPage(this);
233 mysqlRunFFE.setPreferenceStore(getPreferenceStore());
236 Composite parserSettingsComposite = new Composite(composite, SWT.NULL);
237 parserSettingsComposite.setLayout(new GridLayout());
238 parserSettingsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
240 Group parserSettingsGroup = new Group(parserSettingsComposite, SWT.NONE);
241 parserSettingsGroup.setText("External parser command");
242 parserSettingsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
243 parserSettingsGroup.setLayout(new GridLayout());
246 new StringFieldEditor(
247 ExternalToolsPlugin.EXTERNAL_PARSER_PREF,
248 PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.extcommand"),
251 externalParserSFE.setPage(this);
252 externalParserSFE.setPreferenceStore(getPreferenceStore());
253 externalParserSFE.load();