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());
106 // allowed PHP file extensions for parsing
107 Composite phpParserExtensionsComposite = new Composite(composite, SWT.NULL);
108 phpParserExtensionsComposite.setLayout(new GridLayout());
109 phpParserExtensionsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
110 // phpParserExtensionsSFE = new StringFieldEditor(IPreferenceConstants.PHP_EXTENSION_PREFS, PHPPreferencesMessages
111 // .getString("PHPBasePreferencePage.phpExtensionPrefs"), phpParserExtensionsComposite);
112 // phpParserExtensionsSFE.setPreferencePage(this);
113 // phpParserExtensionsSFE.setPreferenceStore(getPreferenceStore());
114 // phpParserExtensionsSFE.load();
117 Composite apacheSettingsComposite = new Composite(composite, SWT.NULL);
118 apacheSettingsComposite.setLayout(new GridLayout());
119 apacheSettingsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
120 Group apacheSettingsGroup = new Group(apacheSettingsComposite, SWT.NONE);
121 apacheSettingsGroup.setText(PHPPreferencesMessages.getString("PHPBasePreferencePage.apacheGroup"));
122 apacheSettingsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
123 apacheSettingsGroup.setLayout(new GridLayout());
126 xamppStartSFE = new StringFieldEditor(ExternalToolsPlugin.XAMPP_START_PREF, PHPPreferencesMessages
127 .getString("PHPBasePreferencePage.apacheGroup.xampp_start"), apacheSettingsGroup);
128 xamppStartSFE.setPreferencePage(this);
129 xamppStartSFE.setPreferenceStore(getPreferenceStore());
130 xamppStartSFE.load();
131 new Label(apacheSettingsGroup, SWT.NONE);
133 xamppStopSFE = new StringFieldEditor(ExternalToolsPlugin.XAMPP_STOP_PREF, PHPPreferencesMessages
134 .getString("PHPBasePreferencePage.apacheGroup.xampp_stop"), apacheSettingsGroup);
135 xamppStopSFE.setPreferencePage(this);
136 xamppStopSFE.setPreferenceStore(getPreferenceStore());
138 new Label(apacheSettingsGroup, SWT.NONE);
140 apacheStartBFE = new BooleanFieldEditor(ExternalToolsPlugin.APACHE_START_BACKGROUND, PHPPreferencesMessages
141 .getString("PHPBasePreferencePage.apacheGroup.start_background"), apacheSettingsGroup);
142 apacheStartBFE.setPreferencePage(this);
143 apacheStartBFE.setPreferenceStore(getPreferenceStore());
144 apacheStartBFE.load();
146 new Label(apacheSettingsGroup, SWT.NONE);
147 new Label(apacheSettingsGroup, SWT.NONE);
148 apacheStartSFE = new StringFieldEditor(ExternalToolsPlugin.APACHE_START_PREF, PHPPreferencesMessages
149 .getString("PHPBasePreferencePage.apacheGroup.start"), apacheSettingsGroup);
150 apacheStartSFE.setPreferencePage(this);
151 apacheStartSFE.setPreferenceStore(getPreferenceStore());
152 apacheStartSFE.load();
153 new Label(apacheSettingsGroup, SWT.NONE);
155 apacheStopBFE = new BooleanFieldEditor(ExternalToolsPlugin.APACHE_STOP_BACKGROUND, PHPPreferencesMessages
156 .getString("PHPBasePreferencePage.apacheGroup.stop_background"), apacheSettingsGroup);
157 apacheStopBFE.setPreferencePage(this);
158 apacheStopBFE.setPreferenceStore(getPreferenceStore());
159 apacheStopBFE.load();
160 new Label(apacheSettingsGroup, SWT.NONE);
161 new Label(apacheSettingsGroup, SWT.NONE);
162 apacheStopSFE = new StringFieldEditor(ExternalToolsPlugin.APACHE_STOP_PREF, PHPPreferencesMessages
163 .getString("PHPBasePreferencePage.apacheGroup.stop"), apacheSettingsGroup);
164 apacheStopSFE.setPreferencePage(this);
165 apacheStopSFE.setPreferenceStore(getPreferenceStore());
166 apacheStopSFE.load();
167 new Label(apacheSettingsGroup, SWT.NONE);
169 apacheRestartBFE = new BooleanFieldEditor(ExternalToolsPlugin.APACHE_RESTART_BACKGROUND, PHPPreferencesMessages
170 .getString("PHPBasePreferencePage.apacheGroup.restart_background"), apacheSettingsGroup);
171 apacheRestartBFE.setPreferencePage(this);
172 apacheRestartBFE.setPreferenceStore(getPreferenceStore());
173 apacheRestartBFE.load();
174 new Label(apacheSettingsGroup, SWT.NONE);
175 new Label(apacheSettingsGroup, SWT.NONE);
176 apacheRestartSFE = new StringFieldEditor(ExternalToolsPlugin.APACHE_RESTART_PREF, PHPPreferencesMessages
177 .getString("PHPBasePreferencePage.apacheGroup.restart"), apacheSettingsGroup);
178 apacheRestartSFE.setPreferencePage(this);
179 apacheRestartSFE.setPreferenceStore(getPreferenceStore());
180 apacheRestartSFE.load();
181 new Label(apacheSettingsGroup, SWT.NONE);
183 apacheRunFFE = new FileFieldEditor(ExternalToolsPlugin.APACHE_RUN_PREF, PHPPreferencesMessages
184 .getString("PHPBasePreferencePage.apacheGroup.run"), apacheSettingsGroup);
185 apacheRunFFE.setPreferencePage(this);
186 apacheRunFFE.setPreferenceStore(getPreferenceStore());
189 phpRunFFE = new FileFieldEditor(ExternalToolsPlugin.PHP_RUN_PREF, PHPPreferencesMessages
190 .getString("PHPBasePreferencePage.console.php"), apacheSettingsGroup);
191 phpRunFFE.setPreferencePage(this);
192 phpRunFFE.setPreferenceStore(getPreferenceStore());
196 Composite mySQLSettingsComposite = new Composite(composite, SWT.NULL);
197 mySQLSettingsComposite.setLayout(new GridLayout());
198 mySQLSettingsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
200 Group mySQLSettingsGroup = new Group(mySQLSettingsComposite, SWT.NONE);
201 mySQLSettingsGroup.setText(PHPPreferencesMessages.getString("PHPBasePreferencePage.mySQLGroup"));
202 mySQLSettingsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
203 mySQLSettingsGroup.setLayout(new GridLayout());
205 mysqlStartBFE = new BooleanFieldEditor(ExternalToolsPlugin.MYSQL_START_BACKGROUND, PHPPreferencesMessages
206 .getString("PHPBasePreferencePage.mySQLGroup.start_background"), mySQLSettingsGroup);
207 mysqlStartBFE.setPreferencePage(this);
208 mysqlStartBFE.setPreferenceStore(getPreferenceStore());
209 mysqlStartBFE.load();
210 new Label(mySQLSettingsGroup, SWT.NONE);
211 new Label(mySQLSettingsGroup, SWT.NONE);
213 mySQLCommandSFE = new StringFieldEditor(ExternalToolsPlugin.MYSQL_PREF, PHPPreferencesMessages
214 .getString("PHPBasePreferencePage.mySQLGroup.command"), mySQLSettingsGroup);
215 mySQLCommandSFE.setPreferencePage(this);
216 mySQLCommandSFE.setPreferenceStore(getPreferenceStore());
217 mySQLCommandSFE.load();
218 new Label(mySQLSettingsGroup, SWT.NONE);
220 mysqlRunFFE = new FileFieldEditor(ExternalToolsPlugin.MYSQL_RUN_PREF, PHPPreferencesMessages
221 .getString("PHPBasePreferencePage.mySQLGroup.run"), mySQLSettingsGroup);
222 mysqlRunFFE.setPreferencePage(this);
223 mysqlRunFFE.setPreferenceStore(getPreferenceStore());
226 Composite parserSettingsComposite = new Composite(composite, SWT.NULL);
227 parserSettingsComposite.setLayout(new GridLayout());
228 parserSettingsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
230 Group parserSettingsGroup = new Group(parserSettingsComposite, SWT.NONE);
231 parserSettingsGroup.setText("External parser command");
232 parserSettingsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
233 parserSettingsGroup.setLayout(new GridLayout());
236 new StringFieldEditor(
237 ExternalToolsPlugin.EXTERNAL_PARSER_PREF,
238 PHPPreferencesMessages.getString("PHPBasePreferencePage.parsers.extcommand"),
241 externalParserSFE.setPreferencePage(this);
242 externalParserSFE.setPreferenceStore(getPreferenceStore());
243 externalParserSFE.load();