Refactory: externaltools plugin.
[phpeclipse.git] / net.sourceforge.phpeclipse.externaltools / src / net / sourceforge / phpdt / externaltools / preferences / XamppPrefencePage.java
1 package net.sourceforge.phpdt.externaltools.preferences;
2
3 import net.sourceforge.phpeclipse.externaltools.ExternalToolsPlugin;
4
5 import org.eclipse.jface.preference.FileFieldEditor;
6 import org.eclipse.jface.preference.PreferencePage;
7 import org.eclipse.swt.SWT;
8 import org.eclipse.swt.layout.GridData;
9 import org.eclipse.swt.layout.GridLayout;
10 import org.eclipse.swt.widgets.Composite;
11 import org.eclipse.swt.widgets.Control;
12 import org.eclipse.ui.IWorkbench;
13 import org.eclipse.ui.IWorkbenchPreferencePage;
14
15 public class XamppPrefencePage extends PreferencePage implements
16                 IWorkbenchPreferencePage {
17
18         FileFieldEditor xamppStartSFE;
19
20         FileFieldEditor xamppStopSFE;
21
22         public XamppPrefencePage() {
23                 super();
24                 setPreferenceStore(ExternalToolsPlugin.getDefault()
25                                 .getPreferenceStore());
26         }
27
28         protected Control createContents(Composite parent) {
29                 initializeDialogUnits(parent);
30                 Composite composite = new Composite(parent, SWT.LEFT);
31                 composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
32                 composite.setLayout(new GridLayout());
33
34                 xamppStartSFE = new FileFieldEditor(
35                                 ExternalToolsPlugin.XAMPP_START_PREF,
36                                 PHPPreferencesMessages
37                                                 .getString("PHPBasePreferencePage.apacheGroup.xampp_start"),
38                                 composite);
39                 xamppStartSFE.setPage(this);
40                 xamppStartSFE.setPreferenceStore(getPreferenceStore());
41                 xamppStartSFE.load();
42
43                 xamppStopSFE = new FileFieldEditor(
44                                 ExternalToolsPlugin.XAMPP_STOP_PREF,
45                                 PHPPreferencesMessages
46                                                 .getString("PHPBasePreferencePage.apacheGroup.xampp_stop"),
47                                 composite);
48                 xamppStopSFE.setPage(this);
49                 xamppStopSFE.setPreferenceStore(getPreferenceStore());
50                 xamppStopSFE.load();
51                 return composite;
52         }
53
54         public void init(IWorkbench workbench) {
55         }
56
57         protected void performDefaults() {
58                 xamppStartSFE.loadDefault();
59                 xamppStopSFE.loadDefault();
60                 super.performDefaults();
61         }
62
63         public boolean performOk() {
64                 xamppStartSFE.store();
65                 xamppStopSFE.store();
66                 return super.performOk();
67         }
68
69 }