|
Lines 1-5
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2007 IBM Corporation and others. |
2 |
* Copyright (c) 2007, 2008 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
|
Lines 47-53
Link Here
|
| 47 |
|
47 |
|
| 48 |
Entry[] entryList; |
48 |
Entry[] entryList; |
| 49 |
Button directConnectionToButton; |
49 |
Button directConnectionToButton; |
| 50 |
private Button manualProxyConfigurationButton; |
50 |
Button manualProxyConfigurationButton; |
| 51 |
Button useSameProxyButton; |
51 |
Button useSameProxyButton; |
| 52 |
private Label nonHostLabel; |
52 |
private Label nonHostLabel; |
| 53 |
private NonProxyHostsComposite nonHostComposite; |
53 |
private NonProxyHostsComposite nonHostComposite; |
|
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 |
if (systemProxyConfigurationButton.getSelection()) |
| 105 |
enableControls(false); |
| 106 |
} |
| 107 |
}); |
| 108 |
|
| 96 |
directConnectionToButton = new Button(composite, SWT.RADIO); |
109 |
directConnectionToButton = new Button(composite, SWT.RADIO); |
| 97 |
directConnectionToButton.setLayoutData(new GridData()); |
110 |
directConnectionToButton.setLayoutData(new GridData()); |
| 98 |
directConnectionToButton.setText(NetUIMessages.ProxyPreferencePage_3); |
111 |
directConnectionToButton.setText(NetUIMessages.ProxyPreferencePage_3); |
|
Lines 100-106
Link Here
|
| 100 |
.setToolTipText(NetUIMessages.ProxyPreferencePage_1); |
113 |
.setToolTipText(NetUIMessages.ProxyPreferencePage_1); |
| 101 |
directConnectionToButton.addSelectionListener(new SelectionAdapter() { |
114 |
directConnectionToButton.addSelectionListener(new SelectionAdapter() { |
| 102 |
public void widgetSelected(SelectionEvent e) { |
115 |
public void widgetSelected(SelectionEvent e) { |
| 103 |
enableControls(!directConnectionToButton.getSelection()); |
116 |
if (directConnectionToButton.getSelection()) |
|
|
117 |
enableControls(false); |
| 104 |
} |
118 |
} |
| 105 |
}); |
119 |
}); |
| 106 |
|
120 |
|
|
Lines 109-114
Link Here
|
| 109 |
.setText(NetUIMessages.ProxyPreferencePage_4); |
123 |
.setText(NetUIMessages.ProxyPreferencePage_4); |
| 110 |
manualProxyConfigurationButton |
124 |
manualProxyConfigurationButton |
| 111 |
.setToolTipText(NetUIMessages.ProxyPreferencePage_0); |
125 |
.setToolTipText(NetUIMessages.ProxyPreferencePage_0); |
|
|
126 |
manualProxyConfigurationButton.addSelectionListener(new SelectionAdapter() { |
| 127 |
public void widgetSelected(SelectionEvent e) { |
| 128 |
if (manualProxyConfigurationButton.getSelection()) |
| 129 |
enableControls(true); |
| 130 |
} |
| 131 |
}); |
| 112 |
|
132 |
|
| 113 |
final Composite manualProxyConfigurationComposite = new Composite( |
133 |
final Composite manualProxyConfigurationComposite = new Composite( |
| 114 |
composite, SWT.NONE); |
134 |
composite, SWT.NONE); |
|
Lines 201-207
Link Here
|
| 201 |
entryList[0].hostname.addModifyListener(modifyListener); |
221 |
entryList[0].hostname.addModifyListener(modifyListener); |
| 202 |
entryList[0].port.addModifyListener(modifyListener); |
222 |
entryList[0].port.addModifyListener(modifyListener); |
| 203 |
|
223 |
|
| 204 |
initializeValues(proxyService.isProxiesEnabled()); |
224 |
initializeValues(proxyService.isProxiesEnabled() , proxyService.isSystemProxiesEnabled()); |
| 205 |
applyDialogFont(composite); |
225 |
applyDialogFont(composite); |
| 206 |
|
226 |
|
| 207 |
// F1 |
227 |
// F1 |
|
Lines 214-220
Link Here
|
| 214 |
protected void performApply() { |
234 |
protected void performApply() { |
| 215 |
if (proxyService == null) |
235 |
if (proxyService == null) |
| 216 |
return; |
236 |
return; |
| 217 |
boolean proxiesEnabled = manualProxyConfigurationButton.getSelection(); |
237 |
boolean manualProxiesEnabled = manualProxyConfigurationButton.getSelection(); |
|
|
238 |
boolean systemProxiesEnabled = systemProxyConfigurationButton.getSelection(); |
| 218 |
|
239 |
|
| 219 |
// Save the contents of the text fields to the proxy data. |
240 |
// Save the contents of the text fields to the proxy data. |
| 220 |
IProxyData[] proxyData = new IProxyData[entryList.length]; |
241 |
IProxyData[] proxyData = new IProxyData[entryList.length]; |
|
Lines 223-230
Link Here
|
| 223 |
proxyData[index] = entryList[index].getProxy(); |
244 |
proxyData[index] = entryList[index].getProxy(); |
| 224 |
} |
245 |
} |
| 225 |
|
246 |
|
| 226 |
proxyService.setProxiesEnabled(proxiesEnabled); |
247 |
proxyService.setProxiesEnabled(manualProxiesEnabled || systemProxiesEnabled); |
| 227 |
if (proxiesEnabled) { |
248 |
|
|
|
249 |
if (manualProxiesEnabled) { |
| 228 |
try { |
250 |
try { |
| 229 |
proxyService.setNonProxiedHosts( |
251 |
proxyService.setNonProxiedHosts( |
| 230 |
nonHostComposite.getList()); |
252 |
nonHostComposite.getList()); |
|
Lines 233-243
Link Here
|
| 233 |
ErrorDialog.openError(getShell(), null, null, e.getStatus()); |
255 |
ErrorDialog.openError(getShell(), null, null, e.getStatus()); |
| 234 |
} |
256 |
} |
| 235 |
} |
257 |
} |
|
|
258 |
|
| 259 |
proxyService.setSystemProxiesEnabled(systemProxiesEnabled); |
| 260 |
|
| 236 |
Activator.getDefault().savePluginPreferences(); |
261 |
Activator.getDefault().savePluginPreferences(); |
| 237 |
} |
262 |
} |
| 238 |
|
263 |
|
| 239 |
protected void performDefaults() { |
264 |
protected void performDefaults() { |
| 240 |
directConnectionToButton.setSelection(true); |
265 |
directConnectionToButton.setSelection(true); |
|
|
266 |
systemProxyConfigurationButton.setSelection(false); |
| 241 |
manualProxyConfigurationButton.setSelection(false); |
267 |
manualProxyConfigurationButton.setSelection(false); |
| 242 |
useSameProxyButton.setSelection(false); |
268 |
useSameProxyButton.setSelection(false); |
| 243 |
enableProxyAuth.setSelection(false); |
269 |
enableProxyAuth.setSelection(false); |
|
Lines 263-279
Link Here
|
| 263 |
* |
289 |
* |
| 264 |
* @param proxiesEnabled indicates if manual proxies are enabled or not. |
290 |
* @param proxiesEnabled indicates if manual proxies are enabled or not. |
| 265 |
*/ |
291 |
*/ |
| 266 |
private void initializeValues(boolean proxiesEnabled) { |
292 |
private void initializeValues(boolean proxiesEnabled, boolean systemProxiesEnabled) { |
| 267 |
|
|
|
| 268 |
directConnectionToButton.setSelection(!proxiesEnabled); |
293 |
directConnectionToButton.setSelection(!proxiesEnabled); |
| 269 |
manualProxyConfigurationButton.setSelection(proxiesEnabled); |
294 |
manualProxyConfigurationButton.setSelection(proxiesEnabled && !systemProxiesEnabled); |
|
|
295 |
systemProxyConfigurationButton.setSelection(proxiesEnabled && systemProxiesEnabled); |
| 296 |
|
| 270 |
|
297 |
|
| 271 |
String[] nonHostLists = null; |
298 |
String[] nonHostLists = null; |
| 272 |
if (proxyService != null) |
299 |
if (proxyService != null) |
| 273 |
nonHostLists = proxyService.getNonProxiedHosts(); |
300 |
nonHostLists = proxyService.getNonProxiedHosts(); |
| 274 |
this.nonHostComposite.setList(nonHostLists == null ? new String[] { |
301 |
this.nonHostComposite.setList(nonHostLists == null ? new String[] { |
| 275 |
"localhost", "127.0.0.1" } : nonHostLists); //$NON-NLS-1$ //$NON-NLS-2$ |
302 |
"localhost", "127.0.0.1" } : nonHostLists); //$NON-NLS-1$ //$NON-NLS-2$ |
| 276 |
if (!proxiesEnabled) { |
303 |
if (proxiesEnabled && !systemProxiesEnabled) { |
| 277 |
this.useSameProxyButton.setSelection(false); |
304 |
this.useSameProxyButton.setSelection(false); |
| 278 |
this.enableProxyAuth.setSelection(false); |
305 |
this.enableProxyAuth.setSelection(false); |
| 279 |
this.userid.setText(""); //$NON-NLS-1$ |
306 |
this.userid.setText(""); //$NON-NLS-1$ |
|
Lines 311-320
Link Here
|
| 311 |
for (int index = 1; index < entryList.length; index++) { |
338 |
for (int index = 1; index < entryList.length; index++) { |
| 312 |
Entry entry = entryList[index]; |
339 |
Entry entry = entryList[index]; |
| 313 |
entry.loadPreviousValues(); |
340 |
entry.loadPreviousValues(); |
| 314 |
entry.updateEnablement(proxiesEnabled, useSameProtocol); |
341 |
entry.updateEnablement(proxiesEnabled && !systemProxiesEnabled, useSameProtocol); |
| 315 |
} |
342 |
} |
| 316 |
|
343 |
|
| 317 |
enableControls(proxiesEnabled); |
344 |
enableControls(proxiesEnabled && !systemProxiesEnabled); |
| 318 |
} |
345 |
} |
| 319 |
|
346 |
|
| 320 |
void enableControls(boolean enabled) { |
347 |
void enableControls(boolean enabled) { |