|
Lines 57-62
Link Here
|
| 57 |
Text userid; |
57 |
Text userid; |
| 58 |
Text password; |
58 |
Text password; |
| 59 |
private IProxyService proxyService; |
59 |
private IProxyService proxyService; |
|
|
60 |
Button systemProxyConfigurationButton; |
| 60 |
|
61 |
|
| 61 |
public ProxyPreferencePage() { |
62 |
public ProxyPreferencePage() { |
| 62 |
super(NetUIMessages.ProxyPreferencePage_2); |
63 |
super(NetUIMessages.ProxyPreferencePage_2); |
|
Lines 93-98
Link Here
|
| 93 |
GridData data = new GridData(GridData.FILL_BOTH); |
94 |
GridData data = new GridData(GridData.FILL_BOTH); |
| 94 |
composite.setLayoutData(data); |
95 |
composite.setLayoutData(data); |
| 95 |
|
96 |
|
|
|
97 |
systemProxyConfigurationButton = new Button(composite, SWT.RADIO); |
| 98 |
systemProxyConfigurationButton.setLayoutData(new GridData()); |
| 99 |
systemProxyConfigurationButton.setText(NetUIMessages.ProxyPreferencePage_44); |
| 100 |
systemProxyConfigurationButton |
| 101 |
.setToolTipText(NetUIMessages.ProxyPreferencePage_45); |
| 102 |
systemProxyConfigurationButton.addSelectionListener(new SelectionAdapter() { |
| 103 |
public void widgetSelected(SelectionEvent e) { |
| 104 |
enableControls(!systemProxyConfigurationButton.getSelection()); |
| 105 |
} |
| 106 |
}); |
| 107 |
|
| 96 |
directConnectionToButton = new Button(composite, SWT.RADIO); |
108 |
directConnectionToButton = new Button(composite, SWT.RADIO); |
| 97 |
directConnectionToButton.setLayoutData(new GridData()); |
109 |
directConnectionToButton.setLayoutData(new GridData()); |
| 98 |
directConnectionToButton.setText(NetUIMessages.ProxyPreferencePage_3); |
110 |
directConnectionToButton.setText(NetUIMessages.ProxyPreferencePage_3); |
|
Lines 201-207
Link Here
|
| 201 |
entryList[0].hostname.addModifyListener(modifyListener); |
213 |
entryList[0].hostname.addModifyListener(modifyListener); |
| 202 |
entryList[0].port.addModifyListener(modifyListener); |
214 |
entryList[0].port.addModifyListener(modifyListener); |
| 203 |
|
215 |
|
| 204 |
initializeValues(proxyService.isProxiesEnabled()); |
216 |
initializeValues(proxyService.isProxiesEnabled() , proxyService.isSystemProxiesEnabled()); |
| 205 |
applyDialogFont(composite); |
217 |
applyDialogFont(composite); |
| 206 |
|
218 |
|
| 207 |
// F1 |
219 |
// F1 |
|
Lines 214-220
Link Here
|
| 214 |
protected void performApply() { |
226 |
protected void performApply() { |
| 215 |
if (proxyService == null) |
227 |
if (proxyService == null) |
| 216 |
return; |
228 |
return; |
| 217 |
boolean proxiesEnabled = manualProxyConfigurationButton.getSelection(); |
229 |
boolean manualProxiesEnabled = manualProxyConfigurationButton.getSelection(); |
|
|
230 |
boolean systemProxiesEnabled = systemProxyConfigurationButton.getSelection(); |
| 218 |
|
231 |
|
| 219 |
// Save the contents of the text fields to the proxy data. |
232 |
// Save the contents of the text fields to the proxy data. |
| 220 |
IProxyData[] proxyData = new IProxyData[entryList.length]; |
233 |
IProxyData[] proxyData = new IProxyData[entryList.length]; |
|
Lines 223-230
Link Here
|
| 223 |
proxyData[index] = entryList[index].getProxy(); |
236 |
proxyData[index] = entryList[index].getProxy(); |
| 224 |
} |
237 |
} |
| 225 |
|
238 |
|
| 226 |
proxyService.setProxiesEnabled(proxiesEnabled); |
239 |
proxyService.setProxiesEnabled(manualProxiesEnabled || systemProxiesEnabled); |
| 227 |
if (proxiesEnabled) { |
240 |
|
|
|
241 |
if (manualProxiesEnabled) { |
| 228 |
try { |
242 |
try { |
| 229 |
proxyService.setNonProxiedHosts( |
243 |
proxyService.setNonProxiedHosts( |
| 230 |
nonHostComposite.getList()); |
244 |
nonHostComposite.getList()); |
|
Lines 233-243
Link Here
|
| 233 |
ErrorDialog.openError(getShell(), null, null, e.getStatus()); |
247 |
ErrorDialog.openError(getShell(), null, null, e.getStatus()); |
| 234 |
} |
248 |
} |
| 235 |
} |
249 |
} |
|
|
250 |
|
| 251 |
proxyService.setSystemProxiesEnabled(systemProxiesEnabled); |
| 252 |
|
| 236 |
Activator.getDefault().savePluginPreferences(); |
253 |
Activator.getDefault().savePluginPreferences(); |
| 237 |
} |
254 |
} |
| 238 |
|
255 |
|
| 239 |
protected void performDefaults() { |
256 |
protected void performDefaults() { |
| 240 |
directConnectionToButton.setSelection(true); |
257 |
directConnectionToButton.setSelection(true); |
|
|
258 |
systemProxyConfigurationButton.setSelection(false); |
| 241 |
manualProxyConfigurationButton.setSelection(false); |
259 |
manualProxyConfigurationButton.setSelection(false); |
| 242 |
useSameProxyButton.setSelection(false); |
260 |
useSameProxyButton.setSelection(false); |
| 243 |
enableProxyAuth.setSelection(false); |
261 |
enableProxyAuth.setSelection(false); |
|
Lines 263-279
Link Here
|
| 263 |
* |
281 |
* |
| 264 |
* @param proxiesEnabled indicates if manual proxies are enabled or not. |
282 |
* @param proxiesEnabled indicates if manual proxies are enabled or not. |
| 265 |
*/ |
283 |
*/ |
| 266 |
private void initializeValues(boolean proxiesEnabled) { |
284 |
private void initializeValues(boolean proxiesEnabled, boolean systemProxiesEnabled) { |
| 267 |
|
|
|
| 268 |
directConnectionToButton.setSelection(!proxiesEnabled); |
285 |
directConnectionToButton.setSelection(!proxiesEnabled); |
| 269 |
manualProxyConfigurationButton.setSelection(proxiesEnabled); |
286 |
manualProxyConfigurationButton.setSelection(proxiesEnabled && !systemProxiesEnabled); |
|
|
287 |
systemProxyConfigurationButton.setSelection(proxiesEnabled && systemProxiesEnabled); |
| 288 |
|
| 270 |
|
289 |
|
| 271 |
String[] nonHostLists = null; |
290 |
String[] nonHostLists = null; |
| 272 |
if (proxyService != null) |
291 |
if (proxyService != null) |
| 273 |
nonHostLists = proxyService.getNonProxiedHosts(); |
292 |
nonHostLists = proxyService.getNonProxiedHosts(); |
| 274 |
this.nonHostComposite.setList(nonHostLists == null ? new String[] { |
293 |
this.nonHostComposite.setList(nonHostLists == null ? new String[] { |
| 275 |
"localhost", "127.0.0.1" } : nonHostLists); //$NON-NLS-1$ //$NON-NLS-2$ |
294 |
"localhost", "127.0.0.1" } : nonHostLists); //$NON-NLS-1$ //$NON-NLS-2$ |
| 276 |
if (!proxiesEnabled) { |
295 |
if (proxiesEnabled && !systemProxiesEnabled) { |
| 277 |
this.useSameProxyButton.setSelection(false); |
296 |
this.useSameProxyButton.setSelection(false); |
| 278 |
this.enableProxyAuth.setSelection(false); |
297 |
this.enableProxyAuth.setSelection(false); |
| 279 |
this.userid.setText(""); //$NON-NLS-1$ |
298 |
this.userid.setText(""); //$NON-NLS-1$ |
|
Lines 311-320
Link Here
|
| 311 |
for (int index = 1; index < entryList.length; index++) { |
330 |
for (int index = 1; index < entryList.length; index++) { |
| 312 |
Entry entry = entryList[index]; |
331 |
Entry entry = entryList[index]; |
| 313 |
entry.loadPreviousValues(); |
332 |
entry.loadPreviousValues(); |
| 314 |
entry.updateEnablement(proxiesEnabled, useSameProtocol); |
333 |
entry.updateEnablement(proxiesEnabled && !systemProxiesEnabled, useSameProtocol); |
| 315 |
} |
334 |
} |
| 316 |
|
335 |
|
| 317 |
enableControls(proxiesEnabled); |
336 |
enableControls(proxiesEnabled && !systemProxiesEnabled); |
| 318 |
} |
337 |
} |
| 319 |
|
338 |
|
| 320 |
void enableControls(boolean enabled) { |
339 |
void enableControls(boolean enabled) { |