View | Details | Raw Unified | Return to bug 298813
Collapse All | Expand All

(-)src/org/eclipse/core/internal/net/CommandLineProxyProvider.java (+116 lines)
Added Link Here
1
package org.eclipse.core.internal.net;
2
3
import java.net.URI;
4
import java.util.ArrayList;
5
import java.util.Arrays;
6
import java.util.HashSet;
7
import java.util.List;
8
import java.util.Set;
9
10
import org.eclipse.core.net.proxy.IProxyData;
11
12
public class CommandLineProxyProvider extends AbstractProxyProvider {
13
14
	private IProxyData[] proxyData;
15
	private String[] nonProxiedHosts;
16
	
17
	public CommandLineProxyProvider() {
18
		List allProxyData = new ArrayList();
19
		Set allNonProxiedHosts = new HashSet();
20
		IProxyData pd;
21
		
22
		pd = new ProxyData(IProxyData.HTTP_PROXY_TYPE);
23
		pd.setHost(System.getProperty("http.proxyHost", null)); //$NON-NLS-1$
24
		if(pd.getHost() != null){
25
			pd.setPort(parseInt(System.getProperty("http.proxyPort", null), -1)); //$NON-NLS-1$
26
			pd.setUserid(System.getProperty("http.proxyUser", System.getProperty("http.proxyUserName", null))); //$NON-NLS-1$ //$NON-NLS-2$
27
			if(pd.getUserId() != null){
28
				pd.setPassword(System.getProperty("http.proxyPassword", null)); //$NON-NLS-1$
29
			}
30
			allNonProxiedHosts.addAll(parseList(System.getProperty("http.nonProxyHosts", null), "\\|"));  //$NON-NLS-1$ //$NON-NLS-2$
31
		}
32
		allProxyData.add(pd);
33
		
34
		pd = new ProxyData(IProxyData.HTTPS_PROXY_TYPE);
35
		pd.setHost(System.getProperty("https.proxyHost", null)); //$NON-NLS-1$
36
		if(pd.getHost() != null){
37
			pd.setPort(parseInt(System.getProperty("https.proxyPort", null), -1)); //$NON-NLS-1$
38
			pd.setUserid(System.getProperty("https.proxyUser", System.getProperty("https.proxyUserName", null))); //$NON-NLS-1$ //$NON-NLS-2$
39
			if(pd.getUserId() != null){
40
				pd.setPassword(System.getProperty("https.proxyPassword", null)); //$NON-NLS-1$
41
			}
42
			allNonProxiedHosts.addAll(parseList(System.getProperty("https.nonProxyHosts", null), "\\|"));  //$NON-NLS-1$ //$NON-NLS-2$
43
		}
44
		allProxyData.add(pd);
45
		
46
		pd = new ProxyData("FTP"); //$NON-NLS-1$
47
		pd.setHost(System.getProperty("ftp.proxyHost", null)); //$NON-NLS-1$
48
		if(pd.getHost() != null){
49
			pd.setPort(parseInt(System.getProperty("ftp.proxyPort", null), -1)); //$NON-NLS-1$
50
			pd.setUserid(System.getProperty("ftp.proxyUser", System.getProperty("ftp.proxyUserName", null))); //$NON-NLS-1$ //$NON-NLS-2$
51
			if(pd.getUserId() != null){
52
				pd.setPassword(System.getProperty("ftp.proxyPassword", null)); //$NON-NLS-1$
53
			}
54
			allNonProxiedHosts.addAll(parseList(System.getProperty("ftp.nonProxyHosts", null), "\\|"));  //$NON-NLS-1$ //$NON-NLS-2$
55
		}
56
		allProxyData.add(pd);
57
		
58
		pd = new ProxyData(IProxyData.SOCKS_PROXY_TYPE);
59
		pd.setHost(System.getProperty("socksProxyHost", null)); //$NON-NLS-1$
60
		if(pd.getHost() != null){
61
			pd.setPort(parseInt(System.getProperty("socksProxyPort", null), -1)); //$NON-NLS-1$
62
			pd.setUserid(System.getProperty("java.net.socks.username", System.getProperty("user.name", null))); //$NON-NLS-1$ //$NON-NLS-2$
63
			if(pd.getUserId() != null){
64
				pd.setPassword(System.getProperty("java.net.socks.password", null)); //$NON-NLS-1$
65
			}
66
		}
67
		allProxyData.add(pd);
68
69
		proxyData = (IProxyData[])allProxyData.toArray(new IProxyData[allProxyData.size()]);
70
		allNonProxiedHosts.remove(""); //$NON-NLS-1$
71
		nonProxiedHosts = (String[])allNonProxiedHosts.toArray(new String[allNonProxiedHosts.size()]);
72
	}
73
74
	protected IProxyData[] getProxyData(URI uri) {
75
		if (uri.getScheme() != null) {
76
			String scheme = uri.getScheme();
77
			IProxyData pd = null;
78
			for(int i=0; i<proxyData.length; i++){
79
				if(scheme.equalsIgnoreCase(proxyData[i].getType())){
80
					pd = proxyData[i];
81
					break;
82
				}
83
			}
84
			return pd != null ? new IProxyData[]{ pd } : null;
85
		}
86
		return getProxyData();
87
	}
88
89
	protected IProxyData[] getProxyData() {
90
		return (IProxyData[])proxyData.clone();
91
	}
92
93
	protected String[] getNonProxiedHosts() {
94
		return (String[])nonProxiedHosts.clone();
95
	}
96
	
97
	private static final int parseInt(String value, int errorValue){
98
		try{
99
			if(value != null && value.length() > 0)
100
				return Integer.parseInt(value.trim());
101
		}catch(Exception e){
102
			// do nothing
103
		}
104
		return errorValue;
105
	}
106
	
107
	private static final List parseList(String value, String regExpressionDelimiter){
108
		try{
109
			if(value != null)
110
				return Arrays.asList(value.split(regExpressionDelimiter));
111
		}catch(Exception e){
112
			// do nothing
113
		}
114
		return new ArrayList();
115
	}
116
}
(-)src/org/eclipse/core/internal/net/Messages.java (+1 lines)
Lines 19-24 Link Here
19
	public static String ProxySelector_0;
