1) Open port 7869 for dbg communication if we run a non remote debug session, as...
[phpeclipse.git] / net.sourceforge.phpeclipse.externaltools / src / net / sourceforge / phpdt / externaltools / preferences / ApachePrefencePage.java
1 package net.sourceforge.phpdt.externaltools.preferences;
2
3 import net.sourceforge.phpeclipse.externaltools.ExternalToolsPlugin;
4
5 import org.eclipse.jface.preference.BooleanFieldEditor;
6 import org.eclipse.jface.preference.FileFieldEditor;
7 import org.eclipse.jface.preference.PreferencePage;
8 import org.eclipse.jface.preference.StringFieldEditor;
9 import org.eclipse.swt.SWT;
10 import org.eclipse.swt.layout.GridData;
11 import org.eclipse.swt.layout.GridLayout;
12 import org.eclipse.swt.widgets.Composite;
13 import org.eclipse.swt.widgets.Control;
14 import org.eclipse.swt.widgets.Label;
15 import org.eclipse.ui.IWorkbench;
16 import org.eclipse.ui.IWorkbenchPreferencePage;
17
18 public class ApachePrefencePage extends PreferencePage implements
19                 IWorkbenchPreferencePage {
20
21         StringFieldEditor apacheStartSFE;
22
23         StringFieldEditor apacheStopSFE;
24
25         StringFieldEditor apacheRestartSFE;
26
27         FileFieldEditor apacheRunFFE;
28
29         FileFieldEditor httpdConfFFE;
30
31         FileFieldEditor etcHostsFFE;
32
33         BooleanFieldEditor apacheStartBFE;
34
35         BooleanFieldEditor apacheStopBFE;
36
37         BooleanFieldEditor apacheRestartBFE;
38
39         public ApachePrefencePage() {
40                 super();
41                 setPreferenceStore(ExternalToolsPlugin.getDefault()
42                                 .getPreferenceStore());
43         }
44
45         protected Control createContents(Composite parent) {
46                 initializeDialogUnits(parent);
47                 Composite composite = new Composite(parent, SWT.LEFT);
48                 composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
49                 composite.setLayout(new GridLayout());
50
51                 apacheStartSFE = new StringFieldEditor(
52                                 ExternalToolsPlugin.APACHE_START_PREF, PHPPreferencesMessages
53                                                 .getString("PHPBasePreferencePage.apacheGroup.start"),
54                                                 composite);
55                 apacheStartSFE.setPage(this);
56                 apacheStartSFE.setPreferenceStore(getPreferenceStore());
57                 apacheStartSFE.load();
58                 new Label(composite, SWT.NONE);
59
60                 new Label(composite, SWT.NONE);
61                 apacheStartBFE = new BooleanFieldEditor(
62                                 ExternalToolsPlugin.APACHE_START_BACKGROUND,
63                                 PHPPreferencesMessages
64                                                 .getString("PHPBasePreferencePage.apacheGroup.start_background"),
65                                                 composite);
66                 apacheStartBFE.setPage(this);
67                 apacheStartBFE.setPreferenceStore(getPreferenceStore());
68                 apacheStartBFE.load();
69                 new Label(composite, SWT.NONE);
70
71
72                 apacheStopSFE = new StringFieldEditor(
73                                 ExternalToolsPlugin.APACHE_STOP_PREF, PHPPreferencesMessages
74                                                 .getString("PHPBasePreferencePage.apacheGroup.stop"),
75                                                 composite);
76                 apacheStopSFE.setPage(this);
77                 apacheStopSFE.setPreferenceStore(getPreferenceStore());
78                 apacheStopSFE.load();
79                 new Label(composite, SWT.NONE);
80
81                 new Label(composite, SWT.NONE);
82                 apacheStopBFE = new BooleanFieldEditor(
83                                 ExternalToolsPlugin.APACHE_STOP_BACKGROUND,
84                                 PHPPreferencesMessages
85                                                 .getString("PHPBasePreferencePage.apacheGroup.stop_background"),
86                                                 composite);
87                 apacheStopBFE.setPage(this);
88                 apacheStopBFE.setPreferenceStore(getPreferenceStore());
89                 apacheStopBFE.load();
90                 new Label(composite, SWT.NONE);
91
92
93                 apacheRestartSFE = new StringFieldEditor(
94                                 ExternalToolsPlugin.APACHE_RESTART_PREF,
95                                 PHPPreferencesMessages
96                                                 .getString("PHPBasePreferencePage.apacheGroup.restart"),
97                                                 composite);
98                 apacheRestartSFE.setPage(this);
99                 apacheRestartSFE.setPreferenceStore(getPreferenceStore());
100                 apacheRestartSFE.load();
101                 new Label(composite, SWT.NONE);
102
103                 new Label(composite, SWT.NONE);
104                 apacheRestartBFE = new BooleanFieldEditor(
105                                 ExternalToolsPlugin.APACHE_RESTART_BACKGROUND,
106                                 PHPPreferencesMessages
107                                                 .getString("PHPBasePreferencePage.apacheGroup.restart_background"),
108                                                 composite);
109                 apacheRestartBFE.setPage(this);
110                 apacheRestartBFE.setPreferenceStore(getPreferenceStore());
111                 apacheRestartBFE.load();
112                 new Label(composite, SWT.NONE);
113
114
115                 apacheRunFFE = new FileFieldEditor(ExternalToolsPlugin.APACHE_RUN_PREF,
116                                 PHPPreferencesMessages
117                                                 .getString("PHPBasePreferencePage.apacheGroup.run"),
118                                                 composite);
119                 apacheRunFFE.setPage(this);
120                 apacheRunFFE.setPreferenceStore(getPreferenceStore());
121                 apacheRunFFE.load();
122
123                 httpdConfFFE = new FileFieldEditor(
124                                 ExternalToolsPlugin.HTTPD_CONF_PATH_PREF,
125                                 "Path to httpd.conf:", composite);
126                 httpdConfFFE.setPage(this);
127                 httpdConfFFE.setPreferenceStore(getPreferenceStore());
128                 httpdConfFFE.load();
129
130                 etcHostsFFE = new FileFieldEditor(
131                                 ExternalToolsPlugin.ETC_HOSTS_PATH_PREF, "Path to etc/hosts:",
132                                 composite);
133                 etcHostsFFE.setPage(this);
134                 etcHostsFFE.setPreferenceStore(getPreferenceStore());
135                 etcHostsFFE.load();
136
137                 return composite;
138         }
139
140         public void init(IWorkbench workbench) {
141         }
142
143         protected void performDefaults() {
144                 apacheStartSFE.loadDefault();
145                 apacheStopSFE.loadDefault();
146                 apacheRestartSFE.loadDefault();
147                 apacheRunFFE.loadDefault();
148                 httpdConfFFE.loadDefault();
149                 etcHostsFFE.loadDefault();
150                 apacheStartBFE.loadDefault();
151                 apacheStopBFE.loadDefault();
152                 apacheRestartBFE.loadDefault();
153                 super.performDefaults();
154         }
155
156         public boolean performOk() {
157                 apacheStartSFE.store();
158                 apacheStopSFE.store();
159                 apacheRestartSFE.store();
160                 apacheRunFFE.store();
161                 httpdConfFFE.store();
162                 etcHostsFFE.store();
163                 apacheStartBFE.store();
164                 apacheStopBFE.store();
165                 apacheRestartBFE.store();
166                 return super.performOk();
167         }
168
169 }