1 package net.sourceforge.phpeclipse;
3 import net.sourceforge.phpeclipse.preferences.PHPPreferencesMessages;
5 import org.eclipse.jface.preference.BooleanFieldEditor;
6 import org.eclipse.jface.preference.DirectoryFieldEditor;
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 PHPEclipseBasePreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
23 StringFieldEditor apacheStartSFE;
25 StringFieldEditor apacheStopSFE;
27 StringFieldEditor apacheRestartSFE;
29 StringFieldEditor mySQLCommandSFE;
31 FileFieldEditor apacheRunFFE;
33 FileFieldEditor mysqlRunFFE;
35 FileFieldEditor phpRunFFE;
37 BooleanFieldEditor apacheStartBFE;
39 BooleanFieldEditor apacheStopBFE;
41 BooleanFieldEditor apacheRestartBFE;
43 BooleanFieldEditor mysqlStartBFE;
45 public PHPEclipseBasePreferencePage() {
47 setPreferenceStore(PHPeclipsePlugin.getDefault().getPreferenceStore());
48 setDescription(PHPPreferencesMessages.getString("PHPBasePreferencePage.description")); //$NON-NLS-1$
51 public void init(IWorkbench workbench) {
54 protected void performDefaults() {
55 apacheStartSFE.loadDefault();
56 apacheStopSFE.loadDefault();
57 apacheRestartSFE.loadDefault();
58 mySQLCommandSFE.loadDefault();
59 phpRunFFE.loadDefault();
60 apacheRunFFE.loadDefault();
61 mysqlRunFFE.loadDefault();
62 apacheStartBFE.loadDefault();
63 apacheStopBFE.loadDefault();
64 apacheRestartBFE.loadDefault();
65 mysqlStartBFE.loadDefault();
66 super.performDefaults();
69 public boolean performOk() {
71 apacheStartSFE.store();
72 apacheStopSFE.store();
73 apacheRestartSFE.store();
74 mySQLCommandSFE.store();
79 apacheStartBFE.store();
80 apacheStopBFE.store();
81 apacheRestartBFE.store();
82 mysqlStartBFE.store();
83 return super.performOk();
86 protected Control createContents(Composite parent) {
87 initializeDialogUnits(parent);
88 final IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore();
89 Composite composite = new Composite(parent, SWT.LEFT);
90 composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
91 composite.setLayout(new GridLayout());
94 Composite apacheSettingsComposite = new Composite(composite, SWT.NULL);
95 apacheSettingsComposite.setLayout(new GridLayout());
96 apacheSettingsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
97 Group apacheSettingsGroup = new Group(apacheSettingsComposite, SWT.NONE);
98 apacheSettingsGroup.setText(PHPPreferencesMessages.getString("PHPBasePreferencePage.apacheGroup"));
99 apacheSettingsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
100 apacheSettingsGroup.setLayout(new GridLayout());
102 apacheStartBFE = new BooleanFieldEditor(PHPeclipsePlugin.APACHE_START_BACKGROUND, PHPPreferencesMessages
103 .getString("PHPBasePreferencePage.apacheGroup.start_background"), apacheSettingsGroup);
104 apacheStartBFE.setPreferencePage(this);
105 apacheStartBFE.setPreferenceStore(getPreferenceStore());
106 apacheStartBFE.load();
108 new Label(apacheSettingsGroup, SWT.NONE);
109 new Label(apacheSettingsGroup, SWT.NONE);
110 apacheStartSFE = new StringFieldEditor(IPreferenceConstants.APACHE_START_PREF, PHPPreferencesMessages
111 .getString("PHPBasePreferencePage.apacheGroup.start"), apacheSettingsGroup);
112 apacheStartSFE.setPreferencePage(this);
113 apacheStartSFE.setPreferenceStore(getPreferenceStore());
114 apacheStartSFE.load();
115 new Label(apacheSettingsGroup, SWT.NONE);
117 apacheStopBFE = new BooleanFieldEditor(PHPeclipsePlugin.APACHE_STOP_BACKGROUND, PHPPreferencesMessages
118 .getString("PHPBasePreferencePage.apacheGroup.stop_background"), apacheSettingsGroup);
119 apacheStopBFE.setPreferencePage(this);
120 apacheStopBFE.setPreferenceStore(getPreferenceStore());
121 apacheStopBFE.load();
122 new Label(apacheSettingsGroup, SWT.NONE);
123 new Label(apacheSettingsGroup, SWT.NONE);
124 apacheStopSFE = new StringFieldEditor(IPreferenceConstants.APACHE_STOP_PREF, PHPPreferencesMessages
125 .getString("PHPBasePreferencePage.apacheGroup.stop"), apacheSettingsGroup);
126 apacheStopSFE.setPreferencePage(this);
127 apacheStopSFE.setPreferenceStore(getPreferenceStore());
128 apacheStopSFE.load();
129 new Label(apacheSettingsGroup, SWT.NONE);
131 apacheRestartBFE = new BooleanFieldEditor(PHPeclipsePlugin.APACHE_RESTART_BACKGROUND, PHPPreferencesMessages
132 .getString("PHPBasePreferencePage.apacheGroup.restart_background"), apacheSettingsGroup);
133 apacheRestartBFE.setPreferencePage(this);
134 apacheRestartBFE.setPreferenceStore(getPreferenceStore());
135 apacheRestartBFE.load();
136 new Label(apacheSettingsGroup, SWT.NONE);
137 new Label(apacheSettingsGroup, SWT.NONE);
138 apacheRestartSFE = new StringFieldEditor(IPreferenceConstants.APACHE_RESTART_PREF, PHPPreferencesMessages
139 .getString("PHPBasePreferencePage.apacheGroup.restart"), apacheSettingsGroup);
140 apacheRestartSFE.setPreferencePage(this);
141 apacheRestartSFE.setPreferenceStore(getPreferenceStore());
142 apacheRestartSFE.load();
143 new Label(apacheSettingsGroup, SWT.NONE);
145 apacheRunFFE = new FileFieldEditor(IPreferenceConstants.APACHE_RUN_PREF, PHPPreferencesMessages
146 .getString("PHPBasePreferencePage.apacheGroup.run"), apacheSettingsGroup);
147 apacheRunFFE.setPreferencePage(this);
148 apacheRunFFE.setPreferenceStore(getPreferenceStore());
151 phpRunFFE = new FileFieldEditor(IPreferenceConstants.PHP_RUN_PREF, PHPPreferencesMessages
152 .getString("PHPBasePreferencePage.console.php"), apacheSettingsGroup);
153 phpRunFFE.setPreferencePage(this);
154 phpRunFFE.setPreferenceStore(getPreferenceStore());
158 Composite mySQLSettingsComposite = new Composite(composite, SWT.NULL);
159 mySQLSettingsComposite.setLayout(new GridLayout());
160 mySQLSettingsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
162 Group mySQLSettingsGroup = new Group(mySQLSettingsComposite, SWT.NONE);
163 mySQLSettingsGroup.setText(PHPPreferencesMessages.getString("PHPBasePreferencePage.mySQLGroup"));
164 mySQLSettingsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
165 mySQLSettingsGroup.setLayout(new GridLayout());
167 mysqlStartBFE = new BooleanFieldEditor(PHPeclipsePlugin.MYSQL_START_BACKGROUND, PHPPreferencesMessages
168 .getString("PHPBasePreferencePage.mySQLGroup.start_background"), mySQLSettingsGroup);
169 mysqlStartBFE.setPreferencePage(this);
170 mysqlStartBFE.setPreferenceStore(getPreferenceStore());
171 mysqlStartBFE.load();
172 new Label(mySQLSettingsGroup, SWT.NONE);
173 new Label(mySQLSettingsGroup, SWT.NONE);
175 mySQLCommandSFE = new StringFieldEditor(IPreferenceConstants.MYSQL_PREF, PHPPreferencesMessages
176 .getString("PHPBasePreferencePage.mySQLGroup.command"), mySQLSettingsGroup);
177 mySQLCommandSFE.setPreferencePage(this);
178 mySQLCommandSFE.setPreferenceStore(getPreferenceStore());
179 mySQLCommandSFE.load();
180 new Label(mySQLSettingsGroup, SWT.NONE);
182 mysqlRunFFE = new FileFieldEditor(IPreferenceConstants.MYSQL_RUN_PREF, PHPPreferencesMessages
183 .getString("PHPBasePreferencePage.mySQLGroup.run"), mySQLSettingsGroup);
184 mysqlRunFFE.setPreferencePage(this);
185 mysqlRunFFE.setPreferenceStore(getPreferenceStore());