19
	public static String ProxySelector_0;
20
	public static String ProxySelector_1;
20
	public static String ProxySelector_1;
21
	public static String ProxySelector_2;
21
	public static String ProxySelector_2;
22
	public static String ProxySelector_3;
22
23
23
	static {
24
	static {
24
		// initialize resource bundle
25
		// initialize resource bundle
(-)src/org/eclipse/core/internal/net/ProxyManager.java (-5 / +73 lines)
Lines 53-63 Link Here
53
	private static final String PREF_NON_PROXIED_HOSTS = "nonProxiedHosts"; //$NON-NLS-1$
53
	private static final String PREF_NON_PROXIED_HOSTS = "nonProxiedHosts"; //$NON-NLS-1$
54
	private static final String PREF_ENABLED = "proxiesEnabled"; //$NON-NLS-1$
54
	private static final String PREF_ENABLED = "proxiesEnabled"; //$NON-NLS-1$
55
	private static final String PREF_OS = "systemProxiesEnabled"; //$NON-NLS-1$
55
	private static final String PREF_OS = "systemProxiesEnabled"; //$NON-NLS-1$
56
	private static final String PREF_COMMAND_LINE = "commandLineProxiesEnabled"; //$NON-NLS-1$
56
	
57
	
57
	private static IProxyService proxyManager;
58
	private static IProxyService proxyManager;
58
	
59
	
59
	private AbstractProxyProvider nativeProxyProvider;
60
	private AbstractProxyProvider nativeProxyProvider;
60
	
61
	
62
	private AbstractProxyProvider commandLineProxyProvider;
63
	
61
	ListenerList listeners = new ListenerList(ListenerList.IDENTITY);
64
	ListenerList listeners = new ListenerList(ListenerList.IDENTITY);
62
	private String[] nonProxiedHosts;
65
	private String[] nonProxiedHosts;
63
	private final ProxyType[] proxies = new ProxyType[] {
66
	private final ProxyType[] proxies = new ProxyType[] {
Lines 70-75 Link Here
70
73
71
	private ProxyManager() {
74
	private ProxyManager() {
72
		try {
75
		try {
76
			commandLineProxyProvider = new CommandLineProxyProvider();
73
			nativeProxyProvider = (AbstractProxyProvider) Class.forName(
77
			nativeProxyProvider = (AbstractProxyProvider) Class.forName(
74
					"org.eclipse.core.net.ProxyProvider").newInstance(); //$NON-NLS-1$
78
					"org.eclipse.core.net.ProxyProvider").newInstance(); //$NON-NLS-1$
75
		} catch (ClassNotFoundException e) {
79
		} catch (ClassNotFoundException e) {
Lines 141-146 Link Here
141
		return new String[0];
145
		return new String[0];
142
	}
146
	}
143
147
148
	public String[] getCommandLineNonProxiedHosts() {
149
		if (hasCommandLineProxies()) {
150
			return commandLineProxyProvider.getNonProxiedHosts();
151
		}
152
		return new String[0];
153
	}
154
	
144
	/* (non-Javadoc)
155
	/* (non-Javadoc)
145
	 * @see org.eclipse.core.net.IProxyManager#setNonProxiedHosts(java.lang.String[])
156
	 * @see org.eclipse.core.net.IProxyManager#setNonProxiedHosts(java.lang.String[])
146
	 */
157
	 */
Lines 184-189 Link Here
184
		return new IProxyData[0];
195
		return new IProxyData[0];
185
	}
196
	}
186
197
198
	public IProxyData[] getCommandLineProxyData() {
199
		if (hasCommandLineProxies()) {
200
			return resolveType(commandLineProxyProvider.getProxyData());
201
		}
202
		return new IProxyData[0];
203
	}
204
	
187
	public void setProxyData(IProxyData[] proxies) {
205
	public void setProxyData(IProxyData[] proxies) {
188
		checkMigrated();
206
		checkMigrated();
189
		doSetProxyData(proxies);
207
		doSetProxyData(proxies);
Lines 227-233 Link Here
227
	public boolean isProxiesEnabled() {
245
	public boolean isProxiesEnabled() {
228
		checkMigrated();
246
		checkMigrated();
229
		return internalIsProxiesEnabled()
247
		return internalIsProxiesEnabled()
230
				&& (!isSystemProxiesEnabled() || (isSystemProxiesEnabled() && hasSystemProxies()));
248
				&& ((!isSystemProxiesEnabled() || (isSystemProxiesEnabled() && hasSystemProxies()))
249
				|| (!isCommandLineProxiesEnabled() || (isCommandLineProxiesEnabled() && hasCommandLineProxies())));
231
	}
250
	}
232
251
233
	private boolean internalIsProxiesEnabled() {
252
	private boolean internalIsProxiesEnabled() {
Lines 248-257 Link Here
248
		Activator.getInstance().getPreferences().putBoolean(PREF_ENABLED, enabled);
267
		Activator.getInstance().getPreferences().putBoolean(PREF_ENABLED, enabled);
249
	}
268
	}
250
269
251
	private void internalSetEnabled(boolean enabled, boolean systemEnabled) {
270
	private void internalSetEnabled(boolean enabled, boolean commandLineEnabled, boolean systemEnabled) { 
252
		Properties sysProps = System.getProperties();
271
		Properties sysProps = System.getProperties();
253
		sysProps.put("proxySet", enabled ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
272
		sysProps.put("proxySet", enabled ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
254
		sysProps.put("systemProxySet", systemEnabled ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
273
		sysProps.put("systemProxySet", systemEnabled ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
274
		sysProps.put("commandLineProxySet", commandLineEnabled ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
255
		updateSystemProperties();
275
		updateSystemProperties();
256
		try {
276
		try {
257
			Activator.getInstance().getPreferences().flush();
277
			Activator.getInstance().getPreferences().flush();
Lines 273-278 Link Here
273
	}
293
	}
274
294
275
	public void initialize() {
295
	public void initialize() {
296
		boolean switchToCommandLineProxy = Boolean.getBoolean("commandLineProxySet"); //$NON-NLS-1$
297
		
276
		checkMigrated();
298
		checkMigrated();
277
		((IEclipsePreferences)Activator.getInstance().getPreferences()).addPreferenceChangeListener(this);
299
		((IEclipsePreferences)Activator.getInstance().getPreferences()).addPreferenceChangeListener(this);
278
		// Now initialize each proxy type
300
		// Now initialize each proxy type
Lines 281-286 Link Here
281
			type.initialize();
303
			type.initialize();
282
		}
304
		}
283
		registerAuthenticator();
305
		registerAuthenticator();
306
		
307
		if(switchToCommandLineProxy){
308
			ProxySelector.setActiveProvider(ProxySelector.COMMAND_LINE_PROVIDER);
309
		}
284
	}
310
	}
285
311
286
	public IProxyData getProxyData(String type) {
312
	public IProxyData getProxyData(String type) {
Lines 307-312 Link Here
307
		if (uri == null) {
333
		if (uri == null) {
308
			return new IProxyData[0];
334
			return new IProxyData[0];
309
		}
335
		}
336
		if (hasCommandLineProxies() && isCommandLineProxiesEnabled()) {
337
			return resolveType(commandLineProxyProvider.select(uri));
338
		}
310
		if (hasSystemProxies() && isSystemProxiesEnabled()) {
339
		if (hasSystemProxies() && isSystemProxiesEnabled()) {
311
			return resolveType(nativeProxyProvider.select(uri));
340
			return resolveType(nativeProxyProvider.select(uri));
312
		}
341
		}
Lines 359-369 Link Here
359
		if (!internalIsProxiesEnabled()) {
388
		if (!internalIsProxiesEnabled()) {
360
			return null;
389
			return null;
361
		}
390
		}
391
		if (hasCommandLineProxies() && isCommandLineProxiesEnabled())
392
			try {
393
				URI uri = new URI(type, "//" + host, null); //$NON-NLS-1$
394
				IProxyData[] proxyDatas = commandLineProxyProvider.select(uri);
395
				return proxyDatas.length > 0 ? resolveType(proxyDatas[0]) : null;
396
			} catch (URISyntaxException e) {
397
				return null;
398
			}
362
		if (hasSystemProxies() && isSystemProxiesEnabled())
399
		if (hasSystemProxies() && isSystemProxiesEnabled())
363
			try {
400
			try {
364
				URI uri = new URI(type, "//" + host, null); //$NON-NLS-1$
401
				URI uri = new URI(type, "//" + host, null); //$NON-NLS-1$
365
				IProxyData[] proxyDatas = nativeProxyProvider.select(uri);
402
				IProxyData[] proxyDatas = nativeProxyProvider.select(uri);
366
				return proxyDatas.length > 0 ? resolveType(nativeProxyProvider.select(uri)[0]) : null;
403
				return proxyDatas.length > 0 ? resolveType(proxyDatas[0]) : null;
367
			} catch (URISyntaxException e) {
404
			} catch (URISyntaxException e) {
368
				return null;
405
				return null;
369
			}
406
			}
Lines 423-428 Link Here
423
		Preferences netInstancePrefs = instanceNode.node(Activator.ID);
460
		Preferences netInstancePrefs = instanceNode.node(Activator.ID);
424
		Preferences netConfigurationPrefs = configurationNode.node(Activator.ID);
461
		Preferences netConfigurationPrefs = configurationNode.node(Activator.ID);
425
		
462
		
463
		// migrate command line parameters
464
		
426
		// migrate enabled status
465
		// migrate enabled status
427
		if (netConfigurationPrefs.get(PREF_ENABLED, null) == null) {
466
		if (netConfigurationPrefs.get(PREF_ENABLED, null) == null) {
428
			String instanceEnabled = netInstancePrefs.get(PREF_ENABLED, null);
467
			String instanceEnabled = netInstancePrefs.get(PREF_ENABLED, null);
Lines 474-479 Link Here
474
			// Only set the migration bit when initializing
513
			// Only set the migration bit when initializing
475
			if (isInitialize)
514
			if (isInitialize)
476
				netPrefs.putBoolean(PREF_HAS_MIGRATED, true);
515
				netPrefs.putBoolean(PREF_HAS_MIGRATED, true);
516
			
477
			Preferences updatePrefs = node.node("org.eclipse.update.core"); //$NON-NLS-1$
517
			Preferences updatePrefs = node.node("org.eclipse.update.core"); //$NON-NLS-1$
478
			String httpProxyHost = getHostToMigrate(updatePrefs, isInitialize /* checkSystemProperties */);
518
			String httpProxyHost = getHostToMigrate(updatePrefs, isInitialize /* checkSystemProperties */);
479
			int port = getPortToMigrate(updatePrefs, isInitialize /* checkSystemProperties */);
519
			int port = getPortToMigrate(updatePrefs, isInitialize /* checkSystemProperties */);
Lines 529-541 Link Here
529
	}
569
	}
530
570
531
	public void preferenceChange(PreferenceChangeEvent event) {
571
	public void preferenceChange(PreferenceChangeEvent event) {
532
		if (event.getKey().equals(PREF_ENABLED) || event.getKey().equals(PREF_OS)) {
572
		if (event.getKey().equals(PREF_ENABLED) || event.getKey().equals(PREF_COMMAND_LINE) || event.getKey().equals(PREF_OS)) {
533
			checkMigrated();
573
			checkMigrated();
534
			internalSetEnabled(Activator.getInstance().getPreferences().getBoolean(PREF_ENABLED, true),
574
			internalSetEnabled(Activator.getInstance().getPreferences().getBoolean(PREF_ENABLED, true),
575
					Activator.getInstance().getPreferences().getBoolean(PREF_COMMAND_LINE, true),
535
					Activator.getInstance().getPreferences().getBoolean(PREF_OS, true));
576
					Activator.getInstance().getPreferences().getBoolean(PREF_OS, true));
536
		}
577
		}
537
	}
578
	}
538
579
580
	public boolean hasCommandLineProxies() {
581
		return commandLineProxyProvider != null;
582
	}
583
	
584
	public boolean isCommandLineProxiesEnabled() {
585
		checkMigrated();
586
		return Activator.getInstance().getPreferences().getBoolean(PREF_COMMAND_LINE,
587
				true);
588
	}
589
590
	public void setCommandLineProxiesEnabled(boolean enabled) {
591
		checkMigrated();
592
		boolean current = isCommandLineProxiesEnabled();
593
		if (current == enabled)
594
			return;
595
		// Setting the preference will trigger the system property update
596
		// (see preferenceChange)
597
		Activator.getInstance().getPreferences().putBoolean(PREF_COMMAND_LINE, enabled);
598
	}
599
539
	public boolean hasSystemProxies() {
600
	public boolean hasSystemProxies() {
540
		return nativeProxyProvider != null;
601
		return nativeProxyProvider != null;
541
	}
602
	}
Lines 588-592 Link Here
588
		}
649
		}
589
		return data;
650
		return data;
590
	}
651
	}
591
652
	
653
	public boolean shouldSetSocksSystemProperties(){
654
		for (int i=0; i<proxies.length; i++){
655
			if(IProxyData.SOCKS_PROXY_TYPE.equals(proxies[i].getName()))
656
				return proxies[i].shouldSetSocksSystemProperties();
657
		}
658
		return true;
659
	}
592
}
660
}
(-)src/org/eclipse/core/internal/net/ProxySelector.java (-3 / +20 lines)
Lines 24-33 Link Here
24
	private static final String DIRECT_PROVIDER = "Direct"; //$NON-NLS-1$
24
	private static final String DIRECT_PROVIDER = "Direct"; //$NON-NLS-1$
25
	private static final String ECLIPSE_PROVIDER = "Manual"; //$NON-NLS-1$
25
	private static final String ECLIPSE_PROVIDER = "Manual"; //$NON-NLS-1$
26
	private static final String NATIVE_PROVIDER = "Native"; //$NON-NLS-1$
26
	private static final String NATIVE_PROVIDER = "Native"; //$NON-NLS-1$
27
	public static final String COMMAND_LINE_PROVIDER = "CommandLine"; //$NON-NLS-1$
27
28
28
	public static String[] getProviders() {
29
	public static String[] getProviders() {
29
		return new String[] { DIRECT_PROVIDER, ECLIPSE_PROVIDER,
30
		return new String[] { DIRECT_PROVIDER, ECLIPSE_PROVIDER,
30
				NATIVE_PROVIDER };
31
				NATIVE_PROVIDER, COMMAND_LINE_PROVIDER };
31
	}
32
	}
32
33
33
	public static String unlocalizeProvider(String name) {
34
	public static String unlocalizeProvider(String name) {
Lines 37-42 Link Here
37
			return ECLIPSE_PROVIDER;
38
			return ECLIPSE_PROVIDER;
38
		} else if (Messages.ProxySelector_2.equals(name)) {
39
		} else if (Messages.ProxySelector_2.equals(name)) {
39
			return NATIVE_PROVIDER;
40
			return NATIVE_PROVIDER;
41
		} else if (Messages.ProxySelector_3.equals(name)) {
42
			return COMMAND_LINE_PROVIDER;
40
		}
43
		}
41
		Assert.isTrue(false);
44
		Assert.isTrue(false);
42
		return null;
45
		return null;
Lines 49-54 Link Here
49
			return Messages.ProxySelector_1;
52
			return Messages.ProxySelector_1;
50
		} else if (NATIVE_PROVIDER.equals(name)) {
53
		} else if (NATIVE_PROVIDER.equals(name)) {
51
			return Messages.ProxySelector_2;
54
			return Messages.ProxySelector_2;
55
		} else if (COMMAND_LINE_PROVIDER.equals(name)) {
56
			return Messages.ProxySelector_3;
52
		}
57
		}
53
		Assert.isTrue(false);
58
		Assert.isTrue(false);
54
		return null;
59
		return null;
Lines 58-65 Link Here
58
		IProxyService service = ProxyManager.getProxyManager();
63
		IProxyService service = ProxyManager.getProxyManager();
59
		if (!service.isProxiesEnabled()) {
64
		if (!service.isProxiesEnabled()) {
60
			return DIRECT_PROVIDER;
65
			return DIRECT_PROVIDER;
61
		} else if (service.isProxiesEnabled()
66
		} else if (service.isCommandLineProxiesEnabled()) {
62
				&& !service.isSystemProxiesEnabled()) {
67
			return COMMAND_LINE_PROVIDER;
68
		} else if (!service.isSystemProxiesEnabled()) {
63
			return ECLIPSE_PROVIDER;
69
			return ECLIPSE_PROVIDER;
64
		}
70
		}
65
		return NATIVE_PROVIDER;
71
		return NATIVE_PROVIDER;
Lines 70-81 Link Here
70
		if (provider.equals(DIRECT_PROVIDER)) {
76
		if (provider.equals(DIRECT_PROVIDER)) {
71
			service.setProxiesEnabled(false);
77
			service.setProxiesEnabled(false);
72
			service.setSystemProxiesEnabled(false);
78
			service.setSystemProxiesEnabled(false);
79
			service.setCommandLineProxiesEnabled(false);
73
		} else if (provider.equals(ECLIPSE_PROVIDER)) {
80
		} else if (provider.equals(ECLIPSE_PROVIDER)) {
74
			service.setProxiesEnabled(true);
81
			service.setProxiesEnabled(true);
75
			service.setSystemProxiesEnabled(false);
82
			service.setSystemProxiesEnabled(false);
83
			service.setCommandLineProxiesEnabled(false);
76
		} else if (provider.equals(NATIVE_PROVIDER)) {
84
		} else if (provider.equals(NATIVE_PROVIDER)) {
77
			service.setProxiesEnabled(true);
85
			service.setProxiesEnabled(true);
78
			service.setSystemProxiesEnabled(true);
86
			service.setSystemProxiesEnabled(true);
87
			service.setCommandLineProxiesEnabled(false);
88
		} else if (provider.equals(COMMAND_LINE_PROVIDER)) {
89
			service.setProxiesEnabled(true);
90
			service.setSystemProxiesEnabled(false);
91
			service.setCommandLineProxiesEnabled(true);
79
		} else {
92
		} else {
80
			throw new IllegalArgumentException("Provider not supported"); //$NON-NLS-1$
93
			throw new IllegalArgumentException("Provider not supported"); //$NON-NLS-1$
81
		}
94
		}
Lines 89-94 Link Here
89
			return castArray(manager.getProxyData());
102
			return castArray(manager.getProxyData());
90
		} else if (provider.equals(NATIVE_PROVIDER)) {
103
		} else if (provider.equals(NATIVE_PROVIDER)) {
91
			return castArray(manager.getNativeProxyData());
104
			return castArray(manager.getNativeProxyData());
105
		} else if (provider.equals(COMMAND_LINE_PROVIDER)) {
106
			return castArray(manager.getCommandLineProxyData());
92
		}
107
		}
93
		throw new IllegalArgumentException("Provider not supported"); //$NON-NLS-1$
108
		throw new IllegalArgumentException("Provider not supported"); //$NON-NLS-1$
94
	}
109
	}
Lines 130-135 Link Here
130
			return manager.getNonProxiedHosts();
145
			return manager.getNonProxiedHosts();
131
		} else if (provider.equals(NATIVE_PROVIDER)) {
146
		} else if (provider.equals(NATIVE_PROVIDER)) {
132
			return manager.getNativeNonProxiedHosts();
147
			return manager.getNativeNonProxiedHosts();
148
		} else if (provider.equals(COMMAND_LINE_PROVIDER)) {
149
			return manager.getCommandLineNonProxiedHosts();
133
		}
