|
Lines 15-27
Link Here
|
| 15 |
* 20070402 180622 brockj@tpg.com.au - Brock Janiczak, Inconsistent enablement states in network preference page |
15 |
* 20070402 180622 brockj@tpg.com.au - Brock Janiczak, Inconsistent enablement states in network preference page |
| 16 |
* 20070416 177897 ymnk@jcraft.com - Atsuhiko Yamanaka, Improve UI of Proxy Preferences Page |
16 |
* 20070416 177897 ymnk@jcraft.com - Atsuhiko Yamanaka, Improve UI of Proxy Preferences Page |
| 17 |
* 20070801 197977 holger.oehm@sap.com - Holger Oehm, [Proxy] non-proxy hosts not correctly updated |
17 |
* 20070801 197977 holger.oehm@sap.com - Holger Oehm, [Proxy] non-proxy hosts not correctly updated |
|
|
18 |
* 20080424 228739 francisu@ieee.org - Francis Upton (Oakland Software), dialog for system prop values |
| 18 |
*******************************************************************************/ |
19 |
*******************************************************************************/ |
| 19 |
package org.eclipse.ui.internal.net; |
20 |
package org.eclipse.ui.internal.net; |
| 20 |
|
21 |
|
|
|
22 |
import org.eclipse.core.internal.net.ProxyData; |
| 23 |
import org.eclipse.core.internal.net.ProxyManager; |
| 21 |
import org.eclipse.core.net.proxy.IProxyData; |
24 |
import org.eclipse.core.net.proxy.IProxyData; |
| 22 |
import org.eclipse.core.net.proxy.IProxyService; |
25 |
import org.eclipse.core.net.proxy.IProxyService; |
| 23 |
import org.eclipse.core.runtime.CoreException; |
26 |
import org.eclipse.core.runtime.CoreException; |
|
|
27 |
import org.eclipse.jface.dialogs.Dialog; |
| 24 |
import org.eclipse.jface.dialogs.ErrorDialog; |
28 |
import org.eclipse.jface.dialogs.ErrorDialog; |
|
|
29 |
import org.eclipse.jface.dialogs.IDialogConstants; |
| 25 |
import org.eclipse.jface.preference.PreferencePage; |
30 |
import org.eclipse.jface.preference.PreferencePage; |
| 26 |
import org.eclipse.swt.SWT; |
31 |
import org.eclipse.swt.SWT; |
| 27 |
import org.eclipse.swt.events.ModifyEvent; |
32 |
import org.eclipse.swt.events.ModifyEvent; |
|
Lines 34-39
Link Here
|
| 34 |
import org.eclipse.swt.widgets.Composite; |
39 |
import org.eclipse.swt.widgets.Composite; |
| 35 |
import org.eclipse.swt.widgets.Control; |
40 |
import org.eclipse.swt.widgets.Control; |
| 36 |
import org.eclipse.swt.widgets.Label; |
41 |
import org.eclipse.swt.widgets.Label; |
|
|
42 |
import org.eclipse.swt.widgets.Shell; |
| 37 |
import org.eclipse.swt.widgets.Text; |
43 |
import org.eclipse.swt.widgets.Text; |
| 38 |
import org.eclipse.ui.IWorkbench; |
44 |
import org.eclipse.ui.IWorkbench; |
| 39 |
import org.eclipse.ui.IWorkbenchPreferencePage; |
45 |
import org.eclipse.ui.IWorkbenchPreferencePage; |
|
Lines 46-54
Link Here
|
| 46 |
= "org.eclipse.ui.net.proxy_preference_page_context"; //$NON-NLS-1$ |
52 |
= "org.eclipse.ui.net.proxy_preference_page_context"; //$NON-NLS-1$ |
| 47 |
|
53 |
|
| 48 |
Entry[] entryList; |
54 |
Entry[] entryList; |
|
|
55 |
Button systemProxyConfigurationButton; |
| 49 |
Button directConnectionToButton; |
56 |
Button directConnectionToButton; |
| 50 |
Button manualProxyConfigurationButton; |
57 |
Button manualProxyConfigurationButton; |
| 51 |
Button useSameProxyButton; |
58 |
Button useSameProxyButton; |
|
|
59 |
Button showSystemProxyConfigButton; |
| 52 |
private Label nonHostLabel; |
60 |
private Label nonHostLabel; |
| 53 |
private NonProxyHostsComposite nonHostComposite; |
61 |
private NonProxyHostsComposite nonHostComposite; |
| 54 |
Button enableProxyAuth; |
62 |
Button enableProxyAuth; |
|
Lines 57-63
Link Here
|
| 57 |
Text userid; |
65 |
Text userid; |
| 58 |
Text password; |
66 |
Text password; |
| 59 |
private IProxyService proxyService; |
67 |
private IProxyService proxyService; |
| 60 |
Button systemProxyConfigurationButton; |
|
|
| 61 |
|
68 |
|
| 62 |
public ProxyPreferencePage() { |
69 |
public ProxyPreferencePage() { |
| 63 |
super(NetUIMessages.ProxyPreferencePage_2); |
70 |
super(NetUIMessages.ProxyPreferencePage_2); |
|
Lines 84-113
Link Here
|
| 84 |
entryList[i] = new Entry(pd); |
91 |
entryList[i] = new Entry(pd); |
| 85 |
} |
92 |
} |
| 86 |
|
93 |
|
| 87 |
Composite composite = new Composite(parent, SWT.NONE); |
94 |
final Composite composite = new Composite(parent, SWT.NONE); |
| 88 |
GridLayout layout = new GridLayout(); |
95 |
GridLayout layout = new GridLayout(); |
| 89 |
layout.numColumns = 1; |
96 |
layout.numColumns = 1; |
| 90 |
layout.marginRight = 5; |
97 |
layout.marginRight = 5; |
| 91 |
layout.marginTop = 5; |
98 |
layout.marginTop = 5; |
| 92 |
layout.marginWidth = 0; |
99 |
layout.marginWidth = 0; |
| 93 |
composite.setLayout(layout); |
100 |
composite.setLayout(layout); |
| 94 |
GridData data = new GridData(GridData.FILL_BOTH); |
101 |
composite.setLayoutData(new GridData(GridData.FILL_BOTH)); |
| 95 |
composite.setLayoutData(data); |
|
|
| 96 |
|
102 |
|
| 97 |
systemProxyConfigurationButton = new Button(composite, SWT.RADIO); |
103 |
Composite sysComposite = new Composite(composite, SWT.NONE); |
| 98 |
systemProxyConfigurationButton.setLayoutData(new GridData()); |
104 |
layout = new GridLayout(); |
| 99 |
systemProxyConfigurationButton.setText(NetUIMessages.ProxyPreferencePage_44); |
105 |
layout.numColumns = 2; |
|
|
106 |
layout.marginTop = 0; |
| 107 |
layout.marginBottom = 0; |
| 108 |
layout.marginWidth = 0; |
| 109 |
sysComposite.setLayout(layout); |
| 110 |
sysComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); |
| 111 |
|
| 112 |
systemProxyConfigurationButton = new Button(sysComposite, SWT.RADIO); |
| 113 |
systemProxyConfigurationButton.setLayoutData(new GridData( |
| 114 |
GridData.HORIZONTAL_ALIGN_BEGINNING, |
| 115 |
GridData.VERTICAL_ALIGN_BEGINNING, true, false)); |
| 116 |
systemProxyConfigurationButton |
| 117 |
.setText(NetUIMessages.ProxyPreferencePage_44); |
| 100 |
systemProxyConfigurationButton |
118 |
systemProxyConfigurationButton |
| 101 |
.setToolTipText(NetUIMessages.ProxyPreferencePage_45); |
119 |
.setToolTipText(NetUIMessages.ProxyPreferencePage_45); |
| 102 |
systemProxyConfigurationButton.addSelectionListener(new SelectionAdapter() { |
120 |
systemProxyConfigurationButton |
| 103 |
public void widgetSelected(SelectionEvent e) { |
121 |
.addSelectionListener(new SelectionAdapter() { |
| 104 |
if (systemProxyConfigurationButton.getSelection()) |
122 |
public void widgetSelected(SelectionEvent e) { |
| 105 |
enableControls(false); |
123 |
if (systemProxyConfigurationButton.getSelection()) |
| 106 |
} |
124 |
enableControls(false); |
| 107 |
}); |
125 |
} |
|
|
126 |
}); |
| 108 |
|
127 |
|
| 109 |
directConnectionToButton = new Button(composite, SWT.RADIO); |
128 |
showSystemProxyConfigButton = new Button(sysComposite, SWT.PUSH); |
| 110 |
directConnectionToButton.setLayoutData(new GridData()); |
129 |
showSystemProxyConfigButton.setLayoutData(new GridData( |
|
|
130 |
GridData.HORIZONTAL_ALIGN_END, |
| 131 |
GridData.VERTICAL_ALIGN_BEGINNING, false, false)); |
| 132 |
showSystemProxyConfigButton |
| 133 |
.setText(NetUIMessages.ProxyPreferencePage_showSystemConfig_button); |
| 134 |
showSystemProxyConfigButton |
| 135 |
.setToolTipText(NetUIMessages.ProxyPreferencePage_showSystemConfig_tooltip); |
| 136 |
showSystemProxyConfigButton |
| 137 |
.addSelectionListener(new SelectionAdapter() { |
| 138 |
public void widgetSelected(SelectionEvent e) { |
| 139 |
showSystemProxyInfo(composite.getShell()); |
| 140 |
} |
| 141 |
}); |
| 142 |
|
| 143 |
directConnectionToButton = new Button(sysComposite, SWT.RADIO); |
| 144 |
directConnectionToButton.setLayoutData(new GridData( |
| 145 |
GridData.HORIZONTAL_ALIGN_BEGINNING, |
| 146 |
GridData.VERTICAL_ALIGN_BEGINNING, true, false, 2, 1)); |
| 111 |
directConnectionToButton.setText(NetUIMessages.ProxyPreferencePage_3); |
147 |
directConnectionToButton.setText(NetUIMessages.ProxyPreferencePage_3); |
| 112 |
directConnectionToButton |
148 |
directConnectionToButton |
| 113 |
.setToolTipText(NetUIMessages.ProxyPreferencePage_1); |
149 |
.setToolTipText(NetUIMessages.ProxyPreferencePage_1); |
|
Lines 118-134
Link Here
|
| 118 |
} |
154 |
} |
| 119 |
}); |
155 |
}); |
| 120 |
|
156 |
|
| 121 |
manualProxyConfigurationButton = new Button(composite, SWT.RADIO); |
157 |
manualProxyConfigurationButton = new Button(sysComposite, SWT.RADIO); |
|
|
158 |
manualProxyConfigurationButton.setLayoutData(new GridData( |
| 159 |
GridData.HORIZONTAL_ALIGN_BEGINNING, |
| 160 |
GridData.VERTICAL_ALIGN_BEGINNING, true, false, 2, 1)); |
| 122 |
manualProxyConfigurationButton |
161 |
manualProxyConfigurationButton |
| 123 |
.setText(NetUIMessages.ProxyPreferencePage_4); |
162 |
.setText(NetUIMessages.ProxyPreferencePage_4); |
| 124 |
manualProxyConfigurationButton |
163 |
manualProxyConfigurationButton |
| 125 |
.setToolTipText(NetUIMessages.ProxyPreferencePage_0); |
164 |
.setToolTipText(NetUIMessages.ProxyPreferencePage_0); |
| 126 |
manualProxyConfigurationButton.addSelectionListener(new SelectionAdapter() { |
165 |
manualProxyConfigurationButton |
| 127 |
public void widgetSelected(SelectionEvent e) { |
166 |
.addSelectionListener(new SelectionAdapter() { |
| 128 |
if (manualProxyConfigurationButton.getSelection()) |
167 |
public void widgetSelected(SelectionEvent e) { |
| 129 |
enableControls(true); |
168 |
if (manualProxyConfigurationButton.getSelection()) |
| 130 |
} |
169 |
enableControls(true); |
| 131 |
}); |
170 |
} |
|
|
171 |
}); |
| 132 |
|
172 |
|
| 133 |
final Composite manualProxyConfigurationComposite = new Composite( |
173 |
final Composite manualProxyConfigurationComposite = new Composite( |
| 134 |
composite, SWT.NONE); |
174 |
composite, SWT.NONE); |
|
Lines 231-236
Link Here
|
| 231 |
return composite; |
271 |
return composite; |
| 232 |
} |
272 |
} |
| 233 |
|
273 |
|
|
|
274 |
protected void showSystemProxyInfo(Shell shell) { |
| 275 |
final ProxyData[] pds = ((ProxyManager) ProxyManager.getProxyManager()).getSystemProxyData(); |
| 276 |
|
| 277 |
Dialog dialog = new Dialog(shell) { |
| 278 |
protected boolean isResizable() { |
| 279 |
return true; |
| 280 |
} |
| 281 |
|
| 282 |
protected Control createDialogArea(Composite parent) { |
| 283 |
Composite c = (Composite) super.createDialogArea(parent); |
| 284 |
|
| 285 |
GridLayout layout = new GridLayout(); |
| 286 |
layout.numColumns = 2; |
| 287 |
layout.marginTop = 5; |
| 288 |
layout.marginBottom = 5; |
| 289 |
layout.marginWidth = 10; |
| 290 |
c.setLayout(layout); |
| 291 |
c.setLayoutData(new GridData(GridData.FILL_BOTH)); |
| 292 |
|
| 293 |
Label l; |
| 294 |
|
| 295 |
if (pds.length == 0) { |
| 296 |
l = new Label(c, SWT.NONE); |
| 297 |
l |
| 298 |
.setText(NetUIMessages.ProxyPreferencePage_showConfigDialog_None); |
| 299 |
l.setLayoutData(new GridData( |
| 300 |
GridData.HORIZONTAL_ALIGN_BEGINNING, |
| 301 |
GridData.VERTICAL_ALIGN_BEGINNING, false, false, 2, |
| 302 |
1)); |
| 303 |
return c; |
| 304 |
} |
| 305 |
|
| 306 |
l = new Label(c, SWT.NONE); |
| 307 |
l.setText(NetUIMessages.ProxyPreferencePage_showConfigDialogTitle); |
| 308 |
l.setLayoutData(new GridData( |
| 309 |
GridData.HORIZONTAL_ALIGN_BEGINNING, |
| 310 |
GridData.VERTICAL_ALIGN_BEGINNING, false, false, 2, 1)); |
| 311 |
|
| 312 |
l = new Label(c, SWT.NONE); |
| 313 |
l = new Label(c, SWT.NONE); |
| 314 |
|
| 315 |
l = new Label(c, SWT.NONE); |
| 316 |
l |
| 317 |
.setText(NetUIMessages.ProxyPreferencePage_showConfigDialog_Protocol); |
| 318 |
l = new Label(c, SWT.NONE); |
| 319 |
l |
| 320 |
.setText(NetUIMessages.ProxyPreferencePage_showConfigDialog_SourceValue); |
| 321 |
|
| 322 |
for (int i = 0; i < pds.length; i++) { |
| 323 |
l = new Label(c, SWT.NONE); |
| 324 |
l.setText(pds[i].getType()); |
| 325 |
l = new Label(c, SWT.NONE); |
| 326 |
l.setText(pds[i].getSource()); |
| 327 |
|
| 328 |
l = new Label(c, SWT.NONE); |
| 329 |
l.setText(""); //$NON-NLS-1$ |
| 330 |
l = new Label(c, SWT.NONE); |
| 331 |
l.setText(buildLabelString(pds[i])); |
| 332 |
} |
| 333 |
return c; |
| 334 |
} |
| 335 |
|
| 336 |
protected String buildLabelString(ProxyData pd) { |
| 337 |
StringBuffer sb = new StringBuffer(); |
| 338 |
sb.append(pd.getHost()); |
| 339 |
if (pd.getPort() != 0) { |
| 340 |
sb.append(":"); //$NON-NLS-1$ |
| 341 |
sb.append(pd.getPort()); |
| 342 |
} |
| 343 |
if (pd.getUserId() != null) { |
| 344 |
sb.append(" "); //$NON-NLS-1$ |
| 345 |
sb.append(NetUIMessages.ProxyPreferencePage_showConfigDialog_User); |
| 346 |
sb.append(" "); //$NON-NLS-1$ |
| 347 |
sb.append(pd.getUserId()); |
| 348 |
if (pd.getPassword() != null) { |
| 349 |
sb.append(" "); //$NON-NLS-1$ |
| 350 |
sb.append(NetUIMessages.ProxyPreferencePage_showConfigDialog_Password); |
| 351 |
sb.append(" "); //$NON-NLS-1$ |
| 352 |
sb.append(pd.getPassword()); |
| 353 |
} |
| 354 |
} |
| 355 |
return sb.toString(); |
| 356 |
} |
| 357 |
|
| 358 |
protected void configureShell(Shell shell) { |
| 359 |
super.configureShell(shell); |
| 360 |
shell.setText("System Proxy Configuration"); //$NON-NLS-1$ |
| 361 |
} |
| 362 |
|
| 363 |
protected void createButtonsForButtonBar(Composite parent) { |
| 364 |
createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, |
| 365 |
true); |
| 366 |
} |
| 367 |
|
| 368 |
}; |
| 369 |
|
| 370 |
dialog.open(); |
| 371 |
} |
| 372 |
|
| 234 |
protected void performApply() { |
373 |
protected void performApply() { |
| 235 |
if (proxyService == null) |
374 |
if (proxyService == null) |
| 236 |
return; |
375 |
return; |