Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 228739 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/ui/internal/net/messages.properties (-2 / +10 lines)
Lines 10-15 Link Here
10
# yyyymmdd bug      Email and other contact information
10
# yyyymmdd bug      Email and other contact information
11
# -------- -------- -----------------------------------------------------------
11
# -------- -------- -----------------------------------------------------------
12
# 20070201   154100 pmoogk@ca.ibm.com - Peter Moogk, Port internet code from WTP to Eclipse base.
12
# 20070201   154100 pmoogk@ca.ibm.com - Peter Moogk, Port internet code from WTP to Eclipse base.
13
# 20080424   228739 francisu@ieee.org - Francis Upton (Oakland Software)   
13
###############################################################################
14
###############################################################################
14
15
15
#
16
#
Lines 45-52 Link Here
45
ProxyPreferencePage_42=Invalid port
46
ProxyPreferencePage_42=Invalid port
46
ProxyPreferencePage_43=The port must be an integer
47
ProxyPreferencePage_43=The port must be an integer
47
ProxyPreferencePage_44=System proxy configuration (if available)
48
ProxyPreferencePage_44=System proxy configuration (if available)
48
ProxyPreferencePage_45=Specifies that system proxy settings are used to access the Internet. If such settings can't be retrieved, no proxy should be used.
49
ProxyPreferencePage_45=Specifies that system proxy settings are used to access the Internet. If these settings can't be retrieved, no proxy is used.
49
UserValidationDialog_0=Password Required
50
ProxyPreferencePage_showSystemConfig_button=Show
51
ProxyPreferencePage_showSystemConfig_tooltip=Shows the current values of the system proxy configuration.
52
ProxyPreferencePage_showConfigDialogTitle=These values were determined from your system configuration:
53
ProxyPreferencePage_showConfigDialog_None=No system proxy configuration information was found.
54
ProxyPreferencePage_showConfigDialog_Protocol=Protocol
55
ProxyPreferencePage_showConfigDialog_SourceValue=Source/Value
56
ProxyPreferencePage_showConfigDialog_User=User:
57
ProxyPreferencePage_showConfigDialog_Password=Password:
50
UserValidationDialog_1=Connect to: {0}
58
UserValidationDialog_1=Connect to: {0}
51
UserValidationDialog_2=&Password:
59
UserValidationDialog_2=&Password:
52
UserValidationDialog_3=&User name:
60
UserValidationDialog_3=&User name:
(-)src/org/eclipse/ui/internal/net/NetUIMessages.java (-2 / +19 lines)
Lines 10-15 Link Here
10
 * yyyymmdd bug      Email and other contact information
10
 * yyyymmdd bug      Email and other contact information
11
 * -------- -------- -----------------------------------------------------------
11
 * -------- -------- -----------------------------------------------------------
12
 * 20070201   154100 pmoogk@ca.ibm.com - Peter Moogk, Port internet code from WTP to Eclipse base.
12
 * 20070201   154100 pmoogk@ca.ibm.com - Peter Moogk, Port internet code from WTP to Eclipse base.
13
 * 20080424   228739 francisu@ieee.org - Francis Upton (Oakland Software)   
13
 *******************************************************************************/
14
 *******************************************************************************/
14
package org.eclipse.ui.internal.net;
15
package org.eclipse.ui.internal.net;
15
16
Lines 76-86 Link Here
76
	public static String ProxyPreferencePage_8;
77
	public static String ProxyPreferencePage_8;
77
78
78
	public static String ProxyPreferencePage_9;
79
	public static String ProxyPreferencePage_9;
79
	
80
80
	public static String ProxyPreferencePage_44;
81
	public static String ProxyPreferencePage_44;
81
	
82
82
	public static String ProxyPreferencePage_45;
83
	public static String ProxyPreferencePage_45;
83
84
85
	public static String ProxyPreferencePage_showSystemConfig_button;
86
87
	public static String ProxyPreferencePage_showSystemConfig_tooltip;