150
		}
134
		throw new IllegalArgumentException("Provider not supported"); //$NON-NLS-1$ 
151
		throw new IllegalArgumentException("Provider not supported"); //$NON-NLS-1$ 
135
	}
152
	}
(-)src/org/eclipse/core/internal/net/ProxyType.java (-2 / +2 lines)
Lines 48-54 Link Here
48
	/**
48
	/**
49
	 * Constants that control the setting of the SOCKS system properties
49
	 * Constants that control the setting of the SOCKS system properties
50
	 */
50
	 */
51
	private static final String PROP_SOCKS_SYSTEM_PROPERTY_HANDLING = "org.eclipse.net.core.setSocksSystemProperties"; //$NON-NLS-1$
51
	public static final String PROP_SOCKS_SYSTEM_PROPERTY_HANDLING = "org.eclipse.net.core.setSocksSystemProperties"; //$NON-NLS-1$
52
	public static final int ONLY_SET_FOR_1_5_OR_LATER = 0;
52
	public static final int ONLY_SET_FOR_1_5_OR_LATER = 0;
53
	public static final int ALWAYS_SET = 1;
53
	public static final int ALWAYS_SET = 1;
54
	public static final int NEVER_SET = 2;
54
	public static final int NEVER_SET = 2;
Lines 293-299 Link Here
293
		return verifySocksSystemPropertiesEmpty();
