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 119991 Details for
Bug 257443
[Net] Add a facility to set a custom proxy provider
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed initial patch.
ProxyPatch.patch (text/plain), 89.58 KB, created by
Mark A. Ziesemer
on 2008-12-09 22:20:25 EST
(
hide
)
Description:
Proposed initial patch.
Filename:
MIME Type:
Creator:
Mark A. Ziesemer
Created:
2008-12-09 22:20:25 EST
Size:
89.58 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.core.net >Index: src/org/eclipse/core/internal/net/ProxyType.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyType.java,v >retrieving revision 1.14 >diff -u -r1.14 ProxyType.java >--- src/org/eclipse/core/internal/net/ProxyType.java 20 Nov 2008 15:50:09 -0000 1.14 >+++ src/org/eclipse/core/internal/net/ProxyType.java 10 Dec 2008 02:46:00 -0000 >@@ -30,6 +30,9 @@ > > public class ProxyType implements INodeChangeListener, IPreferenceChangeListener { > >+ // TODO: ProxyType should be a data container object only. >+ // Most of the logic, including anything proxy-type specific, should be moved into the various provider implementations. >+ > /** > * Preference keys > */ >@@ -176,7 +179,8 @@ > updatePreferences(getPreferenceNode(), proxyData); > } > >- /* package */ void updatePreferencesIfMissing(Preferences node, IProxyData proxyData) { >+ // TODO: Remove public. Temporarily needed for child-package access from EclipseProvider. >+ public void updatePreferencesIfMissing(Preferences node, IProxyData proxyData) { > Preferences proxyNode = node.node(PREF_PROXY_DATA_NODE).node(getName()); > if (node.get(PREF_PROXY_HOST, null) == null) > updatePreferences(proxyNode, proxyData); >@@ -205,7 +209,8 @@ > } > } > >- /* package */void updateSystemProperties(IProxyData proxyData, boolean proxiesEnabled) { >+ // TODO: Remove public. Temporarily needed for child-package access from EclipseProvider. >+ public void updateSystemProperties(IProxyData proxyData, boolean proxiesEnabled) { > try { > if (proxyData.getType().equals(IProxyData.HTTP_PROXY_TYPE)) { > updateHttpSystemProperties(proxyData, proxiesEnabled); >Index: src/org/eclipse/core/internal/net/PreferenceModifyListener.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.net/src/org/eclipse/core/internal/net/PreferenceModifyListener.java,v >retrieving revision 1.5 >diff -u -r1.5 PreferenceModifyListener.java >--- src/org/eclipse/core/internal/net/PreferenceModifyListener.java 3 Jun 2008 13:35:40 -0000 1.5 >+++ src/org/eclipse/core/internal/net/PreferenceModifyListener.java 10 Dec 2008 02:45:54 -0000 >@@ -10,10 +10,7 @@ > *******************************************************************************/ > package org.eclipse.core.internal.net; > >-import org.eclipse.core.runtime.preferences.ConfigurationScope; > import org.eclipse.core.runtime.preferences.IEclipsePreferences; >-import org.eclipse.core.runtime.preferences.InstanceScope; >-import org.osgi.service.prefs.BackingStoreException; > > public class PreferenceModifyListener extends > org.eclipse.core.runtime.preferences.PreferenceModifyListener { >@@ -23,13 +20,14 @@ > } > > public IEclipsePreferences preApply(IEclipsePreferences node) { >- try { >- if (node.nodeExists(InstanceScope.SCOPE)) { >- ((ProxyManager)ProxyManager.getProxyManager()).migrateInstanceScopePreferences(node.node(InstanceScope.SCOPE), node.node(ConfigurationScope.SCOPE), false); >- } >- } catch (BackingStoreException e) { >- Activator.logError("Could not access instance preferences", e); //$NON-NLS-1$ >- } >+ // TODO: Fix and re-enable preApply if needed. >+// try { >+// if (node.nodeExists(InstanceScope.SCOPE)) { >+// ((ProxyManager)ProxyManager.getProxyManager()).migrateInstanceScopePreferences(node.node(InstanceScope.SCOPE), node.node(ConfigurationScope.SCOPE), false); >+// } >+// } catch (BackingStoreException e) { >+// Activator.logError("Could not access instance preferences", e); //$NON-NLS-1$ >+// } > return super.preApply(node); > } > >Index: src/org/eclipse/core/internal/net/Activator.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.net/src/org/eclipse/core/internal/net/Activator.java,v >retrieving revision 1.6 >diff -u -r1.6 Activator.java >--- src/org/eclipse/core/internal/net/Activator.java 21 May 2008 09:18:56 -0000 1.6 >+++ src/org/eclipse/core/internal/net/Activator.java 10 Dec 2008 02:45:54 -0000 >@@ -50,6 +50,7 @@ > private static final String PROP_REGISTER_SERVICE = "org.eclipse.net.core.enableProxyService"; //$NON-NLS-1$ > > public static final String PT_AUTHENTICATOR = "authenticator"; //$NON-NLS-1$ >+ public static final String PT_PROVIDER = "provider"; //$NON-NLS-1$ > > private BundleContext bundleContext; > >@@ -174,8 +175,7 @@ > > if (Boolean > .valueOf(System.getProperty(PROP_REGISTER_SERVICE, "true")).booleanValue()) { //$NON-NLS-1$ >- ProxyManager proxyManager = (ProxyManager) ProxyManager >- .getProxyManager(); >+ ProxyManager proxyManager = ProxyManager.getProxyManager(); > proxyManager.initialize(); > proxyService = context.registerService(IProxyService.class > .getName(), proxyManager, new Hashtable()); >Index: src/org/eclipse/core/internal/net/AbstractProxyProvider.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.net/src/org/eclipse/core/internal/net/AbstractProxyProvider.java,v >retrieving revision 1.5 >diff -u -r1.5 AbstractProxyProvider.java >--- src/org/eclipse/core/internal/net/AbstractProxyProvider.java 18 Nov 2008 15:16:53 -0000 1.5 >+++ src/org/eclipse/core/internal/net/AbstractProxyProvider.java 10 Dec 2008 02:45:52 -0000 >@@ -14,9 +14,11 @@ > import java.net.URI; > > import org.eclipse.core.net.proxy.IProxyData; >+import org.eclipse.core.net.proxy.IProxyProvider; > > /** > * Returns proxies to use. >+ * @deprecated Use {@link IProxyProvider} instead. > */ > public abstract class AbstractProxyProvider { > >@@ -51,9 +53,9 @@ > return proxies; > } > >- protected abstract IProxyData[] getProxyData(URI uri); >+ public abstract IProxyData[] getProxyData(URI uri); > >- protected abstract IProxyData[] getProxyData(); >+ public abstract IProxyData[] getProxyData(); > >- protected abstract String[] getNonProxiedHosts(); >+ public abstract String[] getNonProxiedHosts(); > } >Index: src/org/eclipse/core/internal/net/WindowsProxyProvider.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.net/src/org/eclipse/core/internal/net/WindowsProxyProvider.java,v >retrieving revision 1.5 >diff -u -r1.5 WindowsProxyProvider.java >--- src/org/eclipse/core/internal/net/WindowsProxyProvider.java 18 Nov 2008 15:16:52 -0000 1.5 >+++ src/org/eclipse/core/internal/net/WindowsProxyProvider.java 10 Dec 2008 02:46:00 -0000 >@@ -37,15 +37,15 @@ > winHttpProxyProvider = new WinHttpProxyProvider(); > } > >- protected IProxyData[] getProxyData(URI uri) { >+ public IProxyData[] getProxyData(URI uri) { > return winHttpProxyProvider.getProxyData(uri); > } > >- protected IProxyData[] getProxyData() { >+ public IProxyData[] getProxyData() { > return winHttpProxyProvider.getProxyData(); > } > >- protected String[] getNonProxiedHosts() { >+ public String[] getNonProxiedHosts() { > return winHttpProxyProvider.getNonProxiedHosts(); > } > >Index: src/org/eclipse/core/internal/net/ProxyManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyManager.java,v >retrieving revision 1.22 >diff -u -r1.22 ProxyManager.java >--- src/org/eclipse/core/internal/net/ProxyManager.java 25 Nov 2008 08:10:11 -0000 1.22 >+++ src/org/eclipse/core/internal/net/ProxyManager.java 10 Dec 2008 02:45:56 -0000 >@@ -7,21 +7,20 @@ > * > * Contributors: > * IBM Corporation - initial API and implementation >+ * Mark A. Ziesemer - Refactoring into seperate extensions. > *******************************************************************************/ > package org.eclipse.core.internal.net; > >-import java.net.Authenticator; > import java.net.URI; >-import java.net.URISyntaxException; >-import java.util.ArrayList; >+import java.util.LinkedList; > import java.util.List; >-import java.util.Properties; > >+import org.eclipse.core.internal.net.providers.DirectProvider; > import org.eclipse.core.net.proxy.IProxyChangeEvent; > import org.eclipse.core.net.proxy.IProxyChangeListener; > import org.eclipse.core.net.proxy.IProxyData; >+import org.eclipse.core.net.proxy.IProxyProvider; > import org.eclipse.core.net.proxy.IProxyService; >-import org.eclipse.core.runtime.Assert; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IConfigurationElement; > import org.eclipse.core.runtime.IExtension; >@@ -30,65 +29,86 @@ > import org.eclipse.core.runtime.ListenerList; > import org.eclipse.core.runtime.RegistryFactory; > import org.eclipse.core.runtime.SafeRunner; >-import org.eclipse.core.runtime.preferences.ConfigurationScope; > import org.eclipse.core.runtime.preferences.IEclipsePreferences; >-import org.eclipse.core.runtime.preferences.InstanceScope; > import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener; > import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent; > import org.eclipse.osgi.util.NLS; >-import org.osgi.service.prefs.BackingStoreException; >-import org.osgi.service.prefs.Preferences; > > public class ProxyManager implements IProxyService, IPreferenceChangeListener { > >- private static final String PREF_HAS_MIGRATED = "org.eclipse.core.net.hasMigrated"; //$NON-NLS-1$ >+ private static final String PREF_PROVIDER = "provider"; //$NON-NLS-1$ >+ private static final String PROVIDER_DEFAULT = DirectProvider.class.getName(); > >- /** >- * Preference constants used by Update to record the HTTP proxy >- */ >- private static String HTTP_PROXY_HOST = "org.eclipse.update.core.proxy.host"; //$NON-NLS-1$ >- private static String HTTP_PROXY_PORT = "org.eclipse.update.core.proxy.port"; //$NON-NLS-1$ >- private static String HTTP_PROXY_ENABLE = "org.eclipse.update.core.proxy.enable"; //$NON-NLS-1$ >- >- private static final String PREF_NON_PROXIED_HOSTS = "nonProxiedHosts"; //$NON-NLS-1$ >- private static final String PREF_ENABLED = "proxiesEnabled"; //$NON-NLS-1$ >- private static final String PREF_OS = "systemProxiesEnabled"; //$NON-NLS-1$ >- >- private static IProxyService proxyManager; >+ private static ProxyManager proxyManager; > >- private AbstractProxyProvider nativeProxyProvider; >+ private IProxyProvider provider; > > ListenerList listeners = new ListenerList(ListenerList.IDENTITY); >- private String[] nonProxiedHosts; >- private final ProxyType[] proxies = new ProxyType[] { >- new ProxyType(IProxyData.HTTP_PROXY_TYPE), >- new ProxyType(IProxyData.HTTPS_PROXY_TYPE), >- new ProxyType(IProxyData.SOCKS_PROXY_TYPE) >- }; >- >- private boolean migrated = false; >- >- private ProxyManager() { >- try { >- nativeProxyProvider = (AbstractProxyProvider) Class.forName( >- "org.eclipse.core.net.ProxyProvider").newInstance(); //$NON-NLS-1$ >- } catch (ClassNotFoundException e) { >- // no class found >- } catch (Exception e) { >- Activator.logInfo("Problems occured during the proxy provider initialization.", e); //$NON-NLS-1$ >- } >- } > > /** > * Return the proxy manager. > * @return the proxy manager > */ >- public synchronized static IProxyService getProxyManager() { >+ public synchronized static ProxyManager getProxyManager() { > if (proxyManager == null) > proxyManager = new ProxyManager(); > return proxyManager; > } > >+ public void initialize() { >+ ((IEclipsePreferences)Activator.getInstance().getPreferences()) >+ .addPreferenceChangeListener(this); >+ registerProvider(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.net.proxy.IProxyService#getProviders() >+ */ >+ public IProxyProvider[] getProviders(){ >+ List resultList = new LinkedList(); >+ IExtension[] extensions = RegistryFactory.getRegistry().getExtensionPoint(Activator.ID, Activator.PT_PROVIDER).getExtensions(); >+ for(int i=0; i<extensions.length; i++){ >+ IExtension extension = extensions[i]; >+ IConfigurationElement[] configs = extension.getConfigurationElements(); >+ if(configs.length == 0){ >+ Activator.log(IStatus.ERROR, NLS.bind("Provider {0} is missing required fields", //$NON-NLS-1$ >+ (new Object[]{extension.getUniqueIdentifier()})), null); >+ }else{ >+ try{ >+ IConfigurationElement config = configs[0]; >+ IProxyProvider ipp = (IProxyProvider)config.createExecutableExtension("class"); //$NON-NLS-1$ >+ resultList.add(ipp); >+ }catch(CoreException ex){ >+ Activator.log(IStatus.ERROR, NLS.bind("Unable to instantiate provider {0}", //$NON-NLS-1$ >+ (new Object[]{extension.getUniqueIdentifier()})), ex); >+ } >+ } >+ } >+ IProxyProvider[] result = new IProxyProvider[resultList.size()]; >+ resultList.toArray(result); >+ return result; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.net.proxy.IProxyService#getProvider() >+ */ >+ public IProxyProvider getProvider(){ >+ return provider; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.net.proxy.IProxyService#setProvider(org.eclipse.core.net.proxy.IProxyProvider) >+ */ >+ public void setProvider(IProxyProvider provider){ >+ if(provider == null){ >+ throw new IllegalArgumentException("Provider must not be null."); //$NON-NLS-1$ >+ } >+ this.provider = provider; >+ Activator.getInstance().getPreferences().put(PREF_PROVIDER, provider.getClass().getName()); >+ // TODO: Remove log statement. >+ Activator.logInfo("Loaded provider: " + provider.getClass().getName(), null); //$NON-NLS-1$ >+ } >+ > /* (non-Javadoc) > * @see org.eclipse.core.net.IProxyManager#addProxyChangeListener(org.eclipse.core.net.IProxyChangeListener) > */ >@@ -103,7 +123,7 @@ > listeners.remove(listener); > } > >- private void fireChange(final IProxyChangeEvent event) { >+ public void fireChange(final IProxyChangeEvent event) { > Object[] l = listeners.getListeners(); > for (int i = 0; i < l.length; i++) { > final IProxyChangeListener listener = (IProxyChangeListener)l[i]; >@@ -117,477 +137,94 @@ > }); > } > } >- >- /* (non-Javadoc) >- * @see org.eclipse.core.net.IProxyManager#getNonProxiedHosts() >- */ >- public synchronized String[] getNonProxiedHosts() { >- checkMigrated(); >- if (nonProxiedHosts == null) { >- String prop = Activator.getInstance().getPreferences().get(PREF_NON_PROXIED_HOSTS, "localhost|127.0.0.1"); //$NON-NLS-1$ >- nonProxiedHosts = ProxyType.convertPropertyStringToHosts(prop); >- } >- if (nonProxiedHosts.length == 0) >- return nonProxiedHosts; >- String[] result = new String[nonProxiedHosts.length]; >- System.arraycopy(nonProxiedHosts, 0, result, 0, nonProxiedHosts.length ); >- return result; >- } >- >- public String[] getNativeNonProxiedHosts() { >- if (hasSystemProxies()) { >- return nativeProxyProvider.getNonProxiedHosts(); >- } >- return new String[0]; >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.core.net.IProxyManager#setNonProxiedHosts(java.lang.String[]) >- */ >- public void setNonProxiedHosts(String[] hosts) { >- checkMigrated(); >- Assert.isNotNull(hosts); >- for (int i = 0; i < hosts.length; i++) { >- String host = hosts[i]; >- Assert.isNotNull(host); >- Assert.isTrue(host.length() > 0); >- } >- String[] oldHosts = nonProxiedHosts; >- nonProxiedHosts = hosts; >- Activator.getInstance().getPreferences().put(PREF_NON_PROXIED_HOSTS, ProxyType.convertHostsToPropertyString(nonProxiedHosts)); >- try { >- Activator.getInstance().getPreferences().flush(); >- } catch (BackingStoreException e) { >- Activator.logError( >- "An error occurred while writing out the non-proxied hosts list", e); //$NON-NLS-1$ >- } >- IProxyData[] data = getProxyData(); >- IProxyChangeEvent event = new ProxyChangeEvent(IProxyChangeEvent.NONPROXIED_HOSTS_CHANGED, oldHosts, getNonProxiedHosts(), data, new IProxyData[0]); >- fireChange(event); >- } >- > >- public IProxyData[] getProxyData() { >- checkMigrated(); >- IProxyData[] result = new IProxyData[proxies.length]; >- for (int i = 0; i < proxies.length; i++) { >- ProxyType type = proxies[i]; >- result[i] = type.getProxyData(ProxyType.VERIFY_EQUAL); >- } >- return resolveType(result); >- } >- >- public IProxyData[] getNativeProxyData() { >- if (hasSystemProxies()) { >- return resolveType(nativeProxyProvider.getProxyData()); >- } >- return new IProxyData[0]; >- } >- >- public void setProxyData(IProxyData[] proxies) { >- checkMigrated(); >- doSetProxyData(proxies); >- } >- >- private void doSetProxyData(IProxyData[] proxyDatas) { >- IProxyData[] oldData = getProxyData(); >- String[] hosts = getNonProxiedHosts(); >- IProxyData[] changedProxies = internalSetProxyData(proxyDatas); >- if (changedProxies.length > 0) { >- IProxyChangeEvent event = new ProxyChangeEvent(IProxyChangeEvent.PROXY_SERVICE_ENABLEMENT_CHANGE, hosts, hosts, oldData, changedProxies); >- fireChange(event); >- } >- } >- >- private IProxyData[] internalSetProxyData(IProxyData[] proxyDatas) { >- List result = new ArrayList(); >- for (int i = 0; i < proxyDatas.length; i++) { >- IProxyData proxyData = proxyDatas[i]; >- ProxyType type = getType(proxyData); >- if (type != null && type.setProxyData(proxyData, internalIsProxiesEnabled())) { >- result.add(proxyData); >+ private void registerProvider(){ >+ String configuredProviderId = Activator.getInstance().getPreferences().get(PREF_PROVIDER, PROVIDER_DEFAULT); >+ IProxyProvider[] providers = getProviders(); >+ IProxyProvider resultProvider = null; >+ for(int i=0; resultProvider == null && i<providers.length; i++){ >+ IProxyProvider ipp = providers[i]; >+ if(configuredProviderId.equals(ipp.getClass().getName())){ >+ resultProvider = ipp; > } > } >- return (IProxyData[]) result.toArray(new IProxyData[result.size()]); >- } >- >- private ProxyType getType(IProxyData proxyData) { >- for (int i = 0; i < proxies.length; i++) { >- ProxyType type = proxies[i]; >- if (type.getName().equals(proxyData.getType())) { >- return type; >- } >+ if(resultProvider != null){ >+ setProvider(resultProvider); >+ }else{ >+ Activator.logError("Unable to find and load a proxy provider.", null); //$NON-NLS-1$ > } >- return null; > } >- >+ > /* (non-Javadoc) >- * @see org.eclipse.core.net.IProxyManager#isProxiesEnabled() >+ * @see org.eclipse.core.net.proxy.IProxyService#select(java.net.URI) > */ >- public boolean isProxiesEnabled() { >- checkMigrated(); >- return internalIsProxiesEnabled() >- && (!isSystemProxiesEnabled() || (isSystemProxiesEnabled() && hasSystemProxies())); >- } >- >- private boolean internalIsProxiesEnabled() { >- return Activator.getInstance().getPreferences().getBoolean( >- PREF_ENABLED, true); >+ public IProxyData[] select(URI uri){ >+ return provider.select(uri); > } >- >- /* (non-Javadoc) >- * @see org.eclipse.core.net.IProxyManager#setProxiesEnabled(boolean) >- */ >- public void setProxiesEnabled(boolean enabled) { >- checkMigrated(); >- boolean current = internalIsProxiesEnabled(); >- if (current == enabled) >- return; >- // Setting the preference will trigger the system property update >- // (see preferenceChange) >- Activator.getInstance().getPreferences().putBoolean(PREF_ENABLED, enabled); >- } >- >- private void internalSetEnabled(boolean enabled, boolean systemEnabled) { >- Properties sysProps = System.getProperties(); >- sysProps.put("proxySet", enabled ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >- sysProps.put("systemProxySet", systemEnabled ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >- updateSystemProperties(); >- try { >- Activator.getInstance().getPreferences().flush(); >- } catch (BackingStoreException e) { >- Activator.logError( >- "An error occurred while writing out the enablement state", e); //$NON-NLS-1$ >- } >- String[] hosts = getNonProxiedHosts(); >- IProxyData[] data = getProxyData(); >- IProxyChangeEvent event = new ProxyChangeEvent(IProxyChangeEvent.PROXY_DATA_CHANGED, hosts, hosts, data, data); >- fireChange(event); >- } >- >- private void updateSystemProperties() { >- for (int i = 0; i < proxies.length; i++) { >- ProxyType type = proxies[i]; >- type.updateSystemProperties(internalGetProxyData(type.getName(), ProxyType.DO_NOT_VERIFY), internalIsProxiesEnabled()); >- } >- } >- >- public void initialize() { >- checkMigrated(); >- ((IEclipsePreferences)Activator.getInstance().getPreferences()).addPreferenceChangeListener(this); >- // Now initialize each proxy type >- for (int i = 0; i < proxies.length; i++) { >- ProxyType type = proxies[i]; >- type.initialize(internalIsProxiesEnabled()); >- } >- registerAuthenticator(); >- } >- >- public IProxyData getProxyData(String type) { >- checkMigrated(); >- return resolveType(internalGetProxyData(type, ProxyType.VERIFY_EQUAL)); >- } >- >- private IProxyData internalGetProxyData(String type, int verifySystemProperties) { >- for (int i = 0; i < proxies.length; i++) { >- ProxyType pt = proxies[i]; >- if (pt.getName().equals(type)) { >- return pt.getProxyData(verifySystemProperties); >- } >- } >- return null; >- } >- >- public IProxyData[] getProxyDataForHost(String host) { >- checkMigrated(); >- if (!internalIsProxiesEnabled()) { >- return new IProxyData[0]; >- } >- URI uri = tryGetURI(host); >- if (uri == null) { >- return new IProxyData[0]; >- } >- if (hasSystemProxies() && isSystemProxiesEnabled()) { >- return resolveType(nativeProxyProvider.select(uri)); >- } >- >- if (isHostFiltered(uri)) >- return new IProxyData[0]; >- IProxyData[] data = getProxyData(); >- List result = new ArrayList(); >- for (int i = 0; i < data.length; i++) { >- IProxyData proxyData = data[i]; >- if (proxyData.getHost() != null) >- result.add(proxyData); >- } >- IProxyData ret[] = (IProxyData[]) result.toArray(new IProxyData[result.size()]); >- return resolveType(ret); >- } >- >- public static URI tryGetURI(String host) { >- try { >- int i = host.indexOf(":"); //$NON-NLS-1$ >- if (i == -1) { >- return new URI("//" + host); //$NON-NLS-1$ >- } >- return new URI(host.substring(i + 1)); >- } catch (URISyntaxException e) { >- return null; >- } >+ >+ public void preferenceChange(PreferenceChangeEvent event){ >+ // Nothing to do. >+ // TODO: Is this even needed? Remove preference listener, and let implementing providers register for? > } > >- private boolean isHostFiltered(URI uri) { >- String[] filters = getNonProxiedHosts(); >- for (int i = 0; i < filters.length; i++) { >- String filter = filters[i]; >- if (matchesFilter(uri.getHost(), filter)) >- return true; >- } >- return false; >+ /** @deprecated */ >+ public String[] getNonProxiedHosts(){ >+ throw new UnsupportedOperationException(); > } > >- private boolean matchesFilter(String host, String filter) { >- StringMatcher matcher = new StringMatcher(filter, true, false); >- return matcher.match(host); >+ /** @deprecated */ >+ public IProxyData[] getProxyData(){ >+ throw new UnsupportedOperationException(); > } > >- /* (non-Javadoc) >- * @see org.eclipse.net.core.IProxyManager#getProxyDataForHost(java.lang.String, java.lang.String) >- */ >- public IProxyData getProxyDataForHost(String host, String type) { >- checkMigrated(); >- if (!internalIsProxiesEnabled()) { >- return null; >- } >- if (hasSystemProxies() && isSystemProxiesEnabled()) >- try { >- URI uri = new URI(type, "//" + host, null); //$NON-NLS-1$ >- IProxyData[] proxyDatas = nativeProxyProvider.select(uri); >- return proxyDatas.length > 0 ? resolveType(nativeProxyProvider.select(uri)[0]) : null; >- } catch (URISyntaxException e) { >- return null; >- } >- >- IProxyData[] data = getProxyDataForHost(host); >- for (int i = 0; i < data.length; i++) { >- IProxyData proxyData = data[i]; >- if (proxyData.getType().equalsIgnoreCase(type) >- && proxyData.getHost() != null) >- return resolveType(proxyData); >- } >- return null; >- } >- >- private void registerAuthenticator() { >- Authenticator a = getPluggedInAuthenticator(); >- if (a != null) { >- Authenticator.setDefault(a); >- } >- } >- >- private Authenticator getPluggedInAuthenticator() { >- IExtension[] extensions = RegistryFactory.getRegistry().getExtensionPoint(Activator.ID, Activator.PT_AUTHENTICATOR).getExtensions(); >- if (extensions.length == 0) >- return null; >- IExtension extension = extensions[0]; >- IConfigurationElement[] configs = extension.getConfigurationElements(); >- if (configs.length == 0) { >- Activator.log(IStatus.ERROR, NLS.bind("Authenticator {0} is missing required fields", (new Object[] {extension.getUniqueIdentifier()})), null);//$NON-NLS-1$ >- return null; >- } >- try { >- IConfigurationElement config = configs[0]; >- return (Authenticator) config.createExecutableExtension("class");//$NON-NLS-1$ >- } catch (CoreException ex) { >- Activator.log(IStatus.ERROR, NLS.bind("Unable to instantiate authenticator {0}", (new Object[] {extension.getUniqueIdentifier()})), ex);//$NON-NLS-1$ >- return null; >- } >+ /** @deprecated */ >+ public IProxyData getProxyData(String type){ >+ throw new UnsupportedOperationException(); > } > >- >- private synchronized void checkMigrated() { >- if (migrated || !Activator.getInstance().instanceLocationAvailable()) >- return; >- >- migrated = true; >- if (Activator.getInstance().getPreferences().getBoolean(PREF_HAS_MIGRATED, false)) >- return; >- >- Activator.getInstance().getPreferences().putBoolean(PREF_HAS_MIGRATED, true); >- migrateInstanceScopePreferences(new InstanceScope().getNode(""), new ConfigurationScope().getNode(""), true); //$NON-NLS-1$//$NON-NLS-2$ >- } >- >- void migrateInstanceScopePreferences(Preferences instanceNode, Preferences configurationNode, boolean isInitialize) { >- migrateUpdateHttpProxy(instanceNode, isInitialize); >- >- Preferences netInstancePrefs = instanceNode.node(Activator.ID); >- Preferences netConfigurationPrefs = configurationNode.node(Activator.ID); >- >- // migrate enabled status >- if (netConfigurationPrefs.get(PREF_ENABLED, null) == null) { >- String instanceEnabled = netInstancePrefs.get(PREF_ENABLED, null); >- if (instanceEnabled != null) >- netConfigurationPrefs.put(PREF_ENABLED, instanceEnabled); >- } >- >- // migrate enabled status >- if (netConfigurationPrefs.get(PREF_OS, null) == null) { >- String instanceEnabled = netInstancePrefs.get(PREF_OS, null); >- if (instanceEnabled != null) >- netConfigurationPrefs.put(PREF_OS, instanceEnabled); >- } >- >- // migrate non proxied hosts if not already set >- if (netConfigurationPrefs.get(PREF_NON_PROXIED_HOSTS, null) == null) { >- String instanceNonProxiedHosts = netInstancePrefs.get(PREF_NON_PROXIED_HOSTS, null); >- if (instanceNonProxiedHosts != null) { >- netConfigurationPrefs.put(PREF_NON_PROXIED_HOSTS, instanceNonProxiedHosts); >- nonProxiedHosts = null; >- } >- } >- >- // migrate proxy data >- boolean proxiesEnabled = netConfigurationPrefs.getBoolean(PREF_ENABLED, true); >- for (int i = 0; i < proxies.length; i++) { >- ProxyType type = proxies[i]; >- IProxyData data = type.getProxyData(ProxyType.DO_NOT_VERIFY); >- if (data.getHost() == null) { >- ProxyType instanceType = new ProxyType(type.getName(),netInstancePrefs); >- IProxyData instanceData = instanceType.getProxyData(ProxyType.DO_NOT_VERIFY); >- if (instanceData.getHost() != null) >- type.setProxyData(instanceData, proxiesEnabled); >- } >- } >- >- // if this an import we should remove the old node >- if (! isInitialize) { >- try { >- netInstancePrefs.removeNode(); >- } catch (BackingStoreException e) { >- // ignore >- } >- } >- } >- >- private void migrateUpdateHttpProxy(Preferences node, boolean isInitialize) { >- Preferences netPrefs = node.node(Activator.ID); >- if (!netPrefs.getBoolean(PREF_HAS_MIGRATED, false)) { >- // Only set the migration bit when initializing >- if (isInitialize) >- netPrefs.putBoolean(PREF_HAS_MIGRATED, true); >- Preferences updatePrefs = node.node("org.eclipse.update.core"); //$NON-NLS-1$ >- String httpProxyHost = getHostToMigrate(updatePrefs, isInitialize /* checkSystemProperties */); >- int port = getPortToMigrate(updatePrefs, isInitialize /* checkSystemProperties */); >- boolean httpProxyEnable = getEnablementToMigrate(updatePrefs, isInitialize /* checkSystemProperties */); >- if (httpProxyHost != null) { >- ProxyData proxyData = new ProxyData(IProxyData.HTTP_PROXY_TYPE, >- httpProxyHost, port, false, null); >- ProxyType type = getType(proxyData); >- type.updatePreferencesIfMissing(netPrefs, proxyData); >- if (httpProxyEnable) { >- netPrefs.putBoolean(ProxyManager.PREF_ENABLED, true); >- } >- } >- } >+ /** @deprecated */ >+ public IProxyData[] getProxyDataForHost(String host){ >+ throw new UnsupportedOperationException(); > } > >- private boolean getEnablementToMigrate(Preferences updatePrefs, boolean checkSystemProperties) { >- boolean httpProxyEnable = false; >- if (checkSystemProperties && updatePrefs.get(HTTP_PROXY_ENABLE, null) == null) { >- httpProxyEnable = Boolean.getBoolean("http.proxySet"); //$NON-NLS-1$ >- } else { >- httpProxyEnable = updatePrefs.getBoolean(HTTP_PROXY_ENABLE, false); >- updatePrefs.remove(HTTP_PROXY_ENABLE); >- } >- return httpProxyEnable; >+ /** @deprecated */ >+ public IProxyData getProxyDataForHost(String host, String type){ >+ throw new UnsupportedOperationException(); > } > >- private int getPortToMigrate(Preferences updatePrefs, boolean checkSystemProperties) { >- String httpProxyPort = updatePrefs.get(HTTP_PROXY_PORT, ""); //$NON-NLS-1$ >- if (checkSystemProperties && "".equals(httpProxyPort)) { //$NON-NLS-1$ >- httpProxyPort = System.getProperty("http.proxyPort", ""); //$NON-NLS-1$ //$NON-NLS-2$ >- } >- updatePrefs.remove(HTTP_PROXY_PORT); >- int port = -1; >- if (httpProxyPort != null && !"".equals(httpProxyPort)) //$NON-NLS-1$ >- try { >- port = Integer.parseInt(httpProxyPort); >- } catch (NumberFormatException e) { >- // Ignore >- } >- return port; >+ /** @deprecated */ >+ public boolean hasSystemProxies(){ >+ throw new UnsupportedOperationException(); > } > >- private String getHostToMigrate(Preferences updatePrefs, boolean checkSystemProperties) { >- String httpProxyHost = updatePrefs.get(HTTP_PROXY_HOST, ""); //$NON-NLS-1$ >- if (checkSystemProperties && "".equals(httpProxyHost)) { //$NON-NLS-1$ >- httpProxyHost = System.getProperty("http.proxyHost", ""); //$NON-NLS-1$ //$NON-NLS-2$ >- } >- if ("".equals(httpProxyHost)) //$NON-NLS-1$ >- httpProxyHost = null; >- updatePrefs.remove(HTTP_PROXY_HOST); >- return httpProxyHost; >+ /** @deprecated */ >+ public boolean isProxiesEnabled(){ >+ throw new UnsupportedOperationException(); > } > >- public void preferenceChange(PreferenceChangeEvent event) { >- if (event.getKey().equals(PREF_ENABLED) || event.getKey().equals(PREF_OS)) { >- checkMigrated(); >- internalSetEnabled(Activator.getInstance().getPreferences().getBoolean(PREF_ENABLED, true), >- Activator.getInstance().getPreferences().getBoolean(PREF_OS, true)); >- } >+ /** @deprecated */ >+ public boolean isSystemProxiesEnabled(){ >+ throw new UnsupportedOperationException(); > } > >- public boolean hasSystemProxies() { >- return nativeProxyProvider != null; >+ /** @deprecated */ >+ public void setNonProxiedHosts(String[] hosts) throws CoreException{ >+ throw new UnsupportedOperationException(); > } > >- public boolean isSystemProxiesEnabled() { >- checkMigrated(); >- return Activator.getInstance().getPreferences().getBoolean(PREF_OS, >- true); >- } >- >- public void setSystemProxiesEnabled(boolean enabled) { >- checkMigrated(); >- boolean current = isSystemProxiesEnabled(); >- if (current == enabled) >- return; >- // Setting the preference will trigger the system property update >- // (see preferenceChange) >- Activator.getInstance().getPreferences().putBoolean(PREF_OS, enabled); >- } >- >- public IProxyData[] select(URI uri) { >- IProxyData data = getProxyDataForHost(uri.getHost(), uri.getScheme()); >- if (data != null) { >- return resolveType(new IProxyData[] { data }); >- } >- return new IProxyData[0]; >+ /** @deprecated */ >+ public void setProxiesEnabled(boolean enabled){ >+ throw new UnsupportedOperationException(); > } > >- public IProxyData resolveType(IProxyData data) { >- if (data == null) { >- return null; >- } >- ProxyData d = (ProxyData) data; >- if (d.getType().equalsIgnoreCase(IProxyData.HTTP_PROXY_TYPE)) { >- d.setType(IProxyData.HTTP_PROXY_TYPE); >- } else if (d.getType().equalsIgnoreCase(IProxyData.HTTPS_PROXY_TYPE)) { >- d.setType(IProxyData.HTTPS_PROXY_TYPE); >- } else if (d.getType().equalsIgnoreCase(IProxyData.SOCKS_PROXY_TYPE)) { >- d.setType(IProxyData.SOCKS_PROXY_TYPE); >- } >- return d; >+ /** @deprecated */ >+ public void setProxyData(IProxyData[] proxies) throws CoreException{ >+ throw new UnsupportedOperationException(); > } > >- public IProxyData[] resolveType(IProxyData[] data) { >- if (data == null) { >- return null; >- } >- for (int i = 0; i < data.length; i++) { >- resolveType(data[i]); >- } >- return data; >+ /** @deprecated */ >+ public void setSystemProxiesEnabled(boolean enabled){ >+ throw new UnsupportedOperationException(); > } > > } >Index: src/org/eclipse/core/internal/net/ProxySelector.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxySelector.java,v >retrieving revision 1.3 >diff -u -r1.3 ProxySelector.java >--- src/org/eclipse/core/internal/net/ProxySelector.java 25 Nov 2008 11:08:06 -0000 1.3 >+++ src/org/eclipse/core/internal/net/ProxySelector.java 10 Dec 2008 02:45:56 -0000 >@@ -17,6 +17,8 @@ > /** > * This class adapts ProxyManager to add additional layer of providers on its > * top. >+ * >+ * @deprecated Converting to extension points ("org.eclipse.core.net.provider") instead. > */ > public class ProxySelector { > >@@ -57,14 +59,14 @@ > } > > public static ProxyData[] getProxyData(String provider) { >- ProxyManager manager = (ProxyManager) ProxyManager.getProxyManager(); >- if (provider.equals(DIRECT_PROVIDER)) { >- return new ProxyData[0]; >- } else if (provider.equals(ECLIPSE_PROVIDER)) { >- return castArray(manager.getProxyData()); >- } else if (provider.equals(NATIVE_PROVIDER)) { >- return castArray(manager.getNativeProxyData()); >- } >+// ProxyManager manager = (ProxyManager) ProxyManager.getProxyManager(); >+// if (provider.equals(DIRECT_PROVIDER)) { >+// return new ProxyData[0]; >+// } else if (provider.equals(ECLIPSE_PROVIDER)) { >+// return castArray(manager.getProxyData()); >+// } else if (provider.equals(NATIVE_PROVIDER)) { >+// return castArray(manager.getNativeProxyData()); >+// } > throw new IllegalArgumentException("Provider not supported"); //$NON-NLS-1$ > } > >@@ -98,14 +100,14 @@ > } > > public static String[] getBypassHosts(String provider) { >- ProxyManager manager = (ProxyManager) ProxyManager.getProxyManager(); >- if (provider.equals(DIRECT_PROVIDER)) { >- return new String[0]; >- } else if (provider.equals(ECLIPSE_PROVIDER)) { >- return manager.getNonProxiedHosts(); >- } else if (provider.equals(NATIVE_PROVIDER)) { >- return manager.getNativeNonProxiedHosts(); >- } >+// ProxyManager manager = (ProxyManager) ProxyManager.getProxyManager(); >+// if (provider.equals(DIRECT_PROVIDER)) { >+// return new String[0]; >+// } else if (provider.equals(ECLIPSE_PROVIDER)) { >+// return manager.getNonProxiedHosts(); >+// } else if (provider.equals(NATIVE_PROVIDER)) { >+// return manager.getNativeNonProxiedHosts(); >+// } > throw new IllegalArgumentException("Provider not supported"); //$NON-NLS-1$ > } > >Index: src/org/eclipse/core/net/proxy/IProxyService.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.net/src/org/eclipse/core/net/proxy/IProxyService.java,v >retrieving revision 1.7 >diff -u -r1.7 IProxyService.java >--- src/org/eclipse/core/net/proxy/IProxyService.java 21 Nov 2008 16:00:54 -0000 1.7 >+++ src/org/eclipse/core/net/proxy/IProxyService.java 10 Dec 2008 02:46:02 -0000 >@@ -31,6 +31,24 @@ > public interface IProxyService { > > /** >+ * Returns the available {@link IProxyProvider}s. >+ * @return The available {@link IProxyProvider}s. >+ */ >+ IProxyProvider[] getProviders(); >+ >+ /** >+ * Returns the current {@link IProxyProvider} implementation. >+ * @return The current {@link IProxyProvider} implementation. >+ */ >+ IProxyProvider getProvider(); >+ >+ /** >+ * Sets the the current {@link IProxyProvider} implementation. >+ * @param provider The {@link IProxyProvider} implementation to set. >+ */ >+ void setProvider(IProxyProvider provider); >+ >+ /** > * Sets whether proxy support should be enabled. The current proxy settings > * are still kept so clients should check the enablement using > * {@link #isProxiesEnabled()} before calling the {@link #getProxyData()} or >@@ -39,6 +57,8 @@ > * {@link #getProxyDataForHost(String, String)} method will check the > * enablement and only return data if the service is enabled. > * >+ * @deprecated Configuration should be handled through the implementation. >+ * > * @param enabled > * whether proxy support should be enabled > */ >@@ -53,6 +73,8 @@ > * enabled but {@link #hasSystemProxies()} returns <code>false</code>. > * </p> > * >+ * @deprecated Configuration should be handled through the implementation. >+ * > * @return whether proxy support should be enabled > */ > boolean isProxiesEnabled(); >@@ -60,6 +82,8 @@ > /** > * Returns whether system proxy support is available. > * >+ * @deprecated Configuration should be handled through the implementation. >+ * > * @return whether system proxy support is available > * @since 1.1 > */ >@@ -69,6 +93,8 @@ > * Sets whether system proxies should be used, when the proxy support is > * enabled. > * >+ * @deprecated Configuration should be handled through the implementation. >+ * > * @param enabled > * @since 1.1 > */ >@@ -79,6 +105,8 @@ > * Returns whether system proxy should be used when the proxy support is > * enabled. > * >+ * @deprecated Configuration should be handled through the implementation. >+ * > * @return whether system proxy is used when the proxy support is enabled > * @since 1.1 > */ >@@ -100,6 +128,8 @@ > * This method returns the proxies set via {@link #setProxyData(IProxyData[])} > * </p> > * >+ * @deprecated Configuration should be handled through the implementation. >+ * > * @return the list of know proxy types and their settings > */ > IProxyData[] getProxyData(); >@@ -154,6 +184,8 @@ > * This method returns the proxies set via {@link #setProxyData(IProxyData[])} > * </p> > * >+ * @deprecated Configuration should be handled through the implementation. >+ * > * @param type > * the proxy type > * @return the proxy data for the proxy of the given type or >@@ -200,6 +232,8 @@ > * is enabled). > * </p> > * >+ * @deprecated Configuration should be handled through the implementation. >+ * > * @param proxies > * the proxy data whose information is to be set. > * @throws CoreException >@@ -224,6 +258,8 @@ > * {@link #setNonProxiedHosts(String[])} > * </p> > * >+ * @deprecated Configuration should be handled through the implementation. >+ * > * @return the list of hosts for which non proxy should be used. > * @see #getProxyDataForHost(String) > * @see #getProxyDataForHost(String, String) >@@ -239,6 +275,8 @@ > * support is enabled). > * </p> > * >+ * @deprecated Configuration should be handled through the implementation. >+ * > * @param hosts > * the list of hosts for which non proxy should be used > * @throws CoreException >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.net/META-INF/MANIFEST.MF,v >retrieving revision 1.13 >diff -u -r1.13 MANIFEST.MF >--- META-INF/MANIFEST.MF 21 Nov 2008 10:48:40 -0000 1.13 >+++ META-INF/MANIFEST.MF 10 Dec 2008 02:45:52 -0000 >@@ -13,6 +13,7 @@ > org.eclipse.equinox.registry;bundle-version="3.4.0" > Bundle-ActivationPolicy: lazy > Export-Package: org.eclipse.core.internal.net;x-friends:="org.eclipse.ui.net", >+ org.eclipse.core.internal.net.providers;x-friends:="org.eclipse.ui.net", > org.eclipse.core.net.proxy > Bundle-RequiredExecutionEnvironment: J2SE-1.4, > CDC-1.1/Foundation-1.1 >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.net/plugin.xml,v >retrieving revision 1.2 >diff -u -r1.2 plugin.xml >--- plugin.xml 12 Apr 2007 20:55:53 -0000 1.2 >+++ plugin.xml 10 Dec 2008 02:45:51 -0000 >@@ -2,6 +2,7 @@ > <?eclipse version="3.2"?> > <plugin> > <extension-point id="authenticator" name="Authenticator" schema="schema/authenticator.exsd"/> >+ <extension-point id="provider" name="Provider" schema="schema/provider.exsd"/> > <extension > point="org.eclipse.core.runtime.preferences"> > <initializer >@@ -11,5 +12,23 @@ > class="org.eclipse.core.internal.net.PreferenceModifyListener"> > </modifier> > </extension> >+ <extension >+ point="org.eclipse.core.net.provider"> >+ <provider >+ class="org.eclipse.core.internal.net.providers.DirectProvider"> >+ </provider> >+ </extension> >+ <extension >+ point="org.eclipse.core.net.provider"> >+ <provider >+ class="org.eclipse.core.internal.net.providers.EclipseProvider"> >+ </provider> >+ </extension> >+ <extension >+ point="org.eclipse.core.net.provider"> >+ <provider >+ class="org.eclipse.core.internal.net.providers.NativeProvider"> >+ </provider> >+ </extension> > > </plugin> >Index: src/org/eclipse/core/net/proxy/IProxyProvider.java >=================================================================== >RCS file: src/org/eclipse/core/net/proxy/IProxyProvider.java >diff -N src/org/eclipse/core/net/proxy/IProxyProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/net/proxy/IProxyProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,32 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Mark A. Ziesemer 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: >+ * Mark A. Ziesemer - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.core.net.proxy; >+ >+import java.net.URI; >+ >+public interface IProxyProvider{ >+ >+ /** >+ * Returns the display name of the provider. >+ * @return The display name of the provider. >+ */ >+ String getName(); >+ >+ /** >+ * <p>Returns all the applicable proxy data to access the specified URI.</p> >+ * <p>Clients that wish to make a connection and need to determine whether to >+ * use a proxy should use this method.</p> >+ * @param uri the URI for which proxies are returned >+ * @return list of all applicable proxy data, if no proxy is applicable then >+ * an empty array is returned >+ */ >+ IProxyData[] select(URI uri); >+} >Index: src/org/eclipse/core/internal/net/providers/DirectProvider.java >=================================================================== >RCS file: src/org/eclipse/core/internal/net/providers/DirectProvider.java >diff -N src/org/eclipse/core/internal/net/providers/DirectProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/internal/net/providers/DirectProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,41 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Mark A. Ziesemer 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: >+ * Mark A. Ziesemer - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.core.internal.net.providers; >+ >+import java.net.URI; >+ >+import org.eclipse.core.net.proxy.IProxyData; >+import org.eclipse.core.net.proxy.IProxyProviderExtension; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IConfigurationElement; >+ >+public class DirectProvider implements IProxyProviderExtension{ >+ >+ protected final IProxyData[] emptyData = new IProxyData[0]; >+ >+ public DirectProvider(){ >+ // Nothing to do. >+ } >+ >+ public void setInitializationData(IConfigurationElement config, String propertyName, Object data) >+ throws CoreException{ >+ // Nothing to do. >+ } >+ >+ public String getName(){ >+ return "Direct"; //$NON-NLS-1$ >+ } >+ >+ public IProxyData[] select(URI uri){ >+ return emptyData; >+ } >+ >+} >Index: schema/provider.exsd >=================================================================== >RCS file: schema/provider.exsd >diff -N schema/provider.exsd >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ schema/provider.exsd 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,102 @@ >+<?xml version='1.0' encoding='UTF-8'?> >+<!-- Schema file written by PDE --> >+<schema targetNamespace="org.eclipse.core.net" xmlns="http://www.w3.org/2001/XMLSchema"> >+<annotation> >+ <appInfo> >+ <meta.schema plugin="org.eclipse.core.net" id="provider" name="Provider"/> >+ </appInfo> >+ <documentation> >+ Extension point to provide different proxy implementations. >+ </documentation> >+ </annotation> >+ >+ <element name="extension"> >+ <annotation> >+ <appinfo> >+ <meta.element /> >+ </appinfo> >+ </annotation> >+ <complexType> >+ <sequence> >+ <element ref="provider"/> >+ </sequence> >+ <attribute name="point" type="string" use="required"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="id" type="string"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="name" type="string"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ <appinfo> >+ <meta.attribute translatable="true"/> >+ </appinfo> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <element name="provider"> >+ <complexType> >+ <attribute name="class" type="string" use="required"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ <appinfo> >+ <meta.attribute kind="java" basedOn=":org.eclipse.core.net.proxy.IProxyProviderExtension"/> >+ </appinfo> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <annotation> >+ <appinfo> >+ <meta.section type="since"/> >+ </appinfo> >+ <documentation> >+ [Enter the first release in which this extension point appears.] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appinfo> >+ <meta.section type="examples"/> >+ </appinfo> >+ <documentation> >+ [Enter extension point usage example here.] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appinfo> >+ <meta.section type="apiinfo"/> >+ </appinfo> >+ <documentation> >+ [Enter API information here.] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appinfo> >+ <meta.section type="implementation"/> >+ </appinfo> >+ <documentation> >+ [Enter information about supplied implementation of this extension point.] >+ </documentation> >+ </annotation> >+ >+ >+</schema> >Index: src/org/eclipse/core/internal/net/providers/NativeProvider.java >=================================================================== >RCS file: src/org/eclipse/core/internal/net/providers/NativeProvider.java >diff -N src/org/eclipse/core/internal/net/providers/NativeProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/internal/net/providers/NativeProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,89 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Mark A. Ziesemer 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: Mark A. Ziesemer - initial API and >+ * implementation >+ *******************************************************************************/ >+package org.eclipse.core.internal.net.providers; >+ >+import java.net.URI; >+ >+import org.eclipse.core.internal.net.AbstractProxyProvider; >+import org.eclipse.core.internal.net.Activator; >+import org.eclipse.core.internal.net.ProxyData; >+import org.eclipse.core.net.proxy.IProxyData; >+import org.eclipse.core.net.proxy.IProxyProviderExtension; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IConfigurationElement; >+ >+public class NativeProvider implements IProxyProviderExtension{ >+ >+ private AbstractProxyProvider nativeProxyProvider; >+ >+ public NativeProvider(){ >+ try{ >+ nativeProxyProvider = (AbstractProxyProvider) Class.forName( >+ "org.eclipse.core.net.ProxyProvider").newInstance(); //$NON-NLS-1$ >+ }catch(ClassNotFoundException e){ >+ // no class found >+ }catch(Exception e){ >+ Activator.logInfo("Problems occured during the proxy provider initialization.", e); //$NON-NLS-1$ >+ } >+ } >+ >+ public void setInitializationData(IConfigurationElement config, String propertyName, Object data) >+ throws CoreException{ >+ // Nothing to do. >+ } >+ >+ public String getName(){ >+ return "Native"; //$NON-NLS-1$ >+ } >+ >+ public IProxyData[] select(URI uri){ >+ return nativeProxyProvider.getProxyData(uri); >+ } >+ >+ public String[] getNativeNonProxiedHosts(){ >+ //if(hasSystemProxies()){ >+ return nativeProxyProvider.getNonProxiedHosts(); >+ //} >+ //return new String[0]; >+ } >+ >+ public IProxyData[] getNativeProxyData() { >+ //if (hasSystemProxies()) { >+ return resolveType(nativeProxyProvider.getProxyData()); >+ //} >+ //return new IProxyData[0]; >+ } >+ >+ // TODO: Factor out duplication with EclipseProvider. >+ public IProxyData resolveType(IProxyData data) { >+ if (data == null) { >+ return null; >+ } >+ ProxyData d = (ProxyData) data; >+ if (d.getType().equalsIgnoreCase(IProxyData.HTTP_PROXY_TYPE)) { >+ d.setType(IProxyData.HTTP_PROXY_TYPE); >+ } else if (d.getType().equalsIgnoreCase(IProxyData.HTTPS_PROXY_TYPE)) { >+ d.setType(IProxyData.HTTPS_PROXY_TYPE); >+ } else if (d.getType().equalsIgnoreCase(IProxyData.SOCKS_PROXY_TYPE)) { >+ d.setType(IProxyData.SOCKS_PROXY_TYPE); >+ } >+ return d; >+ } >+ >+ // TODO: Factor out duplication with EclipseProvider. >+ public IProxyData[] resolveType(IProxyData[] data) { >+ if (data == null) { >+ return null; >+ } >+ for (int i = 0; i < data.length; i++) { >+ resolveType(data[i]); >+ } >+ return data; >+ } >+ >+} >Index: src/org/eclipse/core/internal/net/providers/EclipseProvider.java >=================================================================== >RCS file: src/org/eclipse/core/internal/net/providers/EclipseProvider.java >diff -N src/org/eclipse/core/internal/net/providers/EclipseProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/internal/net/providers/EclipseProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,516 @@ >+/******************************************************************************* >+ * Copyright (c) 2007, 2008 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 >+ * Mark A. Ziesemer - Refactor from ProxyManager to separate extension. >+ *******************************************************************************/ >+package org.eclipse.core.internal.net.providers; >+ >+import java.net.Authenticator; >+import java.net.URI; >+import java.net.URISyntaxException; >+import java.util.ArrayList; >+import java.util.List; >+import java.util.Properties; >+ >+import org.eclipse.core.internal.net.Activator; >+import org.eclipse.core.internal.net.ProxyChangeEvent; >+import org.eclipse.core.internal.net.ProxyData; >+import org.eclipse.core.internal.net.ProxyManager; >+import org.eclipse.core.internal.net.ProxyType; >+import org.eclipse.core.internal.net.StringMatcher; >+import org.eclipse.core.net.proxy.IProxyChangeEvent; >+import org.eclipse.core.net.proxy.IProxyData; >+import org.eclipse.core.net.proxy.IProxyProviderExtension; >+import org.eclipse.core.runtime.Assert; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IConfigurationElement; >+import org.eclipse.core.runtime.IExtension; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.RegistryFactory; >+import org.eclipse.core.runtime.preferences.ConfigurationScope; >+import org.eclipse.core.runtime.preferences.InstanceScope; >+import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent; >+import org.eclipse.osgi.util.NLS; >+import org.osgi.service.prefs.BackingStoreException; >+import org.osgi.service.prefs.Preferences; >+ >+public class EclipseProvider implements IProxyProviderExtension{ >+ >+private static final String PREF_HAS_MIGRATED = "org.eclipse.core.net.hasMigrated"; //$NON-NLS-1$ >+ >+ /** >+ * Preference constants used by Update to record the HTTP proxy >+ */ >+ private static String HTTP_PROXY_HOST = "org.eclipse.update.core.proxy.host"; //$NON-NLS-1$ >+ private static String HTTP_PROXY_PORT = "org.eclipse.update.core.proxy.port"; //$NON-NLS-1$ >+ private static String HTTP_PROXY_ENABLE = "org.eclipse.update.core.proxy.enable"; //$NON-NLS-1$ >+ >+ private static final String PREF_ENABLED = "proxiesEnabled"; //$NON-NLS-1$ >+ private static final String PREF_NON_PROXIED_HOSTS = "nonProxiedHosts"; //$NON-NLS-1$ >+ >+ private final ProxyType[] proxies = new ProxyType[] { >+ new ProxyType(IProxyData.HTTP_PROXY_TYPE), >+ new ProxyType(IProxyData.HTTPS_PROXY_TYPE), >+ new ProxyType(IProxyData.SOCKS_PROXY_TYPE) >+ }; >+ >+ private String[] nonProxiedHosts; >+ >+ private boolean migrated = false; >+ >+ public EclipseProvider(){ >+ checkMigrated(); >+ // Now initialize each proxy type >+ for (int i = 0; i < proxies.length; i++) { >+ ProxyType type = proxies[i]; >+ type.initialize(internalIsProxiesEnabled()); >+ } >+ registerAuthenticator(); >+ } >+ >+ public void setInitializationData(IConfigurationElement config, String propertyName, Object data) >+ throws CoreException{ >+ // Nothing to do. >+ } >+ >+ public String getName(){ >+ return "Eclipse"; //$NON-NLS-1$ >+ } >+ >+ public IProxyData[] select(URI uri){ >+ IProxyData data = getProxyDataForHost(uri.getHost(), uri.getScheme()); >+ if(data != null){ >+ return resolveType(new IProxyData[]{data}); >+ } >+ return new IProxyData[0]; >+ } >+ >+ private void fireChange(IProxyChangeEvent event){ >+ // TODO: Cleanup call to fireChange. >+ ProxyManager.getProxyManager().fireChange(event); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.net.IProxyManager#getNonProxiedHosts() >+ */ >+ public synchronized String[] getNonProxiedHosts() { >+ checkMigrated(); >+ if (nonProxiedHosts == null) { >+ String prop = Activator.getInstance().getPreferences().get(PREF_NON_PROXIED_HOSTS, "localhost|127.0.0.1"); //$NON-NLS-1$ >+ nonProxiedHosts = ProxyType.convertPropertyStringToHosts(prop); >+ } >+ if (nonProxiedHosts.length == 0) >+ return nonProxiedHosts; >+ String[] result = new String[nonProxiedHosts.length]; >+ System.arraycopy(nonProxiedHosts, 0, result, 0, nonProxiedHosts.length ); >+ return result; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.net.IProxyManager#setNonProxiedHosts(java.lang.String[]) >+ */ >+ public void setNonProxiedHosts(String[] hosts) { >+ checkMigrated(); >+ Assert.isNotNull(hosts); >+ for (int i = 0; i < hosts.length; i++) { >+ String host = hosts[i]; >+ Assert.isNotNull(host); >+ Assert.isTrue(host.length() > 0); >+ } >+ String[] oldHosts = nonProxiedHosts; >+ nonProxiedHosts = hosts; >+ Activator.getInstance().getPreferences().put(PREF_NON_PROXIED_HOSTS, ProxyType.convertHostsToPropertyString(nonProxiedHosts)); >+ try { >+ Activator.getInstance().getPreferences().flush(); >+ } catch (BackingStoreException e) { >+ Activator.logError( >+ "An error occurred while writing out the non-proxied hosts list", e); //$NON-NLS-1$ >+ } >+ IProxyData[] data = getProxyData(); >+ IProxyChangeEvent event = new ProxyChangeEvent(IProxyChangeEvent.NONPROXIED_HOSTS_CHANGED, oldHosts, getNonProxiedHosts(), data, new IProxyData[0]); >+ fireChange(event); >+ } >+ >+ public IProxyData[] getProxyData() { >+ checkMigrated(); >+ IProxyData[] result = new IProxyData[proxies.length]; >+ for (int i = 0; i < proxies.length; i++) { >+ ProxyType type = proxies[i]; >+ result[i] = type.getProxyData(ProxyType.VERIFY_EQUAL); >+ } >+ return resolveType(result); >+ } >+ >+ public void setProxyData(IProxyData[] proxies) { >+ checkMigrated(); >+ doSetProxyData(proxies); >+ } >+ >+ private void doSetProxyData(IProxyData[] proxyDatas) { >+ IProxyData[] oldData = getProxyData(); >+ String[] hosts = getNonProxiedHosts(); >+ IProxyData[] changedProxies = internalSetProxyData(proxyDatas); >+ if (changedProxies.length > 0) { >+ IProxyChangeEvent event = new ProxyChangeEvent(IProxyChangeEvent.PROXY_SERVICE_ENABLEMENT_CHANGE, hosts, hosts, oldData, changedProxies); >+ fireChange(event); >+ } >+ } >+ >+ private IProxyData[] internalSetProxyData(IProxyData[] proxyDatas) { >+ List result = new ArrayList(); >+ for (int i = 0; i < proxyDatas.length; i++) { >+ IProxyData proxyData = proxyDatas[i]; >+ ProxyType type = getType(proxyData); >+ if (type != null && type.setProxyData(proxyData, internalIsProxiesEnabled())) { >+ result.add(proxyData); >+ } >+ } >+ return (IProxyData[]) result.toArray(new IProxyData[result.size()]); >+ } >+ >+ private ProxyType getType(IProxyData proxyData) { >+ for (int i = 0; i < proxies.length; i++) { >+ ProxyType type = proxies[i]; >+ if (type.getName().equals(proxyData.getType())) { >+ return type; >+ } >+ } >+ return null; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.net.IProxyManager#isProxiesEnabled() >+ */ >+ public boolean isProxiesEnabled() { >+ checkMigrated(); >+ return internalIsProxiesEnabled(); >+ } >+ >+ private boolean internalIsProxiesEnabled() { >+ return Activator.getInstance().getPreferences().getBoolean( >+ PREF_ENABLED, true); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.net.IProxyManager#setProxiesEnabled(boolean) >+ */ >+ public void setProxiesEnabled(boolean enabled) { >+ checkMigrated(); >+ boolean current = internalIsProxiesEnabled(); >+ if (current == enabled) >+ return; >+ // Setting the preference will trigger the system property update >+ // (see preferenceChange) >+ Activator.getInstance().getPreferences().putBoolean(PREF_ENABLED, enabled); >+ } >+ >+ private void internalSetEnabled(boolean enabled) { >+ Properties sysProps = System.getProperties(); >+ sysProps.put("proxySet", enabled ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >+ updateSystemProperties(); >+ try { >+ Activator.getInstance().getPreferences().flush(); >+ } catch (BackingStoreException e) { >+ Activator.logError( >+ "An error occurred while writing out the enablement state", e); //$NON-NLS-1$ >+ } >+ String[] hosts = getNonProxiedHosts(); >+ IProxyData[] data = getProxyData(); >+ IProxyChangeEvent event = new ProxyChangeEvent(IProxyChangeEvent.PROXY_DATA_CHANGED, hosts, hosts, data, data); >+ fireChange(event); >+ } >+ >+ private void updateSystemProperties() { >+ for (int i = 0; i < proxies.length; i++) { >+ ProxyType type = proxies[i]; >+ type.updateSystemProperties(internalGetProxyData(type.getName(), ProxyType.DO_NOT_VERIFY), internalIsProxiesEnabled()); >+ } >+ } >+ >+ public IProxyData getProxyData(String type) { >+ checkMigrated(); >+ return resolveType(internalGetProxyData(type, ProxyType.VERIFY_EQUAL)); >+ } >+ >+ private IProxyData internalGetProxyData(String type, int verifySystemProperties) { >+ for (int i = 0; i < proxies.length; i++) { >+ ProxyType pt = proxies[i]; >+ if (pt.getName().equals(type)) { >+ return pt.getProxyData(verifySystemProperties); >+ } >+ } >+ return null; >+ } >+ >+ public IProxyData[] getProxyDataForHost(String host) { >+ checkMigrated(); >+ if (!internalIsProxiesEnabled()) { >+ return new IProxyData[0]; >+ } >+ URI uri = tryGetURI(host); >+ if (uri == null) { >+ return new IProxyData[0]; >+ } >+ // TODO: Should probably remove - now in NativeProvider. >+// if (hasSystemProxies() && isSystemProxiesEnabled()) { >+// return resolveType(nativeProxyProvider.select(uri)); >+// } >+ >+ if (isHostFiltered(uri)) >+ return new IProxyData[0]; >+ IProxyData[] data = getProxyData(); >+ List result = new ArrayList(); >+ for (int i = 0; i < data.length; i++) { >+ IProxyData proxyData = data[i]; >+ if (proxyData.getHost() != null) >+ result.add(proxyData); >+ } >+ IProxyData ret[] = (IProxyData[]) result.toArray(new IProxyData[result.size()]); >+ return resolveType(ret); >+ } >+ >+ public static URI tryGetURI(String host) { >+ try { >+ int i = host.indexOf(":"); //$NON-NLS-1$ >+ if (i == -1) { >+ return new URI("//" + host); //$NON-NLS-1$ >+ } >+ return new URI(host.substring(i + 1)); >+ } catch (URISyntaxException e) { >+ return null; >+ } >+ } >+ >+ private boolean isHostFiltered(URI uri) { >+ String[] filters = getNonProxiedHosts(); >+ for (int i = 0; i < filters.length; i++) { >+ String filter = filters[i]; >+ if (matchesFilter(uri.getHost(), filter)) >+ return true; >+ } >+ return false; >+ } >+ >+ private boolean matchesFilter(String host, String filter) { >+ StringMatcher matcher = new StringMatcher(filter, true, false); >+ return matcher.match(host); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.net.core.IProxyManager#getProxyDataForHost(java.lang.String, java.lang.String) >+ */ >+ public IProxyData getProxyDataForHost(String host, String type) { >+ checkMigrated(); >+ if (!internalIsProxiesEnabled()) { >+ return null; >+ } >+ // TODO: Should probably remove - now in NativeProvider. >+// if (hasSystemProxies() && isSystemProxiesEnabled()) >+// try { >+// URI uri = new URI(type, "//" + host, null); //$NON-NLS-1$ >+// IProxyData[] proxyDatas = nativeProxyProvider.select(uri); >+// return proxyDatas.length > 0 ? resolveType(nativeProxyProvider.select(uri)[0]) : null; >+// } catch (URISyntaxException e) { >+// return null; >+// } >+ >+ IProxyData[] data = getProxyDataForHost(host); >+ for (int i = 0; i < data.length; i++) { >+ IProxyData proxyData = data[i]; >+ if (proxyData.getType().equalsIgnoreCase(type) >+ && proxyData.getHost() != null) >+ return resolveType(proxyData); >+ } >+ return null; >+ } >+ >+ private void registerAuthenticator() { >+ Authenticator a = getPluggedInAuthenticator(); >+ if (a != null) { >+ Authenticator.setDefault(a); >+ } >+ } >+ >+ private Authenticator getPluggedInAuthenticator() { >+ IExtension[] extensions = RegistryFactory.getRegistry().getExtensionPoint(Activator.ID, Activator.PT_AUTHENTICATOR).getExtensions(); >+ if (extensions.length == 0) >+ return null; >+ IExtension extension = extensions[0]; >+ IConfigurationElement[] configs = extension.getConfigurationElements(); >+ if (configs.length == 0) { >+ Activator.log(IStatus.ERROR, NLS.bind("Authenticator {0} is missing required fields", (new Object[] {extension.getUniqueIdentifier()})), null);//$NON-NLS-1$ >+ return null; >+ } >+ try { >+ IConfigurationElement config = configs[0]; >+ return (Authenticator) config.createExecutableExtension("class");//$NON-NLS-1$ >+ } catch (CoreException ex) { >+ Activator.log(IStatus.ERROR, NLS.bind("Unable to instantiate authenticator {0}", (new Object[] {extension.getUniqueIdentifier()})), ex);//$NON-NLS-1$ >+ return null; >+ } >+ } >+ >+ private synchronized void checkMigrated() { >+ if (migrated || !Activator.getInstance().instanceLocationAvailable()) >+ return; >+ >+ migrated = true; >+ if (Activator.getInstance().getPreferences().getBoolean(PREF_HAS_MIGRATED, false)) >+ return; >+ >+ Activator.getInstance().getPreferences().putBoolean(PREF_HAS_MIGRATED, true); >+ migrateInstanceScopePreferences(new InstanceScope().getNode(""), new ConfigurationScope().getNode(""), true); //$NON-NLS-1$//$NON-NLS-2$ >+ } >+ >+ void migrateInstanceScopePreferences(Preferences instanceNode, Preferences configurationNode, boolean isInitialize) { >+ migrateUpdateHttpProxy(instanceNode, isInitialize); >+ >+ Preferences netInstancePrefs = instanceNode.node(Activator.ID); >+ Preferences netConfigurationPrefs = configurationNode.node(Activator.ID); >+ >+ // migrate enabled status >+ if (netConfigurationPrefs.get(PREF_ENABLED, null) == null) { >+ String instanceEnabled = netInstancePrefs.get(PREF_ENABLED, null); >+ if (instanceEnabled != null) >+ netConfigurationPrefs.put(PREF_ENABLED, instanceEnabled); >+ } >+ >+ // TODO: Should probably remove - now in NativeProvider. >+ // migrate enabled status >+// if (netConfigurationPrefs.get(PREF_OS, null) == null) { >+// String instanceEnabled = netInstancePrefs.get(PREF_OS, null); >+// if (instanceEnabled != null) >+// netConfigurationPrefs.put(PREF_OS, instanceEnabled); >+// } >+ >+ // migrate non proxied hosts if not already set >+ if (netConfigurationPrefs.get(PREF_NON_PROXIED_HOSTS, null) == null) { >+ String instanceNonProxiedHosts = netInstancePrefs.get(PREF_NON_PROXIED_HOSTS, null); >+ if (instanceNonProxiedHosts != null) { >+ netConfigurationPrefs.put(PREF_NON_PROXIED_HOSTS, instanceNonProxiedHosts); >+ nonProxiedHosts = null; >+ } >+ } >+ >+ // migrate proxy data >+ boolean proxiesEnabled = netConfigurationPrefs.getBoolean(PREF_ENABLED, true); >+ for (int i = 0; i < proxies.length; i++) { >+ ProxyType type = proxies[i]; >+ IProxyData data = type.getProxyData(ProxyType.DO_NOT_VERIFY); >+ if (data.getHost() == null) { >+ ProxyType instanceType = new ProxyType(type.getName(),netInstancePrefs); >+ IProxyData instanceData = instanceType.getProxyData(ProxyType.DO_NOT_VERIFY); >+ if (instanceData.getHost() != null) >+ type.setProxyData(instanceData, proxiesEnabled); >+ } >+ } >+ >+ // if this an import we should remove the old node >+ if (! isInitialize) { >+ try { >+ netInstancePrefs.removeNode(); >+ } catch (BackingStoreException e) { >+ // ignore >+ } >+ } >+ } >+ >+ private void migrateUpdateHttpProxy(Preferences node, boolean isInitialize) { >+ Preferences netPrefs = node.node(Activator.ID); >+ if (!netPrefs.getBoolean(PREF_HAS_MIGRATED, false)) { >+ // Only set the migration bit when initializing >+ if (isInitialize) >+ netPrefs.putBoolean(PREF_HAS_MIGRATED, true); >+ Preferences updatePrefs = node.node("org.eclipse.update.core"); //$NON-NLS-1$ >+ String httpProxyHost = getHostToMigrate(updatePrefs, isInitialize /* checkSystemProperties */); >+ int port = getPortToMigrate(updatePrefs, isInitialize /* checkSystemProperties */); >+ boolean httpProxyEnable = getEnablementToMigrate(updatePrefs, isInitialize /* checkSystemProperties */); >+ if (httpProxyHost != null) { >+ ProxyData proxyData = new ProxyData(IProxyData.HTTP_PROXY_TYPE, >+ httpProxyHost, port, false, null); >+ ProxyType type = getType(proxyData); >+ type.updatePreferencesIfMissing(netPrefs, proxyData); >+ if (httpProxyEnable) { >+ netPrefs.putBoolean(PREF_ENABLED, true); >+ } >+ } >+ } >+ } >+ >+ private boolean getEnablementToMigrate(Preferences updatePrefs, boolean checkSystemProperties) { >+ boolean httpProxyEnable = false; >+ if (checkSystemProperties && updatePrefs.get(HTTP_PROXY_ENABLE, null) == null) { >+ httpProxyEnable = Boolean.getBoolean("http.proxySet"); //$NON-NLS-1$ >+ } else { >+ httpProxyEnable = updatePrefs.getBoolean(HTTP_PROXY_ENABLE, false); >+ updatePrefs.remove(HTTP_PROXY_ENABLE); >+ } >+ return httpProxyEnable; >+ } >+ >+ private int getPortToMigrate(Preferences updatePrefs, boolean checkSystemProperties) { >+ String httpProxyPort = updatePrefs.get(HTTP_PROXY_PORT, ""); //$NON-NLS-1$ >+ if (checkSystemProperties && "".equals(httpProxyPort)) { //$NON-NLS-1$ >+ httpProxyPort = System.getProperty("http.proxyPort", ""); //$NON-NLS-1$ //$NON-NLS-2$ >+ } >+ updatePrefs.remove(HTTP_PROXY_PORT); >+ int port = -1; >+ if (httpProxyPort != null && !"".equals(httpProxyPort)) //$NON-NLS-1$ >+ try { >+ port = Integer.parseInt(httpProxyPort); >+ } catch (NumberFormatException e) { >+ // Ignore >+ } >+ return port; >+ } >+ >+ private String getHostToMigrate(Preferences updatePrefs, boolean checkSystemProperties) { >+ String httpProxyHost = updatePrefs.get(HTTP_PROXY_HOST, ""); //$NON-NLS-1$ >+ if (checkSystemProperties && "".equals(httpProxyHost)) { //$NON-NLS-1$ >+ httpProxyHost = System.getProperty("http.proxyHost", ""); //$NON-NLS-1$ //$NON-NLS-2$ >+ } >+ if ("".equals(httpProxyHost)) //$NON-NLS-1$ >+ httpProxyHost = null; >+ updatePrefs.remove(HTTP_PROXY_HOST); >+ return httpProxyHost; >+ } >+ >+ public void preferenceChange(PreferenceChangeEvent event) { >+ if (event.getKey().equals(PREF_ENABLED)) { >+ checkMigrated(); >+ internalSetEnabled(Activator.getInstance().getPreferences().getBoolean(PREF_ENABLED, true)); >+ } >+ } >+ >+ public IProxyData resolveType(IProxyData data) { >+ if (data == null) { >+ return null; >+ } >+ ProxyData d = (ProxyData) data; >+ if (d.getType().equalsIgnoreCase(IProxyData.HTTP_PROXY_TYPE)) { >+ d.setType(IProxyData.HTTP_PROXY_TYPE); >+ } else if (d.getType().equalsIgnoreCase(IProxyData.HTTPS_PROXY_TYPE)) { >+ d.setType(IProxyData.HTTPS_PROXY_TYPE); >+ } else if (d.getType().equalsIgnoreCase(IProxyData.SOCKS_PROXY_TYPE)) { >+ d.setType(IProxyData.SOCKS_PROXY_TYPE); >+ } >+ return d; >+ } >+ >+ public IProxyData[] resolveType(IProxyData[] data) { >+ if (data == null) { >+ return null; >+ } >+ for (int i = 0; i < data.length; i++) { >+ resolveType(data[i]); >+ } >+ return data; >+ } >+ >+} >Index: src/org/eclipse/core/net/proxy/IProxyProviderExtension.java >=================================================================== >RCS file: src/org/eclipse/core/net/proxy/IProxyProviderExtension.java >diff -N src/org/eclipse/core/net/proxy/IProxyProviderExtension.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/net/proxy/IProxyProviderExtension.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,17 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Mark A. Ziesemer 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: >+ * Mark A. Ziesemer - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.core.net.proxy; >+ >+import org.eclipse.core.runtime.IExecutableExtension; >+ >+public interface IProxyProviderExtension extends IExecutableExtension, IProxyProvider{ >+ // Currently parent interfaces only. >+} >#P org.eclipse.ui.net >Index: src/org/eclipse/ui/internal/net/ProxyPreferencePage.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.net/src/org/eclipse/ui/internal/net/ProxyPreferencePage.java,v >retrieving revision 1.15 >diff -u -r1.15 ProxyPreferencePage.java >--- src/org/eclipse/ui/internal/net/ProxyPreferencePage.java 20 Nov 2008 15:50:07 -0000 1.15 >+++ src/org/eclipse/ui/internal/net/ProxyPreferencePage.java 10 Dec 2008 02:46:15 -0000 >@@ -18,11 +18,23 @@ > *******************************************************************************/ > package org.eclipse.ui.internal.net; > >-import org.eclipse.core.internal.net.ProxySelector; >+import java.util.LinkedList; >+import java.util.List; >+ >+import org.eclipse.core.internal.net.ProxyManager; >+import org.eclipse.core.net.proxy.IProxyProvider; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IConfigurationElement; >+import org.eclipse.core.runtime.IExtension; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.RegistryFactory; >+import org.eclipse.core.runtime.Status; > import org.eclipse.jface.preference.PreferencePage; >+import org.eclipse.osgi.util.NLS; > import org.eclipse.swt.SWT; > import org.eclipse.swt.events.SelectionAdapter; > import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.layout.FillLayout; > import org.eclipse.swt.layout.GridData; > import org.eclipse.swt.layout.GridLayout; > import org.eclipse.swt.widgets.Combo; >@@ -35,13 +47,24 @@ > > public class ProxyPreferencePage extends PreferencePage implements > IWorkbenchPreferencePage { >- >+ > private static final String PROXY_PREFERENCE_PAGE_CONTEXT_ID = "org.eclipse.ui.net.proxy_preference_page_context"; //$NON-NLS-1$ >+ >+ protected ProxyManager proxyManager = ProxyManager.getProxyManager(); >+ >+ // Cache as long as the page is open. >+ protected IProxyProvider[] providers; >+ protected IProxyProviderConfigUIExtension[] uiExtensions; >+ protected IProxyProviderConfigUIExtension currentUiExtension; >+ protected Composite extensionComposite; > > private Label providerLabel; > protected Combo providerCombo; >- private ProxyEntriesComposite proxyEntriesComposite; >- private NonProxyHostsComposite nonProxyHostsComposite; >+ >+ public void init(IWorkbench workbench) { >+ providers = proxyManager.getProviders(); >+ uiExtensions = getUIExtensions(); >+ } > > protected Control createContents(Composite parent) { > Composite composite = new Composite(parent, SWT.NONE); >@@ -51,8 +74,8 @@ > composite.setLayout(layout); > > createProviderComposite(composite); >- createProxyEntriesComposite(composite); >- createNonProxiedHostsComposite(composite); >+ this.extensionComposite = new Composite(composite, SWT.NONE); >+ this.extensionComposite.setLayout(new FillLayout()); > > // Adding help accessible by F1 > PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), >@@ -72,53 +95,115 @@ > providerCombo = new Combo(composite, SWT.READ_ONLY | SWT.DROP_DOWN); > providerCombo.addSelectionListener(new SelectionAdapter() { > public void widgetSelected(SelectionEvent e) { >- setProvider(providerCombo.getText()); >+ setProvider(providerCombo.getSelectionIndex()); > } > }); > } > >- private void createProxyEntriesComposite(Composite parent) { >- proxyEntriesComposite = new ProxyEntriesComposite(parent, SWT.NONE); >- proxyEntriesComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, >- true, true)); >- } >- >- private void createNonProxiedHostsComposite(Composite parent) { >- nonProxyHostsComposite = new NonProxyHostsComposite(parent, SWT.NONE); >- nonProxyHostsComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, >- true, true)); >- } >- >- public void init(IWorkbench workbench) { >- // Nothing to do >- } >- >- protected void performApply() { >+ protected void performApply(){ >+ if(currentUiExtension != null){ >+ currentUiExtension.performApply(); >+ } > int sel = providerCombo.getSelectionIndex(); >- ProxySelector.setDefaultProvider(providerCombo.getItem(sel)); >- proxyEntriesComposite.performApply(); >- nonProxyHostsComposite.performApply(); >+ proxyManager.setProvider(providers[sel]); > } > >- protected void performDefaults() { >- providerCombo.select(1); >- setProvider(providerCombo.getItem(1)); >+ protected void performDefaults(){ >+ // providerCombo.select(1); >+ // setProvider(1); >+ if(currentUiExtension != null){ >+ currentUiExtension.performDefaults(); >+ } > } > >- public boolean performOk() { >+ public boolean performOk(){ >+ if(currentUiExtension != null){ >+ if(!currentUiExtension.performOk()){ >+ return false; >+ } >+ } > performApply(); > return super.performOk(); > } > > private void initializeValues() { >- providerCombo.setItems(ProxySelector.getProviders()); >- providerCombo.select(providerCombo.indexOf(ProxySelector >- .getDefaultProvider())); >- } >- >- protected void setProvider(String name) { >- proxyEntriesComposite.setProvider(name); >- nonProxyHostsComposite.setProvider(name); >+ String items[] = new String[providers.length]; >+ int selIndex = 0; >+ IProxyProvider currentProvider = proxyManager.getProvider(); >+ for(int i=0; i<providers.length; i++){ >+ items[i] = providers[i].getName(); >+ if(currentProvider.equals(providers[i])){ >+ selIndex = i; >+ } >+ } >+ providerCombo.setItems(items); >+ providerCombo.select(selIndex); >+ setProvider(selIndex); >+ } >+ >+ protected void setProvider(int index){ >+ // Remove last extension control, if any. >+ Control[] cc = extensionComposite.getChildren(); >+ for(int i=0; i<cc.length; i++){ >+ cc[i].dispose(); >+ } >+ currentUiExtension = null; >+ >+ // Add new extension control, if any. >+ IProxyProvider ipp = providers[index]; >+ for(int i=0; i<uiExtensions.length; i++){ >+ if(ipp.getClass().equals(uiExtensions[i].getProxyProviderClass())){ >+ currentUiExtension = uiExtensions[i]; >+ currentUiExtension.createProviderComposite(extensionComposite, this); >+ extensionComposite.pack(); >+ return; >+ } >+ } >+ >+ // If no extension control provided: >+ Label noConfigLabel = new Label(extensionComposite, SWT.NONE); >+ // TODO: Externalize label text. >+ noConfigLabel.setText("No configuration UI provided for the selected proxy provider."); //$NON-NLS-1$ >+ noConfigLabel.pack(); >+ >+ } >+ >+ private IProxyProviderConfigUIExtension[] getUIExtensions(){ >+ List resultList = new LinkedList(); >+ IExtension[] extensions = RegistryFactory.getRegistry().getExtensionPoint( >+ Activator.PLUGIN_ID, IProxyProviderConfigUIExtension.EXTENSION_POINT_NAME).getExtensions(); >+ for(int i=0; i<extensions.length; i++){ >+ IExtension extension = extensions[i]; >+ IConfigurationElement[] configs = extension.getConfigurationElements(); >+ if(configs.length == 0){ >+ logError(NLS.bind("Provider {0} is missing required fields", //$NON-NLS-1$ >+ (new Object[]{extension.getUniqueIdentifier()})), null); >+ }else{ >+ try{ >+ IConfigurationElement config = configs[0]; >+ IProxyProviderConfigUIExtension ipp = (IProxyProviderConfigUIExtension)config.createExecutableExtension("class"); //$NON-NLS-1$ >+ resultList.add(ipp); >+ }catch(CoreException ex){ >+ logError(NLS.bind("Unable to instantiate provider {0}", //$NON-NLS-1$ >+ (new Object[]{extension.getUniqueIdentifier()})), ex); >+ } >+ } >+ } >+ IProxyProviderConfigUIExtension[] result = new IProxyProviderConfigUIExtension[resultList.size()]; >+ resultList.toArray(result); >+ return result; >+ } >+ >+ public static void logInfo(String message){ >+ log(new Status(IStatus.INFO, Activator.PLUGIN_ID, 0, message, null)); >+ } >+ >+ public static void logError(String message, Throwable exc){ >+ log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, message, exc)); >+ } >+ >+ public static void log(IStatus status){ >+ Activator.getDefault().getLog().log(status); > } > > } >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.net/plugin.xml,v >retrieving revision 1.4 >diff -u -r1.4 plugin.xml >--- plugin.xml 30 Apr 2007 18:02:22 -0000 1.4 >+++ plugin.xml 10 Dec 2008 02:46:09 -0000 >@@ -2,6 +2,7 @@ > <?eclipse version="3.0"?> > > <plugin> >+ <extension-point id="provider" name="Provider" schema="schema/provider.exsd"/> > > <extension > point="org.eclipse.ui.keywords"> >@@ -25,5 +26,11 @@ > class="org.eclipse.ui.internal.net.auth.NetAuthenticator"> > </authenticator> > </extension> >+ <extension >+ point="org.eclipse.ui.net.provider"> >+ <provider >+ class="org.eclipse.ui.internal.net.EclipseProviderPreferencePage"> >+ </provider> >+ </extension> > > </plugin> >Index: src/org/eclipse/ui/internal/net/AbstractProxyProviderConfigUIExtension.java >=================================================================== >RCS file: src/org/eclipse/ui/internal/net/AbstractProxyProviderConfigUIExtension.java >diff -N src/org/eclipse/ui/internal/net/AbstractProxyProviderConfigUIExtension.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/internal/net/AbstractProxyProviderConfigUIExtension.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,40 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Mark A. Ziesemer 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: >+ * Mark A. Ziesemer - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ui.internal.net; >+ >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IConfigurationElement; >+import org.eclipse.ui.IWorkbench; >+ >+public abstract class AbstractProxyProviderConfigUIExtension implements IProxyProviderConfigUIExtension{ >+ >+ public void setInitializationData(IConfigurationElement config, String propertyName, Object data) >+ throws CoreException{ >+ // Nothing to do. >+ } >+ >+ public void init(IWorkbench workbench){ >+ // Nothing to do. >+ } >+ >+ public void performApply(){ >+ // Nothing to do. >+ } >+ >+ public void performDefaults(){ >+ // Nothing to do. >+ } >+ >+ public boolean performOk(){ >+ return true; >+ } >+ >+} >Index: src/org/eclipse/ui/internal/net/IProxyProviderConfigUIExtension.java >=================================================================== >RCS file: src/org/eclipse/ui/internal/net/IProxyProviderConfigUIExtension.java >diff -N src/org/eclipse/ui/internal/net/IProxyProviderConfigUIExtension.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/internal/net/IProxyProviderConfigUIExtension.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,48 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Mark A. Ziesemer 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: >+ * Mark A. Ziesemer - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ui.internal.net; >+ >+import org.eclipse.core.net.proxy.IProxyProvider; >+import org.eclipse.core.runtime.IExecutableExtension; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.ui.IWorkbenchPreferencePage; >+ >+public interface IProxyProviderConfigUIExtension extends IExecutableExtension{ >+ >+ public static final String EXTENSION_POINT_NAME = "provider"; //$NON-NLS-1$ >+ >+ // TODO: There has to be a better way of receiving these events instead of copying relevant API. >+ >+ /** >+ * (protected) see PreferencePage#performDefaults() >+ */ >+ void performDefaults(); >+ >+ /** >+ * (protected) see PreferencePage#performApply() >+ */ >+ void performApply(); >+ >+ /** >+ * @see IWorkbenchPreferencePage#performOk() >+ * @return (see above) >+ */ >+ boolean performOk(); >+ >+ >+ /** >+ * Returns the {@link IProxyProvider} that this UI configures. >+ * @return The {@link IProxyProvider} that this UI configures. >+ */ >+ Class getProxyProviderClass(); >+ >+ void createProviderComposite(Composite parentComposite, ProxyPreferencePage parentPage); >+} >Index: src/org/eclipse/ui/internal/net/EclipseProviderPreferencePage.java >=================================================================== >RCS file: src/org/eclipse/ui/internal/net/EclipseProviderPreferencePage.java >diff -N src/org/eclipse/ui/internal/net/EclipseProviderPreferencePage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/internal/net/EclipseProviderPreferencePage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,49 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Mark A. Ziesemer 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: >+ * Mark A. Ziesemer - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ui.internal.net; >+ >+import org.eclipse.core.internal.net.providers.EclipseProvider; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.widgets.Composite; >+ >+public class EclipseProviderPreferencePage extends AbstractProxyProviderConfigUIExtension{ >+ >+ private ProxyEntriesComposite proxyEntriesComposite; >+ private NonProxyHostsComposite nonProxyHostsComposite; >+ >+ public Class getProxyProviderClass(){ >+ return EclipseProvider.class; >+ } >+ >+ public void createProviderComposite(Composite parentComposite, ProxyPreferencePage parentPage){ >+ createProxyEntriesComposite(parentComposite); >+ createNonProxiedHostsComposite(parentComposite); >+ } >+ >+ private void createProxyEntriesComposite(Composite parent) { >+ proxyEntriesComposite = new ProxyEntriesComposite(parent, SWT.NONE); >+ proxyEntriesComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, >+ true, true)); >+ } >+ >+ private void createNonProxiedHostsComposite(Composite parent) { >+ nonProxyHostsComposite = new NonProxyHostsComposite(parent, SWT.NONE); >+ nonProxyHostsComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, >+ true, true)); >+ } >+ >+ public void performApply(){ >+ proxyEntriesComposite.performApply(); >+ nonProxyHostsComposite.performApply(); >+ } >+ >+} >Index: schema/provider.exsd >=================================================================== >RCS file: schema/provider.exsd >diff -N schema/provider.exsd >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ schema/provider.exsd 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,102 @@ >+<?xml version='1.0' encoding='UTF-8'?> >+<!-- Schema file written by PDE --> >+<schema targetNamespace="org.eclipse.ui.net" xmlns="http://www.w3.org/2001/XMLSchema"> >+<annotation> >+ <appInfo> >+ <meta.schema plugin="org.eclipse.ui.net" id="provider" name="Provider"/> >+ </appInfo> >+ <documentation> >+ Extension point to provide different proxy ui configuration implementations. >+ </documentation> >+ </annotation> >+ >+ <element name="extension"> >+ <annotation> >+ <appinfo> >+ <meta.element /> >+ </appinfo> >+ </annotation> >+ <complexType> >+ <sequence> >+ <element ref="provider"/> >+ </sequence> >+ <attribute name="point" type="string" use="required"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="id" type="string"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="name" type="string"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ <appinfo> >+ <meta.attribute translatable="true"/> >+ </appinfo> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <element name="provider"> >+ <complexType> >+ <attribute name="class" type="string"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ <appinfo> >+ <meta.attribute kind="java"/> >+ </appinfo> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <annotation> >+ <appinfo> >+ <meta.section type="since"/> >+ </appinfo> >+ <documentation> >+ [Enter the first release in which this extension point appears.] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appinfo> >+ <meta.section type="examples"/> >+ </appinfo> >+ <documentation> >+ [Enter extension point usage example here.] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appinfo> >+ <meta.section type="apiinfo"/> >+ </appinfo> >+ <documentation> >+ [Enter API information here.] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appinfo> >+ <meta.section type="implementation"/> >+ </appinfo> >+ <documentation> >+ [Enter information about supplied implementation of this extension point.] >+ </documentation> >+ </annotation> >+ >+ >+</schema>
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 257443
:
119991
|
183464