Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 60293 Details for
Bug 154100
Platform level proxy settings
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch to Update
patch154100Update.txt (text/plain), 23.20 KB, created by
Michael Valenta
on 2007-03-05 18:11:14 EST
(
hide
)
Description:
Patch to Update
Filename:
MIME Type:
Creator:
Michael Valenta
Created:
2007-03-05 18:11:14 EST
Size:
23.20 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.update.ui >Index: src/org/eclipse/update/internal/ui/UpdateUI.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.update.ui/src/org/eclipse/update/internal/ui/UpdateUI.java,v >retrieving revision 1.45 >diff -u -r1.45 UpdateUI.java >--- src/org/eclipse/update/internal/ui/UpdateUI.java 4 May 2006 12:24:04 -0000 1.45 >+++ src/org/eclipse/update/internal/ui/UpdateUI.java 5 Mar 2007 23:01:59 -0000 >@@ -11,22 +11,25 @@ > package org.eclipse.update.internal.ui; > > import java.io.UnsupportedEncodingException; >-import java.lang.reflect.*; >-import java.net.*; >+import java.lang.reflect.InvocationTargetException; >+import java.net.MalformedURLException; >+import java.net.URL; > import java.util.Vector; > > import org.eclipse.core.runtime.*; > import org.eclipse.jface.dialogs.*; >-import org.eclipse.swt.widgets.*; >+import org.eclipse.swt.widgets.Display; >+import org.eclipse.swt.widgets.Shell; > import org.eclipse.ui.*; >-import org.eclipse.ui.browser.*; >-import org.eclipse.ui.plugin.*; >+import org.eclipse.ui.browser.IWebBrowser; >+import org.eclipse.ui.browser.IWorkbenchBrowserSupport; >+import org.eclipse.ui.plugin.AbstractUIPlugin; > import org.eclipse.update.configuration.*; > import org.eclipse.update.core.*; >-import org.eclipse.update.internal.core.*; >-import org.eclipse.update.internal.ui.model.*; >-import org.eclipse.update.internal.ui.security.*; >-import org.osgi.framework.*; >+import org.eclipse.update.internal.core.UpdateCore; >+import org.eclipse.update.internal.ui.model.UpdateModel; >+import org.osgi.framework.Bundle; >+import org.osgi.framework.BundleContext; > > /** > * The main plugin class to be used in the desktop. >@@ -39,7 +42,6 @@ > //The shared instance. > private static UpdateUI plugin; > private UpdateModel model; >- private UpdateManagerAuthenticator authenticator; > private String appServerHost; > private int appServerPort; > private UpdateLabelProvider labelProvider; >@@ -96,8 +98,6 @@ > public void start(BundleContext context) throws Exception { > super.start(context); > model = new UpdateModel(); >- authenticator = new UpdateManagerAuthenticator(); >- Authenticator.setDefault(authenticator); > int historyPref = > getPluginPreferences().getInt(UpdateCore.P_HISTORY_SIZE); > if (historyPref > 0) { >@@ -237,15 +237,6 @@ > return (IFeature[]) features.toArray(new IFeature[features.size()]); > } > >- >- /** >- * Gets the authenticator. >- * @return Returns a UpdateManagerAuthenticator >- */ >- public UpdateManagerAuthenticator getAuthenticator() { >- return authenticator; >- } >- > public static URL getOriginatingURL(String id) { > IDialogSettings section = getOriginatingURLSection(); > String value = section.get(id); >Index: build.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.update.ui/build.properties,v >retrieving revision 1.18 >diff -u -r1.18 build.properties >--- build.properties 4 Apr 2005 03:10:58 -0000 1.18 >+++ build.properties 5 Mar 2007 23:01:59 -0000 >@@ -14,7 +14,6 @@ > plugin.xml,\ > about.html,\ > META-INF/ >-src.includes = about.html,\ >- schema/ >+src.includes = about.html > source.. = src/ > #jars.extra.classpath = ../org.eclipse.tomcat/servlet.jar >Index: src/org/eclipse/update/internal/ui/preferences/MainPreferencePage.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.update.ui/src/org/eclipse/update/internal/ui/preferences/MainPreferencePage.java,v >retrieving revision 1.34 >diff -u -r1.34 MainPreferencePage.java >--- src/org/eclipse/update/internal/ui/preferences/MainPreferencePage.java 15 Nov 2005 06:01:10 -0000 1.34 >+++ src/org/eclipse/update/internal/ui/preferences/MainPreferencePage.java 5 Mar 2007 23:01:59 -0000 >@@ -43,11 +43,6 @@ > private Button equivalentButton; > private Button compatibleButton; > private Text updatePolicyText; >- private Label httpProxyHostLabel; >- private Label httpProxyPortLabel; >- private Text httpProxyHostText; >- private Text httpProxyPortText; >- private Button enableHttpProxy; > > // these two values are for compatibility with old code > public static final String EQUIVALENT_VALUE = "equivalent"; //$NON-NLS-1$ >@@ -175,57 +170,6 @@ > GridData gd = new GridData(GridData.FILL_HORIZONTAL); > gd.horizontalSpan = columnSpan; > group.setLayoutData(gd); >- >- enableHttpProxy = new Button(group, SWT.CHECK); >- enableHttpProxy.setText(UpdateUIMessages.MainPreferencePage_enableHttpProxy); >- gd = new GridData(); >- gd.horizontalSpan = 2; >- enableHttpProxy.setLayoutData(gd); >- >- httpProxyHostLabel = new Label(group, SWT.NONE); >- httpProxyHostLabel.setText(UpdateUIMessages.MainPreferencePage_httpProxyHost); >- >- httpProxyHostText = new Text(group, SWT.SINGLE | SWT.BORDER); >- httpProxyHostText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); >- >- httpProxyPortLabel = new Label(group, SWT.NONE); >- httpProxyPortLabel.setText(UpdateUIMessages.MainPreferencePage_httpProxyPort); >- >- httpProxyPortText = new Text(group, SWT.SINGLE | SWT.BORDER); >- httpProxyPortText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); >- // Validation of port field >- httpProxyPortText.addModifyListener(new ModifyListener() { >- public void modifyText(ModifyEvent e) { >- try { >- String portValue = httpProxyPortText.getText(); >- int num = 80; >- if (portValue != null && portValue.trim().length() > 0) >- num = Integer.valueOf(portValue).intValue(); >- if (0 <= num && num <= 0xFFFF) { >- // port is valid >- MainPreferencePage.this.setValid(true); >- setErrorMessage(null); >- return; >- } >- >- // port is invalid >- } catch (NumberFormatException nfe) { >- } >- MainPreferencePage.this.setValid(false); >- setErrorMessage(UpdateUIMessages.MainPreferencePage_invalidPort); >- } >- }); >- >- enableHttpProxy.addSelectionListener(new SelectionAdapter() { >- public void widgetSelected(SelectionEvent e) { >- boolean enable = enableHttpProxy.getSelection(); >- httpProxyPortLabel.setEnabled(enable); >- httpProxyHostLabel.setEnabled(enable); >- httpProxyPortText.setEnabled(enable); >- httpProxyHostText.setEnabled(enable); >- } >- }); >- > } > > private int getHistoryCount() { >@@ -262,10 +206,6 @@ > try { > SiteManager.getLocalSite().setMaximumHistoryCount( > getHistoryCount()); >- SiteManager.setHttpProxyInfo( >- enableHttpProxy.getSelection(), >- httpProxyHostText.getText(), >- httpProxyPortText.getText()); > } catch (CoreException e) { > UpdateUI.logException(e); > } >@@ -294,19 +234,6 @@ > > private void initialize() { > Preferences prefs = UpdateCore.getPlugin().getPluginPreferences(); >- >- enableHttpProxy.setSelection(prefs.getBoolean(UpdateCore.HTTP_PROXY_ENABLE)); >- String serverValue = prefs.getString(UpdateCore.HTTP_PROXY_HOST); >- if (serverValue != null) >- httpProxyHostText.setText(serverValue); >- String portValue = prefs.getString(UpdateCore.HTTP_PROXY_PORT); >- if (portValue != null) >- httpProxyPortText.setText(portValue); >- >- httpProxyPortLabel.setEnabled(enableHttpProxy.getSelection()); >- httpProxyHostLabel.setEnabled(enableHttpProxy.getSelection()); >- httpProxyPortText.setEnabled(enableHttpProxy.getSelection()); >- httpProxyHostText.setEnabled(enableHttpProxy.getSelection()); > > checkSignatureCheckbox.setSelection( > prefs.getBoolean(UpdateCore.P_CHECK_SIGNATURE)); >@@ -344,14 +271,6 @@ > super.performDefaults(); > Preferences prefs = UpdateCore.getPlugin().getPluginPreferences(); > >- enableHttpProxy.setSelection(false); >- httpProxyHostText.setText(""); //$NON-NLS-1$ >- httpProxyPortText.setText(""); //$NON-NLS-1$ >- httpProxyPortLabel.setEnabled(false); >- httpProxyHostLabel.setEnabled(false); >- httpProxyPortText.setEnabled(false); >- httpProxyHostText.setEnabled(false); >- > updatePolicyText.setText(""); //$NON-NLS-1$ > > checkSignatureCheckbox.setSelection(true); >Index: src/org/eclipse/update/internal/ui/security/UpdateManagerAuthenticator.java >=================================================================== >RCS file: src/org/eclipse/update/internal/ui/security/UpdateManagerAuthenticator.java >diff -N src/org/eclipse/update/internal/ui/security/UpdateManagerAuthenticator.java >--- src/org/eclipse/update/internal/ui/security/UpdateManagerAuthenticator.java 4 May 2006 12:24:04 -0000 1.18 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,53 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2000, 2006 IBM Corporation and others. >- * All rights reserved. This program and the accompanying materials >- * are made available under the terms of the Eclipse Public License v1.0 >- * which accompanies this distribution, and is available at >- * http://www.eclipse.org/legal/epl-v10.html >- * >- * Contributors: >- * IBM Corporation - initial API and implementation >- *******************************************************************************/ >-package org.eclipse.update.internal.ui.security; >- >-import java.net.*; >- >-/** >- * Update Manager Authenticator Sadly there can only be one registered per VM >- */ >-public class UpdateManagerAuthenticator extends Authenticator { >- //private Authentication savedPasswordAuthentication; >- >- /* >- * @see Authenticator#getPasswordAuthentication() >- */ >- protected PasswordAuthentication getPasswordAuthentication() { >- // String protocol = getRequestingProtocol(); >- InetAddress address = getRequestingSite(); // can be null; >- // int port = getRequestingPort(); >- String prompt = getRequestingPrompt(); // realm or message, not documented that can be null >- // String scheme = getRequestingScheme(); // not documented that can be null >- >- // get the host name from the address since #getRequestingHost >- // is not available in the foundation 1.0 class libraries >- String hostString = null; >- if (address != null) { >- hostString = address.getHostName(); >- } >- if (hostString == null) { >- hostString = ""; //$NON-NLS-1$ >- } >- String promptString = prompt; >- if (prompt == null) { >- promptString = ""; //$NON-NLS-1$ >- } >- >- Authentication auth = UserValidationDialog.getAuthentication( >- hostString, promptString); >- if (auth != null) >- return new PasswordAuthentication(auth.getUser(), auth >- .getPassword().toCharArray()); >- else >- return null; >- } >-} >#P org.eclipse.update.core >Index: build.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.update.core/build.properties,v >retrieving revision 1.15 >diff -u -r1.15 build.properties >--- build.properties 4 Apr 2005 03:11:02 -0000 1.15 >+++ build.properties 5 Mar 2007 23:02:01 -0000 >@@ -14,7 +14,6 @@ > .,\ > about.html,\ > .options,\ >- os/,\ > META-INF/ > src.includes = about.html,\ > schema/ >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.update.core/META-INF/MANIFEST.MF,v >retrieving revision 1.15 >diff -u -r1.15 MANIFEST.MF >--- META-INF/MANIFEST.MF 20 Oct 2006 19:06:05 -0000 1.15 >+++ META-INF/MANIFEST.MF 5 Mar 2007 23:02:01 -0000 >@@ -23,7 +23,8 @@ > org.eclipse.update.search, > org.eclipse.update.standalone > Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.1.0,4.0.0)", >- org.eclipse.update.configurator;bundle-version="[3.1.0,4.0.0) >+ org.eclipse.update.configurator;bundle-version="[3.1.0,4.0.0)", >+ org.eclipse.core.net;bundle-version="[1.0.0,2.0.0)" > Eclipse-LazyStart: true > Bundle-RequiredExecutionEnvironment: J2SE-1.4, > CDC-1.0/Foundation-1.0, >Index: src/org/eclipse/update/internal/core/UpdatePreferencesInitializer.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.update.core/src/org/eclipse/update/internal/core/UpdatePreferencesInitializer.java,v >retrieving revision 1.4 >diff -u -r1.4 UpdatePreferencesInitializer.java >--- src/org/eclipse/update/internal/core/UpdatePreferencesInitializer.java 15 Nov 2005 06:01:07 -0000 1.4 >+++ src/org/eclipse/update/internal/core/UpdatePreferencesInitializer.java 5 Mar 2007 23:02:01 -0000 >@@ -47,16 +47,5 @@ > plugin.getPluginPreferences().setDefault(UpdateCore.P_AUTOMATICALLY_CHOOSE_MIRROR, false); > plugin.getPluginPreferences().setDefault(UpdateCore.P_HISTORY_SIZE, UpdateCore.DEFAULT_HISTORY); > plugin.getPluginPreferences().setDefault(UpdateCore.P_UPDATE_VERSIONS, UpdateCore.EQUIVALENT_VALUE); >- >- // If proxy host and port are set as system properties, use them as defaults >- String proxyHost = System.getProperty("http.proxyHost"); //$NON-NLS-1$ >- if (proxyHost != null && proxyHost.trim().length() > 0) { >- String proxyPort = System.getProperty("http.proxyPort"); //$NON-NLS-1$ >- if (proxyPort == null || proxyPort.trim().length() == 0) >- proxyPort = "80"; //$NON-NLS-1$ >- plugin.getPluginPreferences().setDefault(UpdateCore.HTTP_PROXY_ENABLE, true); >- plugin.getPluginPreferences().setDefault(UpdateCore.HTTP_PROXY_HOST, proxyHost); >- plugin.getPluginPreferences().setDefault(UpdateCore.HTTP_PROXY_PORT, proxyPort); >- } > } > } >Index: src/org/eclipse/update/internal/core/UpdateCore.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.update.core/src/org/eclipse/update/internal/core/UpdateCore.java,v >retrieving revision 1.35 >diff -u -r1.35 UpdateCore.java >--- src/org/eclipse/update/internal/core/UpdateCore.java 2 Jun 2006 00:01:32 -0000 1.35 >+++ src/org/eclipse/update/internal/core/UpdateCore.java 5 Mar 2007 23:02:01 -0000 >@@ -14,6 +14,7 @@ > import java.io.IOException; > import java.net.URL; > >+import org.eclipse.core.net.proxy.IProxyService; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.Platform; >@@ -29,6 +30,7 @@ > import org.eclipse.update.core.Utilities; > import org.eclipse.update.internal.core.connection.ConnectionThreadManagerFactory; > import org.osgi.framework.BundleContext; >+import org.osgi.framework.ServiceRegistration; > import org.osgi.service.packageadmin.PackageAdmin; > import org.osgi.util.tracker.ServiceTracker; > >@@ -47,16 +49,6 @@ > public static boolean DEBUG_SHOW_WEB; > public static boolean DEBUG_SHOW_IHANDLER; > public static boolean DEBUG_SHOW_RECONCILER; >- >- >- public static String HTTP_PROXY_HOST = "org.eclipse.update.core.proxy.host"; //$NON-NLS-1$ >- public static String HTTP_PROXY_PORT = "org.eclipse.update.core.proxy.port"; //$NON-NLS-1$ >- public static String HTTP_PROXY_ENABLE = "org.eclipse.update.core.proxy.enable"; //$NON-NLS-1$ >- >- // preference keys >- public static final String P_HTTP_HOST = "http.proxyHost"; //$NON-NLS-1$ >- public static final String P_HTTP_PORT = "http.proxyPort"; //$NON-NLS-1$ >- public static final String P_HTTP_PROXY = "http.proxySet"; //$NON-NLS-1$ > > private static final String PREFIX = "org.eclipse.update.core"; //$NON-NLS-1$ > public static final String P_HISTORY_SIZE = PREFIX + ".historySize"; //$NON-NLS-1$ >@@ -79,6 +71,7 @@ > private BundleContext context; > private ServiceTracker pkgAdminTracker; > private ServiceTracker verifierFactoryTracker; >+ private ServiceTracker proxyTracker; > > // Session > private UpdateSession updateSession = null; >@@ -261,8 +254,6 @@ > } catch (IOException e){ > warn("",e); //$NON-NLS-1$ > } >- >- initProxySettings(); > } > /* (non-Javadoc) > * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) >@@ -287,6 +278,10 @@ > verifierFactoryTracker.close(); > verifierFactoryTracker = null; > } >+ if (proxyTracker != null) { >+ proxyTracker.close(); >+ proxyTracker = null; >+ } > } > > BundleContext getBundleContext() { >@@ -301,26 +296,13 @@ > return (PackageAdmin)pkgAdminTracker.getService(); > } > >- private void initProxySettings() { >- // Get system properties for proxy setup. >- // If system properties are not set then pick up values from preference store >- String httpProxyHost = System.getProperty(P_HTTP_HOST) != null ? >- System.getProperty(P_HTTP_HOST) >- : getPluginPreferences().getString(HTTP_PROXY_HOST); >- if ("".equals(httpProxyHost)) //$NON-NLS-1$ >- httpProxyHost = null; >- >- String httpProxyPort = System.getProperty(P_HTTP_PORT) != null ? >- System.getProperty(P_HTTP_PORT) >- : getPluginPreferences().getString(HTTP_PROXY_PORT); >- if ("".equals(httpProxyPort)) //$NON-NLS-1$ >- httpProxyPort = null; >- >- boolean httpProxyEnable = System.getProperty(P_HTTP_HOST) != null && System.getProperty(P_HTTP_PORT) != null ? >- true >- : getPluginPreferences().getBoolean(HTTP_PROXY_ENABLE); >- >- SiteManager.setHttpProxyInfo(httpProxyEnable, httpProxyHost, httpProxyPort ); >+ public IProxyService getProxyService() { >+ if (proxyTracker == null) { >+ proxyTracker=new ServiceTracker(getBundle().getBundleContext(), >+ IProxyService.class.getName(), null); >+ proxyTracker.open(); >+ } >+ return (IProxyService)proxyTracker.getService(); > } > > >Index: src/org/eclipse/update/core/SiteManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.update.core/src/org/eclipse/update/core/SiteManager.java,v >retrieving revision 1.57 >diff -u -r1.57 SiteManager.java >--- src/org/eclipse/update/core/SiteManager.java 11 Apr 2006 16:37:57 -0000 1.57 >+++ src/org/eclipse/update/core/SiteManager.java 5 Mar 2007 23:02:01 -0000 >@@ -11,11 +11,14 @@ > *******************************************************************************/ > package org.eclipse.update.core; > >-import java.net.*; >+import java.net.URL; > >+import org.eclipse.core.net.proxy.IProxyData; >+import org.eclipse.core.net.proxy.IProxyService; > import org.eclipse.core.runtime.*; >-import org.eclipse.update.configuration.*; >-import org.eclipse.update.internal.core.*; >+import org.eclipse.update.configuration.ILocalSite; >+import org.eclipse.update.internal.core.InternalSiteManager; >+import org.eclipse.update.internal.core.UpdateCore; > > /** > * Site Manager. >@@ -243,26 +246,52 @@ > } > > /** >- * Returns the HTTP Proxy Server or <code>null</code> if none >+ * Returns the HTTP Proxy Server or <code>null</code> if none. > * @return the HTTP proxy Server >+ * @deprecated clients should access the {@link IProxyService} directly > */ > public static String getHttpProxyServer() { >- return UpdateCore.getPlugin().getPluginPreferences().getString(UpdateCore.HTTP_PROXY_HOST); >+ IProxyService service = UpdateCore.getPlugin().getProxyService(); >+ if (service != null && service.isProxiesEnabled()) { >+ IProxyData data = service.getProxyData(IProxyData.HTTP_PROXY_TYPE); >+ if (data != null) >+ return data.getHost(); >+ >+ } >+ return null; > } > /** > * Returns the HTTP Proxy Port or <code>null</code> if none >- * @return the HTTP proxy Port >+ * @return the HTTP proxy Port >+ * @deprecated clients should access the {@link IProxyService} directly > */ > public static String getHttpProxyPort() { >- return UpdateCore.getPlugin().getPluginPreferences().getString(UpdateCore.HTTP_PROXY_PORT); >+ IProxyService service = UpdateCore.getPlugin().getProxyService(); >+ if (service != null && service.isProxiesEnabled()) { >+ IProxyData data = service.getProxyData(IProxyData.HTTP_PROXY_TYPE); >+ if (data != null) { >+ if (data.getPort() == -1) >+ return "80"; >+ return String.valueOf(data.getPort()); >+ } >+ >+ } >+ return null; > } >+ > /** > * Returns <code>true</code> if the connection should use the > * http proxy server, <code>false</code> otherwise > * @return is the http proxy server enable >+ * @deprecated clients should access the {@link IProxyService} directly > */ > public static boolean isHttpProxyEnable() { >- return isHttpProxyEnable; >+ IProxyService service = UpdateCore.getPlugin().getProxyService(); >+ if (service != null && service.isProxiesEnabled()) { >+ IProxyData data = service.getProxyData(IProxyData.HTTP_PROXY_TYPE); >+ return (data != null && data.getHost() != null); >+ } >+ return false; > } > /** > * Sets the HTTP Proxy information >@@ -273,33 +302,40 @@ > * > * @param enable <code>true</code> if the connection should use an http > * proxy server, <code>false </code> otherwise. >- * @param httpProxyServer the HTTP proxy server name or IP adress >+ * @param httpProxyServer the HTTP proxy server name or IP address > * @param httpProxyPort the HTTP proxy port >+ * >+ * @deprecated clients should use the {@link IProxyService} directly > */ > public static void setHttpProxyInfo(boolean enable, String httpProxyServer, String httpProxyPort) { >- isHttpProxyEnable = enable; >- >- // if enable is false, or values are null, >- // we should remove the properties and save the fact that proxy is disable >- if (!enable || httpProxyServer == null || httpProxyPort == null) { >- System.getProperties().remove(UpdateCore.P_HTTP_HOST); >- System.getProperties().remove(UpdateCore.P_HTTP_PORT); >- System.getProperties().remove(UpdateCore.P_HTTP_PROXY); >- //if (UpdateCore.DEBUG && UpdateCore.DEBUG_SHOW_WARNINGS) >- UpdateCore.warn("Remove proxy server info"); //$NON-NLS-1$ >- UpdateCore.getPlugin().getPluginPreferences().setValue(UpdateCore.HTTP_PROXY_ENABLE, enable); >- UpdateCore.getPlugin().savePluginPreferences(); >+ IProxyService service = UpdateCore.getPlugin().getProxyService(); >+ if (service == null) > return; >+ // Make sure that the proxy service is enabled if needed but don't disable the >+ // service if the http proxy is being disabled >+ if (enable && !service.isProxiesEnabled()) >+ service.setProxiesEnabled(enable); >+ >+ if (service.isProxiesEnabled()) { >+ IProxyData data = service.getProxyData(IProxyData.HTTP_PROXY_TYPE); >+ if (data != null) { >+ data.setHost(httpProxyServer); >+ if (httpProxyPort == null || httpProxyPort.equals("80")) { >+ data.setPort(-1); >+ } else { >+ try { >+ int port = Integer.parseInt(httpProxyPort); >+ data.setPort(port); >+ } catch (NumberFormatException e) { >+ UpdateCore.log(e); >+ } >+ } >+ try { >+ service.setProxyData(new IProxyData[] { data }); >+ } catch (CoreException e) { >+ UpdateCore.log(e); >+ } >+ } > } >- >- System.getProperties().setProperty(UpdateCore.P_HTTP_PROXY, enable?"true":"false"); //$NON-NLS-1$ //$NON-NLS-2$ >- System.getProperties().setProperty(UpdateCore.P_HTTP_HOST, httpProxyServer); >- System.getProperties().setProperty(UpdateCore.P_HTTP_PORT, httpProxyPort); >- //if (UpdateCore.DEBUG && UpdateCore.DEBUG_SHOW_WARNINGS) >- UpdateCore.warn("Added proxy server info:" + httpProxyServer + ":" + httpProxyPort); //$NON-NLS-1$ //$NON-NLS-2$ >- UpdateCore.getPlugin().getPluginPreferences().setValue(UpdateCore.HTTP_PROXY_HOST, httpProxyServer); >- UpdateCore.getPlugin().getPluginPreferences().setValue(UpdateCore.HTTP_PROXY_PORT, httpProxyPort); >- UpdateCore.getPlugin().getPluginPreferences().setValue(UpdateCore.HTTP_PROXY_ENABLE, enable); >- UpdateCore.getPlugin().savePluginPreferences(); > } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 154100
:
57322
|
57323
|
57823
|
57825
|
57854
|
57855
|
57894
|
57897
|
58137
|
58140
|
59190
|
60292
| 60293