293
		return verifySocksSystemPropertiesEmpty();
294
	}
294
	}
295
	
295
	
296
	private boolean shouldSetSocksSystemProperties() {
296
	/* private */ boolean shouldSetSocksSystemProperties() {
297
		if (socksSystemPropertySetting == ALWAYS_SET)
297
		if (socksSystemPropertySetting == ALWAYS_SET)
298
			return true;
298
			return true;
299
		if (socksSystemPropertySetting == NEVER_SET)
299
		if (socksSystemPropertySetting == NEVER_SET)
(-)src/org/eclipse/core/internal/net/messages.properties (-1 / +2 lines)
Lines 11-14 Link Here
11
11
12
ProxySelector_0=Direct
12
ProxySelector_0=Direct
13
ProxySelector_1=Manual
13
ProxySelector_1=Manual
14
ProxySelector_2=Native
14
ProxySelector_2=Native
15
ProxySelector_3=Command Line
(-)src/org/eclipse/core/net/proxy/IProxyService.java (-1 / +35 lines)
Lines 58-63 Link Here
58
	boolean isProxiesEnabled();
58
	boolean isProxiesEnabled();
59
	
59
	
60
	/**
60
	/**
61
	 * Returns whether command line proxy support is available.
62
	 * 
63
	 * @return whether command line proxy support is available
64
	 * @since 1.1
65
	 */
66
	boolean hasCommandLineProxies();
67
	
68
	/**
69
	 * Sets whether command line proxies should be used, when the proxy support is
70
	 * enabled.
71
	 * 
72
	 * @param enabled
73
	 * @since 1.1
74
	 */
75
	void setCommandLineProxiesEnabled(boolean enabled);
76
	
77
	/**
78
	 * Returns whether command line proxy should be used when the proxy support is
79
	 * enabled.
80
	 * 
81
	 * @return whether command line proxy is used when the proxy support is enabled
82
	 * @since 1.1
83
	 */
84
	boolean isCommandLineProxiesEnabled();
85
	
86
	
87
	/**
61
	 * Returns whether system proxy support is available.
88
	 * Returns whether system proxy support is available.
62
	 * 
89
	 * 
63
	 * @return whether system proxy support is available
90
	 * @return whether system proxy support is available
Lines 74-80 Link Here
74
	 */
101
	 */
75
	void setSystemProxiesEnabled(boolean enabled);
102
	void setSystemProxiesEnabled(boolean enabled);
76
	
103
	
77
	
78
	/**
104
	/**
79
	 * Returns whether system proxy should be used when the proxy support is
105
	 * Returns whether system proxy should be used when the proxy support is
80
	 * enabled.
106
	 * enabled.
Lines 260-263 Link Here
260
	 * @param listener a change listener
286
	 * @param listener a change listener
261
	 */
287
	 */
262
	void removeProxyChangeListener(IProxyChangeListener listener);
288
	void removeProxyChangeListener(IProxyChangeListener listener);
289
290
	/**
291
	 * Returns whether system properties should be set to reflect 
292
	 * SOCKS proxy settings. 
293
	 * @return whether system properties should be set to reflect 
294
	 * SOCKS proxy settings. 
295
	 */
296
	boolean shouldSetSocksSystemProperties();
263
}
297
}

Return to bug 298813