88
89
	public static String ProxyPreferencePage_showConfigDialogTitle;
90
91
	public static String ProxyPreferencePage_showConfigDialog_None;
92
93
	public static String ProxyPreferencePage_showConfigDialog_Protocol;
94
	
95
	public static String ProxyPreferencePage_showConfigDialog_SourceValue;
96
	
97
	public static String ProxyPreferencePage_showConfigDialog_User;
98
	
99
	public static String ProxyPreferencePage_showConfigDialog_Password;
100
84
	public static String TITLE_PREFERENCE_HOSTS_DIALOG;
101
	public static String TITLE_PREFERENCE_HOSTS_DIALOG;
85
102
86
	public static String LABEL_PREFERENCE_HOSTS_DIALOG;
103
	public static String LABEL_PREFERENCE_HOSTS_DIALOG;
(-)src/org/eclipse/ui/internal/net/ProxyPreferencePage.java (-22 / +161 lines)
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;
(-)META-INF/MANIFEST.MF (-1 / +2 lines)
Lines 12-18 Link Here
12
 org.eclipse.osgi;bundle-version="3.4.0",
12
 org.eclipse.osgi;bundle-version="3.4.0",
13
 org.eclipse.equinox.registry;bundle-version="3.4.0"
13
 org.eclipse.equinox.registry;bundle-version="3.4.0"
14
Bundle-ActivationPolicy: lazy
14
Bundle-ActivationPolicy: lazy
15
Export-Package: org.eclipse.core.internal.net;x-internal:=true,
15
Export-Package: org.eclipse.core.internal.net;x-friends:="org.eclipse.ui.net",
16
 org.eclipse.core.internal.net.proxy.unix, 
16
 org.eclipse.core.net.proxy
17
 org.eclipse.core.net.proxy
17
Bundle-RequiredExecutionEnvironment: J2SE-1.4,
18
Bundle-RequiredExecutionEnvironment: J2SE-1.4,
18
 CDC-1.0/Foundation-1.0,
19
 CDC-1.0/Foundation-1.0,
(-)src/org/eclipse/core/internal/net/ProxyManager.java (+24 lines)
Lines 7-12 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *     Oakland Software Incorporated (Francis Upton) francisu@ieee.org
11
 *        Bug 228739 - add UI support to show actual system config
10
 *******************************************************************************/
12
 *******************************************************************************/
11
package org.eclipse.core.internal.net;
13
package org.eclipse.core.internal.net;
12
14
Lines 175-180 Link Here
175
		doSetProxyData(proxies);
177
		doSetProxyData(proxies);
176
	}
178
	}
177
	
179
	
180
	// Used for the UI to see how we got the current system proxy config
181
	public ProxyData[] getSystemProxyData() {
182
		if (nativeProxyProvider == null)
183
			return new ProxyData[] {};
184
		List pdList = new ArrayList();
185
186
		try {
187
			for (int i = 0; i < proxies.length; i++) {
188
				ProxyType type = proxies[i];
189
				// All we care about is the protocol, the rest of the URI does not matter
190
				IProxyData[] nativeResult = nativeProxyProvider.getProxyData(new URI(type
191
						.getName()
192
						+ "://dummyhost")); //$NON-NLS-1$
193
				for (int nr = 0;nr < nativeResult.length; nr++)
194
					pdList.add(nativeResult[nr]);
195
			}
196
		} catch (URISyntaxException e) {
197
			Activator.logError("Unexpected exception", e); //$NON-NLS-1$
198
		}
199
		return (ProxyData[]) pdList.toArray(new ProxyData[]{});
200
	}
201
	
178
	private void doSetProxyData(IProxyData[] proxyDatas) {
202
	private void doSetProxyData(IProxyData[] proxyDatas) {
179
		IProxyData[] oldData = getProxyData();
203
		IProxyData[] oldData = getProxyData();
180
		String[] hosts = getNonProxiedHosts();
204
		String[] hosts = getNonProxiedHosts();

Return to bug 228739