Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.core.net/.project2
-rw-r--r--bundles/org.eclipse.core.net/META-INF/MANIFEST.MF8
-rw-r--r--bundles/org.eclipse.core.net/build.properties3
-rw-r--r--bundles/org.eclipse.core.net/plugin.xml12
-rw-r--r--bundles/org.eclipse.core.net/schema/authenticator.exsd105
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/Activator.java (renamed from bundles/org.eclipse.core.net/src/org/eclipse/net/internal/core/NetCorePlugin.java)41
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/PreferenceInitializer.java26
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyChangeEvent.java (renamed from bundles/org.eclipse.core.net/src/org/eclipse/net/internal/core/ProxyChangeEvent.java)6
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyData.java (renamed from bundles/org.eclipse.core.net/src/org/eclipse/net/internal/core/ProxyData.java)4
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyManager.java (renamed from bundles/org.eclipse.core.net/src/org/eclipse/net/internal/core/ProxyManager.java)63
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyType.java (renamed from bundles/org.eclipse.core.net/src/org/eclipse/net/internal/core/ProxyType.java)21
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/StringMatcher.java (renamed from bundles/org.eclipse.core.net/src/org/eclipse/net/internal/core/StringMatcher.java)2
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/net/proxy/IProxyChangeEvent.java (renamed from bundles/org.eclipse.core.net/src/org/eclipse/net/core/IProxyChangeEvent.java)10
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/net/proxy/IProxyChangeListener.java (renamed from bundles/org.eclipse.core.net/src/org/eclipse/net/core/IProxyChangeListener.java)4
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/net/proxy/IProxyData.java (renamed from bundles/org.eclipse.core.net/src/org/eclipse/net/core/IProxyData.java)20
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/core/net/proxy/IProxyService.java (renamed from bundles/org.eclipse.core.net/src/org/eclipse/net/core/IProxyManager.java)10
-rw-r--r--bundles/org.eclipse.core.net/src/org/eclipse/net/core/NetCore.java38
-rw-r--r--bundles/org.eclipse.jsch.core/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/JSchCorePlugin.java25
-rw-r--r--bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/Utils.java16
-rw-r--r--bundles/org.eclipse.ui.net/.project2
-rw-r--r--bundles/org.eclipse.ui.net/META-INF/MANIFEST.MF6
-rw-r--r--bundles/org.eclipse.ui.net/plugin.xml8
-rw-r--r--bundles/org.eclipse.ui.net/src/org/eclipse/net/internal/ui/NetUIMessages.java60
-rw-r--r--bundles/org.eclipse.ui.net/src/org/eclipse/net/ui/NetUI.java41
-rw-r--r--bundles/org.eclipse.ui.net/src/org/eclipse/ui/internal/net/Activator.java (renamed from bundles/org.eclipse.ui.net/src/org/eclipse/net/internal/ui/Activator.java)54
-rw-r--r--bundles/org.eclipse.ui.net/src/org/eclipse/ui/internal/net/NetUIMessages.java91
-rw-r--r--bundles/org.eclipse.ui.net/src/org/eclipse/ui/internal/net/NonProxyHostsComposite.java (renamed from bundles/org.eclipse.ui.net/src/org/eclipse/net/internal/ui/NonProxyHostsComposite.java)2
-rw-r--r--bundles/org.eclipse.ui.net/src/org/eclipse/ui/internal/net/NonProxyHostsContentProvider.java (renamed from bundles/org.eclipse.ui.net/src/org/eclipse/net/internal/ui/NonProxyHostsContentProvider.java)2
-rw-r--r--bundles/org.eclipse.ui.net/src/org/eclipse/ui/internal/net/NonProxyHostsLabelProvider.java (renamed from bundles/org.eclipse.ui.net/src/org/eclipse/net/internal/ui/NonProxyHostsLabelProvider.java)2
-rw-r--r--bundles/org.eclipse.ui.net/src/org/eclipse/ui/internal/net/ProxyPreferencePage.java (renamed from bundles/org.eclipse.ui.net/src/org/eclipse/net/internal/ui/ProxyPreferencePage.java)35
-rw-r--r--bundles/org.eclipse.ui.net/src/org/eclipse/ui/internal/net/auth/Authentication.java (renamed from bundles/org.eclipse.ui.net/src/org/eclipse/net/internal/ui/auth/Authentication.java)2
-rw-r--r--bundles/org.eclipse.ui.net/src/org/eclipse/ui/internal/net/auth/NetAuthenticator.java (renamed from bundles/org.eclipse.ui.net/src/org/eclipse/net/internal/ui/auth/NetAuthenticator.java)2
-rw-r--r--bundles/org.eclipse.ui.net/src/org/eclipse/ui/internal/net/auth/UserValidationDialog.java (renamed from bundles/org.eclipse.ui.net/src/org/eclipse/net/internal/ui/auth/UserValidationDialog.java)4
-rw-r--r--bundles/org.eclipse.ui.net/src/org/eclipse/ui/internal/net/messages.properties (renamed from bundles/org.eclipse.ui.net/src/org/eclipse/net/internal/ui/messages.properties)1
-rw-r--r--tests/org.eclipse.core.tests.net/.project2
-rw-r--r--tests/org.eclipse.core.tests.net/META-INF/MANIFEST.MF8
-rw-r--r--tests/org.eclipse.core.tests.net/src/org/eclipse/core/tests/net/Activator.java (renamed from tests/org.eclipse.core.tests.net/src/org/eclipse/net/internal/tests/Activator.java)11
-rw-r--r--tests/org.eclipse.core.tests.net/src/org/eclipse/core/tests/net/AllNetTests.java (renamed from tests/org.eclipse.core.tests.net/src/org/eclipse/net/internal/tests/AllNetTests.java)2
-rw-r--r--tests/org.eclipse.core.tests.net/src/org/eclipse/core/tests/net/NetTest.java (renamed from tests/org.eclipse.core.tests.net/src/org/eclipse/net/internal/tests/NetTest.java)66
40 files changed, 525 insertions, 294 deletions
diff --git a/bundles/org.eclipse.core.net/.project b/bundles/org.eclipse.core.net/.project
index 4222d9f31..ed95a1154 100644
--- a/bundles/org.eclipse.core.net/.project
+++ b/bundles/org.eclipse.core.net/.project
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>org.eclipse.net.core</name>
+ <name>org.eclipse.core.net</name>
<comment></comment>
<projects>
</projects>
diff --git a/bundles/org.eclipse.core.net/META-INF/MANIFEST.MF b/bundles/org.eclipse.core.net/META-INF/MANIFEST.MF
index 6ac2c516c..3b5510949 100644
--- a/bundles/org.eclipse.core.net/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.core.net/META-INF/MANIFEST.MF
@@ -1,15 +1,15 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %PLUGIN_NAME
-Bundle-SymbolicName: org.eclipse.net.core; singleton:=true
+Bundle-SymbolicName: org.eclipse.core.net;singleton:=true
Bundle-Version: 1.0.0.qualifier
-Bundle-Activator: org.eclipse.net.internal.core.NetCorePlugin
+Bundle-Activator: org.eclipse.core.internal.net.Activator
Bundle-Vendor: %PLUGIN_PROVIDER
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.3.0,4.0.0)"
Eclipse-LazyStart: true
-Export-Package: org.eclipse.net.core,
- org.eclipse.net.internal.core;x-internal:=true
+Export-Package: org.eclipse.core.internal.net;x-internal:=true,
+ org.eclipse.core.net.proxy
Bundle-RequiredExecutionEnvironment: J2SE-1.4,
CDC-1.0/Foundation-1.0,
J2SE-1.3
diff --git a/bundles/org.eclipse.core.net/build.properties b/bundles/org.eclipse.core.net/build.properties
index 2b112c461..1dde0d2c6 100644
--- a/bundles/org.eclipse.core.net/build.properties
+++ b/bundles/org.eclipse.core.net/build.properties
@@ -3,5 +3,6 @@ output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.properties,\
- about.html
+ about.html,\
+ plugin.xml
src.includes = about.html
diff --git a/bundles/org.eclipse.core.net/plugin.xml b/bundles/org.eclipse.core.net/plugin.xml
new file mode 100644
index 000000000..e5afc887a
--- /dev/null
+++ b/bundles/org.eclipse.core.net/plugin.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension-point id="authenticator" name="Authenticator" schema="schema/authenticator.exsd"/>
+ <extension
+ point="org.eclipse.core.runtime.preferences">
+ <initializer
+ class="org.eclipse.core.internal.net.PreferenceInitializer">
+ </initializer>
+ </extension>
+
+</plugin>
diff --git a/bundles/org.eclipse.core.net/schema/authenticator.exsd b/bundles/org.eclipse.core.net/schema/authenticator.exsd
new file mode 100644
index 000000000..77e354190
--- /dev/null
+++ b/bundles/org.eclipse.core.net/schema/authenticator.exsd
@@ -0,0 +1,105 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.core.net">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.core.net" id="authenticator" name="Authenticator"/>
+ </appInfo>
+ <documentation>
+ Internal extension point to allow a java.net.Authenticator to ne provided by a UI plug-in
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="authenticator"/>
+ </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="authenticator">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="java.net.Authenticator"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 1.0
+ </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>
+ This extension point is not API
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/net/internal/core/NetCorePlugin.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/Activator.java
index 558636981..def0948a1 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/net/internal/core/NetCorePlugin.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/Activator.java
@@ -13,28 +13,37 @@
* 20070201 154100 pmoogk@ca.ibm.com - Peter Moogk, Port internet code from WTP to Eclipse base.
*******************************************************************************/
-package org.eclipse.net.internal.core;
+package org.eclipse.core.internal.net;
+import java.util.Hashtable;
+
+import org.eclipse.core.net.proxy.IProxyService;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.eclipse.net.core.NetCore;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
-public class NetCorePlugin extends Plugin {
+public class Activator extends Plugin {
/**
* The identifier of the descriptor of this plugin in plugin.xml.
*/
- public static final String ID = "org.eclipse.net.core"; //$NON-NLS-1$
+ public static final String ID = "org.eclipse.core.net"; //$NON-NLS-1$
+
+ public static final String PT_AUTHENTICATOR = "authenticator"; //$NON-NLS-1$
+
+ private static final String PROP_REGISTER_SERVICE = "org.eclipse.net.core.enableProxyService"; //$NON-NLS-1$
/**
* The instance of this plugin.
*/
- private static NetCorePlugin instance;
+ private static Activator instance;
+
+ private ServiceRegistration proxyService;
/**
* Constructor for use by the Eclipse platform only.
*/
- public NetCorePlugin() {
+ public Activator() {
super();
instance = this;
}
@@ -43,13 +52,25 @@ public class NetCorePlugin extends Plugin {
* Returns the instance of this plugin.
* @return the singleton instance of this plug-in class
*/
- static public NetCorePlugin getInstance() {
+ static public Activator getInstance() {
return instance;
}
public void start(BundleContext context) throws Exception {
super.start(context);
- ((ProxyManager)NetCore.getProxyManager()).initialize();
+ if (Boolean.valueOf(System.getProperty(PROP_REGISTER_SERVICE, "true")).booleanValue()) { //$NON-NLS-1$
+ ProxyManager proxyManager = (ProxyManager)ProxyManager.getProxyManager();
+ proxyManager.initialize();
+ proxyService = getBundle().getBundleContext().registerService(IProxyService.class.getName(), proxyManager, new Hashtable());
+ }
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ if (proxyService != null) {
+ proxyService.unregister();
+ proxyService = null;
+ }
+ super.stop(context);
}
public static void logError(String message, Throwable exc) {
@@ -67,4 +88,8 @@ public class NetCorePlugin extends Plugin {
public org.osgi.service.prefs.Preferences getInstancePreferences() {
return new InstanceScope().getNode(getBundle().getSymbolicName());
}
+
+ public static void log(int severity, String message, Throwable throwable) {
+ getInstance().getLog().log(new Status(severity, ID, 0, message, throwable));
+ }
}
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/PreferenceInitializer.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/PreferenceInitializer.java
new file mode 100644
index 000000000..cd767491c
--- /dev/null
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/PreferenceInitializer.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.core.internal.net;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+
+public class PreferenceInitializer extends AbstractPreferenceInitializer {
+
+ public PreferenceInitializer() {
+ super();
+ }
+
+ public void initializeDefaultPreferences() {
+ // TODO: We should set defaults in the default scope
+ //((ProxyManager)ProxyManager.getProxyManager()).initialize();
+ }
+
+}
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/net/internal/core/ProxyChangeEvent.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyChangeEvent.java
index 8e3106230..3f3584a50 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/net/internal/core/ProxyChangeEvent.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyChangeEvent.java
@@ -8,10 +8,10 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.net.internal.core;
+package org.eclipse.core.internal.net;
-import org.eclipse.net.core.IProxyChangeEvent;
-import org.eclipse.net.core.IProxyData;
+import org.eclipse.core.net.proxy.IProxyChangeEvent;
+import org.eclipse.core.net.proxy.IProxyData;
public class ProxyChangeEvent implements IProxyChangeEvent {
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/net/internal/core/ProxyData.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyData.java
index 88ddc79e5..8805ece8d 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/net/internal/core/ProxyData.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyData.java
@@ -8,9 +8,9 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.net.internal.core;
+package org.eclipse.core.internal.net;
-import org.eclipse.net.core.IProxyData;
+import org.eclipse.core.net.proxy.IProxyData;
public class ProxyData implements IProxyData {
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/net/internal/core/ProxyManager.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyManager.java
index ebc84d93f..86f7a5dd0 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/net/internal/core/ProxyManager.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyManager.java
@@ -8,19 +8,23 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.net.internal.core;
+package org.eclipse.core.internal.net;
+import java.net.Authenticator;
import java.util.*;
+import org.eclipse.core.net.proxy.*;
import org.eclipse.core.runtime.*;
-import org.eclipse.net.core.*;
+import org.eclipse.osgi.util.NLS;
import org.osgi.service.prefs.BackingStoreException;
-public class ProxyManager implements IProxyManager {
+public class ProxyManager implements IProxyService {
private static final String PREF_NON_PROXIED_HOSTS = "nonProxiedHosts"; //$NON-NLS-1$
private static final String PREF_ENABLED = "proxiesEnabled"; //$NON-NLS-1$
+ private static IProxyService proxyManager;
+
ListenerList listeners = new ListenerList(ListenerList.IDENTITY);
private String[] nonProxiedHosts;
private final ProxyType[] proxies = new ProxyType[] {
@@ -29,6 +33,16 @@ public class ProxyManager implements IProxyManager {
new ProxyType(IProxyData.SOCKS_PROXY_TYPE)
};
+ /**
+ * Return the proxy manager.
+ * @return the proxy manager
+ */
+ public synchronized static IProxyService getProxyManager() {
+ if (proxyManager == null)
+ proxyManager = new ProxyManager();
+ return proxyManager;
+ }
+
/* (non-Javadoc)
* @see org.eclipse.core.net.IProxyManager#addProxyChangeListener(org.eclipse.core.net.IProxyChangeListener)
*/
@@ -63,7 +77,7 @@ public class ProxyManager implements IProxyManager {
*/
public synchronized String[] getNonProxiedHosts() {
if (nonProxiedHosts == null) {
- String prop = NetCorePlugin.getInstance().getInstancePreferences().get(PREF_NON_PROXIED_HOSTS, "localhost|127.0.0.1"); //$NON-NLS-1$
+ String prop = Activator.getInstance().getInstancePreferences().get(PREF_NON_PROXIED_HOSTS, "localhost|127.0.0.1"); //$NON-NLS-1$
nonProxiedHosts = ProxyType.convertPropertyStringToHosts(prop);
}
if (nonProxiedHosts.length == 0)
@@ -85,11 +99,11 @@ public class ProxyManager implements IProxyManager {
}
String[] oldHosts = nonProxiedHosts;
nonProxiedHosts = hosts;
- NetCorePlugin.getInstance().getInstancePreferences().put(PREF_NON_PROXIED_HOSTS, ProxyType.convertHostsToPropertyString(nonProxiedHosts));
+ Activator.getInstance().getInstancePreferences().put(PREF_NON_PROXIED_HOSTS, ProxyType.convertHostsToPropertyString(nonProxiedHosts));
try {
- NetCorePlugin.getInstance().getInstancePreferences().flush();
+ Activator.getInstance().getInstancePreferences().flush();
} catch (BackingStoreException e) {
- NetCorePlugin.logError(
+ Activator.logError(
"An error occurred while writing out the non-proxied hosts list", e); //$NON-NLS-1$
}
IProxyData[] data = getProxyData();
@@ -147,7 +161,7 @@ public class ProxyManager implements IProxyManager {
* @see org.eclipse.core.net.IProxyManager#isProxiesEnabled()
*/
public boolean isProxiesEnabled() {
- return NetCorePlugin.getInstance().getInstancePreferences().getBoolean(PREF_ENABLED, false);
+ return Activator.getInstance().getInstancePreferences().getBoolean(PREF_ENABLED, false);
}
/* (non-Javadoc)
@@ -157,14 +171,14 @@ public class ProxyManager implements IProxyManager {
boolean current = isProxiesEnabled();
if (current == enabled)
return;
- NetCorePlugin.getInstance().getInstancePreferences().putBoolean(PREF_ENABLED, enabled);
+ Activator.getInstance().getInstancePreferences().putBoolean(PREF_ENABLED, enabled);
Properties sysProps = System.getProperties();
sysProps.put("proxySet", enabled ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
updateSystemProperties();
try {
- NetCorePlugin.getInstance().getInstancePreferences().flush();
+ Activator.getInstance().getInstancePreferences().flush();
} catch (BackingStoreException e) {
- NetCorePlugin.logError(
+ Activator.logError(
"An error occurred while writing out the enablement state", e); //$NON-NLS-1$
}
String[] hosts = getNonProxiedHosts();
@@ -185,6 +199,7 @@ public class ProxyManager implements IProxyManager {
ProxyType type = proxies[i];
type.initialize(isProxiesEnabled());
}
+ registerAuthenticator();
}
public IProxyData getProxyData(String type) {
@@ -238,5 +253,31 @@ public class ProxyManager implements IProxyManager {
}
return null;
}
+
+ private void registerAuthenticator() {
+ Authenticator a = getPluggedInAuthenticator();
+ if (a != null) {
+ Authenticator.setDefault(a);
+ }
+ }
+
+ private Authenticator getPluggedInAuthenticator() {
+ IExtension[] extensions = Platform.getExtensionRegistry().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;
+ }
+ }
}
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/net/internal/core/ProxyType.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyType.java
index babcbc8d1..94107809c 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/net/internal/core/ProxyType.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyType.java
@@ -8,15 +8,14 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.net.internal.core;
+package org.eclipse.core.internal.net;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.*;
+import org.eclipse.core.net.proxy.IProxyData;
import org.eclipse.core.runtime.*;
-import org.eclipse.net.core.IProxyData;
-import org.eclipse.net.core.NetCore;
import org.eclipse.osgi.util.NLS;
import org.osgi.service.prefs.BackingStoreException;
import org.osgi.service.prefs.Preferences;
@@ -86,7 +85,7 @@ public class ProxyType {
* @return a preferences node
*/
private Preferences getParentPreferences() {
- return NetCorePlugin.getInstance().getInstancePreferences().node(
+ return Activator.getInstance().getInstancePreferences().node(
PREF_PROXY_DATA_NODE);
}
@@ -96,7 +95,7 @@ public class ProxyType {
private IProxyData createProxyData(String type, Preferences node) {
String host = node.get(PREF_PROXY_HOST, null);
- if (host.length() == 0)
+ if (host != null && host.length() == 0)
host = null;
int port = node.getInt(PREF_PROXY_PORT, -1);
boolean requiresAuth = node.getBoolean(PREF_PROXY_HAS_AUTH, false);
@@ -118,7 +117,7 @@ public class ProxyType {
node.removeNode();
parent.flush();
} catch (BackingStoreException e) {
- NetCorePlugin.logError(NLS.bind(
+ Activator.logError(NLS.bind(
"An error occurred removing the {0} proxy node from the preference store", proxyData.getType()), e); //$NON-NLS-1$
}
} else {
@@ -128,7 +127,7 @@ public class ProxyType {
try {
node.flush();
} catch (BackingStoreException e) {
- NetCorePlugin.logError(NLS.bind(
+ Activator.logError(NLS.bind(
"The {0} proxy node could not be written", proxyData.getType()), e); //$NON-NLS-1$
}
}
@@ -146,7 +145,7 @@ public class ProxyType {
updateSocksSystemProperties(proxyData, proxiesEnabled);
}
} catch (SecurityException e) {
- NetCorePlugin.logError("A security exception occurred while trying to put the proxy data into the system properties", e); //$NON-NLS-1$
+ Activator.logError("A security exception occurred while trying to put the proxy data into the system properties", e); //$NON-NLS-1$
}
}
@@ -175,7 +174,7 @@ public class ProxyType {
sysProps.put("http.proxyPort", String.valueOf(port)); //$NON-NLS-1$
}
sysProps.put("http.nonProxyHosts", //$NON-NLS-1$
- convertHostsToPropertyString(NetCore.getProxyManager().getNonProxiedHosts()));
+ convertHostsToPropertyString(ProxyManager.getProxyManager().getNonProxiedHosts()));
String userid = data.getUserId();
String password = data.getPassword();
@@ -213,7 +212,7 @@ public class ProxyType {
sysProps.put("https.proxyPort", String.valueOf(port)); //$NON-NLS-1$
}
sysProps.put("https.nonProxyHosts", //$NON-NLS-1$
- convertHostsToPropertyString(NetCore.getProxyManager().getNonProxiedHosts()));
+ convertHostsToPropertyString(ProxyManager.getProxyManager().getNonProxiedHosts()));
String userid = data.getUserId();
String password = data.getPassword();
@@ -290,7 +289,7 @@ public class ProxyType {
Platform.addAuthorizationInfo(FAKE_URL, getName(), "", authInfo); //$NON-NLS-1$
}
} catch (CoreException e) {
- NetCorePlugin.logError(e.getMessage(), e);
+ Activator.logError(e.getMessage(), e);
}
}
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/net/internal/core/StringMatcher.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/StringMatcher.java
index ce73c450c..c3dbe288b 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/net/internal/core/StringMatcher.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/StringMatcher.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.net.internal.core;
+package org.eclipse.core.internal.net;
import java.util.Vector;
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/net/core/IProxyChangeEvent.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/net/proxy/IProxyChangeEvent.java
index 17ac4bf86..caed9d712 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/net/core/IProxyChangeEvent.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/net/proxy/IProxyChangeEvent.java
@@ -8,15 +8,15 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.net.core;
+package org.eclipse.core.net.proxy;
/**
* Event which describes a change in the proxy information managed by
- * the {@link IProxyManager}.
+ * the {@link IProxyService}.
* <p>
* This interface is not intended to be implemented by clients.
- * @see IProxyManager
+ * @see IProxyService
* @since 1.0
*/
public interface IProxyChangeEvent {
@@ -38,7 +38,7 @@ public interface IProxyChangeEvent {
* manager has changed. Client should consult the manager to determine
* the current enablement
* @see #getChangeType()
- * @see IProxyManager#isProxiesEnabled()
+ * @see IProxyService#isProxiesEnabled()
*/
public static final int PROXY_MANAGER_ENABLEMENT_CHANGE = 3;
@@ -75,7 +75,7 @@ public interface IProxyChangeEvent {
/**
* For a change type of {@link #PROXY_DATA_CHANGED}, this method returns
* the state of the changed known proxies after the change occurred. Clients
- * should check the {@link IProxyManager#isProxiesEnabled()} method to see
+ * should check the {@link IProxyService#isProxiesEnabled()} method to see
* if the proxy data change was the result of proxies being disabled.
* @return the state of the changed known proxies after the change occurred
*/
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/net/core/IProxyChangeListener.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/net/proxy/IProxyChangeListener.java
index 97fd6ca7f..ffb2137e2 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/net/core/IProxyChangeListener.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/net/proxy/IProxyChangeListener.java
@@ -8,10 +8,10 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.net.core;
+package org.eclipse.core.net.proxy;
/**
- * A listener that, when registered with the {@link IProxyManager}, gets notified when the
+ * A listener that, when registered with the {@link IProxyService}, gets notified when the
* proxy information changes.
* <p>
* This interface may be implemented by clients
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/net/core/IProxyData.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/net/proxy/IProxyData.java
index fc3012fa8..51c600ea1 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/net/core/IProxyData.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/net/proxy/IProxyData.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.net.core;
+package org.eclipse.core.net.proxy;
/**
* An {@link IProxyData} contains the information that is required to connect
@@ -60,9 +60,9 @@ public interface IProxyData {
* If no proxy server of this type is available, the host name should
* be set to <code>null</code>.
* <p>
- * Setting this value will not affect the data returned from {@link IProxyManager#getProxyData()}.
+ * Setting this value will not affect the data returned from {@link IProxyService#getProxyData()}.
* Clients can change the global settings by changing the proxy data instances and then
- * by calling {@link IProxyManager#setProxyData(IProxyData[])} with the adjusted data.
+ * by calling {@link IProxyService#setProxyData(IProxyData[])} with the adjusted data.
* @param host the host name for the proxy server or <code>null</code>
*/
void setHost(String host);
@@ -79,9 +79,9 @@ public interface IProxyData {
* to a value of -1 will indicate that the default port number for
* the proxy type should be used.
* <p>
- * Setting this value will not affect the data returned from {@link IProxyManager#getProxyData()}.
+ * Setting this value will not affect the data returned from {@link IProxyService#getProxyData()}.
* Clients can change the global settings by changing the proxy data instances and then
- * by calling {@link IProxyManager#setProxyData(IProxyData[])} with the adjusted data.
+ * by calling {@link IProxyService#setProxyData(IProxyData[])} with the adjusted data.
* @param port the port that should be used when connecting to the host
* or -1 if the default port is to be used
*/
@@ -101,9 +101,9 @@ public interface IProxyData {
* for the proxy. A <code>null</code> should be used if there is no
* authentication information.
* <p>
- * Setting this value will not affect the data returned from {@link IProxyManager#getProxyData()}.
+ * Setting this value will not affect the data returned from {@link IProxyService#getProxyData()}.
* Clients can change the global settings by changing the proxy data instances and then
- * by calling {@link IProxyManager#setProxyData(IProxyData[])} with the adjusted data.
+ * by calling {@link IProxyService#setProxyData(IProxyData[])} with the adjusted data.
* @param userid the id of the user that should be used when authenticating
* for the proxy or <code>null</code>
*/
@@ -123,9 +123,9 @@ public interface IProxyData {
* for the proxy. A <code>null</code> should be passed if there is no
* password or the password is not known.
* <p>
- * Setting this value will not affect the data returned from {@link IProxyManager#getProxyData()}.
+ * Setting this value will not affect the data returned from {@link IProxyService#getProxyData()}.
* Clients can change the global settings by changing the proxy data instances and then
- * by calling {@link IProxyManager#setProxyData(IProxyData[])} with the adjusted data.
+ * by calling {@link IProxyService#setProxyData(IProxyData[])} with the adjusted data.
* @param password the password that should be used when authenticating
* for the proxy or <code>null</code>
*/
@@ -143,7 +143,7 @@ public interface IProxyData {
/**
* Set the values of this data to represent a disabling of its type.
* Note that the proxy type will not be disabled unless the client
- * calls {@link IProxyManager#setProxyData(IProxyData[])} with the
+ * calls {@link IProxyService#setProxyData(IProxyData[])} with the
* disabled data as a parameter. A proxy data can be enabled by setting
* the host.
*/
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/net/core/IProxyManager.java b/bundles/org.eclipse.core.net/src/org/eclipse/core/net/proxy/IProxyService.java
index ae6cb3124..5fda2349a 100644
--- a/bundles/org.eclipse.core.net/src/org/eclipse/net/core/IProxyManager.java
+++ b/bundles/org.eclipse.core.net/src/org/eclipse/core/net/proxy/IProxyService.java
@@ -8,17 +8,21 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.net.core;
+package org.eclipse.core.net.proxy;
import org.eclipse.core.runtime.CoreException;
+import org.osgi.framework.BundleContext;
/**
- * Manages the proxy data and related information.
+ * Manages the proxy data and related information. The proxy service is registered as
+ * an OSGi service. Clients can obtain an instance of the service from their bundle context
+ * or from a service tracker.
* <p>
* This interface is not intended to be implemented by clients.
* @since 1.0
+ * @see BundleContext#getServiceReference(String)
*/
-public interface IProxyManager {
+public interface IProxyService {
/**
* Set whether proxy support should be enabled. The current proxy settings are
diff --git a/bundles/org.eclipse.core.net/src/org/eclipse/net/core/NetCore.java b/bundles/org.eclipse.core.net/src/org/eclipse/net/core/NetCore.java
deleted file mode 100644
index abc69ea64..000000000
--- a/bundles/org.eclipse.core.net/src/org/eclipse/net/core/NetCore.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.net.core;
-
-import org.eclipse.net.internal.core.ProxyManager;
-
-/**
- * Provides access to the {@link IProxyManager} and other net related functionality.
- * * <p>
- * This class is not intended to be subclasses or instantiated by clients.
- * @since 1.0
- */
-public final class NetCore {
-
- private static IProxyManager proxyManager;
-
- private NetCore() {
- super();
- }
-
- /**
- * Return the proxy manager.
- * @return the proxy manager
- */
- public synchronized static IProxyManager getProxyManager() {
- if (proxyManager == null)
- proxyManager = new ProxyManager();
- return proxyManager;
- }
-}
diff --git a/bundles/org.eclipse.jsch.core/META-INF/MANIFEST.MF b/bundles/org.eclipse.jsch.core/META-INF/MANIFEST.MF
index 60a6f01b5..02095c1e4 100644
--- a/bundles/org.eclipse.jsch.core/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.jsch.core/META-INF/MANIFEST.MF
@@ -9,7 +9,7 @@ Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.3.0,4.0.0)",
com.jcraft.jsch;bundle-version="[0.1.28,1.0.0)",
org.eclipse.core.resources;bundle-version="[3.3.0,4.0.0)",
- org.eclipse.net.core;bundle-version="[1.0.0,2.0.0)"
+ org.eclipse.core.net;bundle-version="[1.0.0,2.0.0)"
Eclipse-LazyStart: true
Export-Package: org.eclipse.jsch.core,
org.eclipse.jsch.internal.core
diff --git a/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/JSchCorePlugin.java b/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/JSchCorePlugin.java
index 039d3f618..d00848507 100644
--- a/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/JSchCorePlugin.java
+++ b/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/JSchCorePlugin.java
@@ -14,9 +14,13 @@ package org.eclipse.jsch.internal.core;
//import org.eclipse.core.runtime.Plugin;
import java.util.Map;
+import org.eclipse.core.net.proxy.IProxyService;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.preferences.*;
import org.eclipse.osgi.util.NLS;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.util.tracker.ServiceTracker;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.JSchException;
@@ -41,6 +45,7 @@ public class JSchCorePlugin extends Plugin{
public static final String PT_AUTHENTICATOR="authenticator"; //$NON-NLS-1$
private static JSchCorePlugin plugin;
+ private ServiceTracker tracker;
public JSchCorePlugin(){
plugin=this;
@@ -198,4 +203,24 @@ public class JSchCorePlugin extends Plugin{
current_pkeys=Utils.loadPrivateKeys(getJSch(), current_pkeys);
setNeedToLoadKeys(false);
}
+
+ /**
+ * Return the {@link IProxyService} or <code>null</code> if the
+ * service is not available.
+ * @return the {@link IProxyService} or <code>null</code>
+ */
+ public IProxyService getProxyService() {
+ return (IProxyService)tracker.getService();
+ }
+
+ public void start(BundleContext context) throws Exception{
+ super.start(context);
+ tracker = new ServiceTracker(getBundle().getBundleContext(),IProxyService.class.getName(), null);
+ tracker.open();
+ }
+
+ public void stop(BundleContext context) throws Exception{
+ super.stop(context);
+ tracker.close();
+ }
}
diff --git a/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/Utils.java b/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/Utils.java
index 59b5d73f6..51d66f90b 100644
--- a/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/Utils.java
+++ b/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/Utils.java
@@ -12,10 +12,10 @@ package org.eclipse.jsch.internal.core;
import java.util.Hashtable;
+import org.eclipse.core.net.proxy.IProxyData;
+import org.eclipse.core.net.proxy.IProxyService;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Preferences;
-import org.eclipse.net.core.IProxyData;
-import org.eclipse.net.core.NetCore;
import com.jcraft.jsch.*;
@@ -76,7 +76,10 @@ public class Utils{
}
public static void setProxy(Session session){
- boolean useProxy=NetCore.getProxyManager().isProxiesEnabled();
+ IProxyService proxyService=JSchCorePlugin.getPlugin().getProxyService();
+ if (proxyService == null)
+ return;
+ boolean useProxy=proxyService.isProxiesEnabled();
if(!useProxy)
return;
Proxy proxy=null;
@@ -130,9 +133,12 @@ public class Utils{
}
private static IProxyData getProxyData(String host){
- IProxyData data = NetCore.getProxyManager().getProxyDataForHost(host, IProxyData.HTTPS_PROXY_TYPE);
+ IProxyService proxyService=JSchCorePlugin.getPlugin().getProxyService();
+ if (proxyService == null)
+ return null;
+ IProxyData data = proxyService.getProxyDataForHost(host, IProxyData.HTTPS_PROXY_TYPE);
if (data == null || data.getHost() == null) {
- data = NetCore.getProxyManager().getProxyDataForHost(host, IProxyData.SOCKS_PROXY_TYPE);
+ data = proxyService.getProxyDataForHost(host, IProxyData.SOCKS_PROXY_TYPE);
}
if (data == null || data.getHost() == null || getProxyType(data) == null)
return null;
diff --git a/bundles/org.eclipse.ui.net/.project b/bundles/org.eclipse.ui.net/.project
index 3269c643e..e93f2213f 100644
--- a/bundles/org.eclipse.ui.net/.project
+++ b/bundles/org.eclipse.ui.net/.project
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>org.eclipse.net.ui</name>
+ <name>org.eclipse.ui.net</name>
<comment></comment>
<projects>
</projects>
diff --git a/bundles/org.eclipse.ui.net/META-INF/MANIFEST.MF b/bundles/org.eclipse.ui.net/META-INF/MANIFEST.MF
index 13aa27687..e816d05c0 100644
--- a/bundles/org.eclipse.ui.net/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.ui.net/META-INF/MANIFEST.MF
@@ -1,14 +1,14 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %PLUGIN_NAME
-Bundle-SymbolicName: org.eclipse.net.ui; singleton:=true
+Bundle-SymbolicName: org.eclipse.ui.net; singleton:=true
Bundle-Version: 1.0.0.qualifier
-Bundle-Activator: org.eclipse.net.internal.ui.Activator
+Bundle-Activator: org.eclipse.ui.internal.net.Activator
Bundle-Vendor: %PLUGIN_PROVIDER
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui;bundle-version="[3.3.0,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.3.0,4.0.0)",
- org.eclipse.net.core;bundle-version="[1.0.0,2.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,
diff --git a/bundles/org.eclipse.ui.net/plugin.xml b/bundles/org.eclipse.ui.net/plugin.xml
index df8edd818..41881f288 100644
--- a/bundles/org.eclipse.ui.net/plugin.xml
+++ b/bundles/org.eclipse.ui.net/plugin.xml
@@ -6,9 +6,15 @@
<extension point="org.eclipse.ui.preferencePages">
<page
id = "org.eclipse.net.ui.NetPreferences"
- class = "org.eclipse.net.internal.ui.ProxyPreferencePage"
+ class = "org.eclipse.ui.internal.net.ProxyPreferencePage"
category = "org.eclipse.ui.preferencePages.Workbench"
name = "%PLUGIN_INTERNET_PREFERENCE_TITLE"/>
</extension>
+ <extension
+ point="org.eclipse.core.net.authenticator">
+ <authenticator
+ class="org.eclipse.ui.internal.net.auth.NetAuthenticator">
+ </authenticator>
+ </extension>
</plugin>
diff --git a/bundles/org.eclipse.ui.net/src/org/eclipse/net/internal/ui/NetUIMessages.java b/bundles/org.eclipse.ui.net/src/org/eclipse/net/internal/ui/NetUIMessages.java
deleted file mode 100644
index b23bc4c45..000000000
--- a/bundles/org.eclipse.ui.net/src/org/eclipse/net/internal/ui/NetUIMessages.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 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
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20070201 154100 pmoogk@ca.ibm.com - Peter Moogk, Port internet code from WTP to Eclipse base.
- *******************************************************************************/
-package org.eclipse.net.internal.ui;
-
-import org.eclipse.osgi.util.NLS;
-
-public final class NetUIMessages extends NLS {
-
- private static final String BUNDLE_NAME = "org.eclipse.net.internal.ui.messages";//$NON-NLS-1$
-
- private NetUIMessages() {
- // Do not instantiate
- }
-
- public static String BUTTON_PREFERENCE_ADD;
- public static String BUTTON_PREFERENCE_EDIT;
- public static String BUTTON_PREFERENCE_REMOVE;
- public static String InternetCategoryPage_0;
- public static String InternetCategoryPage_1;
-public static String ProxyPreferencePage_0;
-public static String ProxyPreferencePage_1;
- public static String ProxyPreferencePage_2;
- public static String ProxyPreferencePage_22;
-public static String ProxyPreferencePage_23;
-public static String ProxyPreferencePage_24;
-public static String ProxyPreferencePage_25;
-public static String ProxyPreferencePage_26;
-public static String ProxyPreferencePage_27;
- public static String ProxyPreferencePage_3;
-public static String ProxyPreferencePage_37;
-public static String ProxyPreferencePage_38;
-public static String ProxyPreferencePage_39;
- public static String ProxyPreferencePage_4;
- public static String ProxyPreferencePage_5;
- public static String ProxyPreferencePage_6;
- public static String ProxyPreferencePage_7;
- public static String ProxyPreferencePage_8;
- public static String ProxyPreferencePage_9;
- public static String TITLE_PREFERENCE_HOSTS_DIALOG;
- public static String LABEL_PREFERENCE_HOSTS_DIALOG;
-public static String UserValidationDialog_0;
-public static String UserValidationDialog_1;
-public static String UserValidationDialog_2;
-public static String UserValidationDialog_3;
-
- static {
- NLS.initializeMessages(BUNDLE_NAME, NetUIMessages.class);
- }
-}
diff --git a/bundles/org.eclipse.ui.net/src/org/eclipse/net/ui/NetUI.java b/bundles/org.eclipse.ui.net/src/org/eclipse/net/ui/NetUI.java
deleted file mode 100644
index 575528524..000000000
--- a/bundles/org.eclipse.ui.net/src/org/eclipse/net/ui/NetUI.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.net.ui;
-
-import java.net.Authenticator;
-
-import org.eclipse.net.core.*;
-import org.eclipse.net.internal.ui.auth.NetAuthenticator;
-
-/**
- * Provides access to the UI functionality associated with networking.
- * <p>
- * This class is not intended to be subclasses or instantiated by clients.
- * @since 1.0
- */
-public final class NetUI {
-
- private NetUI() {
- super();
- }
-
- /**
- * Method to be called by the application to ensure that the Java system
- * properties related to proxies are set along with the default {@link Authenticator}.
- */
- public static void initialize() {
- // Prime the core to set the system properties
- NetCore.getProxyManager();
- // Set the authenticator
- Authenticator.setDefault(new NetAuthenticator());
- }
-
-}
diff --git a/bundles/org.eclipse.ui.net/src/org/eclipse/net/internal/ui/Activator.java b/bundles/org.eclipse.ui.net/src/org/eclipse/ui/internal/net/Activator.java
index 3ee6620ac..a1e4d2999 100644
--- a/bundles/org.eclipse.ui.net/src/org/eclipse/net/internal/ui/Activator.java
+++ b/bundles/org.eclipse.ui.net/src/org/eclipse/ui/internal/net/Activator.java
@@ -11,24 +11,26 @@
* -------- -------- -----------------------------------------------------------
* 20070201 154100 pmoogk@ca.ibm.com - Peter Moogk, Port internet code from WTP to Eclipse base.
*******************************************************************************/
-package org.eclipse.net.internal.ui;
+package org.eclipse.ui.internal.net;
-import org.eclipse.net.ui.NetUI;
+import org.eclipse.core.net.proxy.IProxyService;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
+import org.osgi.util.tracker.ServiceTracker;
/**
* The activator class controls the plug-in life cycle
*/
-public class Activator extends AbstractUIPlugin
-{
+public class Activator extends AbstractUIPlugin {
// The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.net.ui"; //$NON-NLS-1$
+ public static final String PLUGIN_ID = "org.eclipse.ui.net"; //$NON-NLS-1$
// The shared instance
private static Activator plugin;
-
+
+ private ServiceTracker tracker;
+
/**
* The constructor
*/
@@ -36,31 +38,35 @@ public class Activator extends AbstractUIPlugin
plugin = this;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Return the {@link IProxyService} or <code>null</code> if the service is
+ * not available.
+ *
+ * @return the {@link IProxyService} or <code>null</code>
*/
+ public IProxyService getProxyService() {
+ return (IProxyService) tracker.getService();
+ }
+
public void start(BundleContext context) throws Exception {
super.start(context);
- // TODO: Temporarily make this plug-in self initializing
- NetUI.initialize();
+ tracker = new ServiceTracker(getBundle().getBundleContext(),
+ IProxyService.class.getName(), null);
+ tracker.open();
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
+ tracker.close();
}
}
diff --git a/bundles/org.eclipse.ui.net/src/org/eclipse/ui/internal/net/NetUIMessages.java b/bundles/org.eclipse.ui.net/src/org/eclipse/ui/internal/net/NetUIMessages.java
new file mode 100644
index 000000000..d768a1f7e
--- /dev/null
+++ b/bundles/org.eclipse.ui.net/src/org/eclipse/ui/internal/net/NetUIMessages.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2007 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
+ * yyyymmdd bug Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20070201 154100 pmoogk@ca.ibm.com - Peter Moogk, Port internet code from WTP to Eclipse base.
+ *******************************************************************************/
+package org.eclipse.ui.internal.net;
+
+import org.eclipse.osgi.util.NLS;
+
+public final class NetUIMessages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.ui.internal.net.messages";//$NON-NLS-1$
+
+ private NetUIMessages() {
+ // Do not instantiate
+ }
+
+ public static String BUTTON_PREFERENCE_ADD;
+
+ public static String BUTTON_PREFERENCE_EDIT;
+
+ public static String BUTTON_PREFERENCE_REMOVE;
+
+ public static String InternetCategoryPage_0;
+
+ public static String InternetCategoryPage_1;
+
+ public static String ProxyPreferencePage_0;
+
+ public static String ProxyPreferencePage_1;
+
+ public static String ProxyPreferencePage_2;
+
+ public static String ProxyPreferencePage_22;
+
+ public static String ProxyPreferencePage_23;
+
+ public static String ProxyPreferencePage_24;
+
+ public static String ProxyPreferencePage_25;
+
+ public static String ProxyPreferencePage_26;
+
+ public static String ProxyPreferencePage_27;
+
+ public static String ProxyPreferencePage_3;
+
+ public static String ProxyPreferencePage_37;
+
+ public static String ProxyPreferencePage_38;
+
+ public static String ProxyPreferencePage_39;
+
+ public static String ProxyPreferencePage_4;
+
+ public static String ProxyPreferencePage_40;
+
+ public static String ProxyPreferencePage_5;
+
+ public static String ProxyPreferencePage_6;
+
+ public static String ProxyPreferencePage_7;
+
+ public static String ProxyPreferencePage_8;
+
+ public static String ProxyPreferencePage_9;
+
+ public static String TITLE_PREFERENCE_HOSTS_DIALOG;
+
+ public static String LABEL_PREFERENCE_HOSTS_DIALOG;
+
+ public static String UserValidationDialog_0;
+
+ public static String UserValidationDialog_1;
+
+ public static String UserValidationDialog_2;
+
+ public static String UserValidationDialog_3;
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, NetUIMessages.class);
+ }
+}
diff --git a/bundles/org.eclipse.ui.net/src/org/eclipse/net/internal/ui/NonProxyHostsComposite.java b/bundles/org.eclipse.ui.net/src/org/eclipse/ui/internal/net/NonProxyHostsComposite.java
index 7d113b85d..948012e64 100644
--- a/bundles/org.eclipse.ui.net/src/org/eclipse/net/internal/ui/NonProxyHostsComposite.java
+++ b/bundles/org.eclipse.ui.net/src/org/eclipse/ui/internal/net/NonProxyHostsComposite.java
@@ -13,7 +13,7 @@
* 20070201 154100 pmoogk@ca.ibm.com - Peter Moogk, Port internet code from WTP to Eclipse base.
*******************************************************************************/
-package org.eclipse.net.internal.ui;
+package org.eclipse.ui.internal.net;
import java.util.Arrays;
import java.util.Iterator;
diff --git a/bundles/org.eclipse.ui.net/src/org/eclipse/net/internal/ui/NonProxyHostsContentProvider.java b/bundles/org.eclipse.ui.net/src/org/eclipse/ui/internal/net/NonProxyHostsContentProvider.java
index fa0691564..c0167b179 100644
--- a/bundles/org.eclipse.ui.net/src/org/eclipse/net/internal/ui/NonProxyHostsContentProvider.java
+++ b/bundles/org.eclipse.ui.net/src/org/eclipse/ui/internal/net/NonProxyHostsContentProvider.java
@@ -12,7 +12,7 @@
* 20070201 154100 pmoogk@ca.ibm.com - Peter Moogk, Port internet code from WTP to Eclipse base.
*******************************************************************************/
-package org.eclipse.net.internal.ui;
+package org.eclipse.ui.internal.net;
import java.util.Collection;
diff --git a/bundles/org.eclipse.ui.net/src/org/eclipse/net/internal/ui/NonProxyHostsLabelProvider.java b/bundles/org.eclipse.ui.net/src/org/eclipse/ui/internal/net/NonProxyHostsLabelProvider.java
index 5001dfb7f..8aeeae266 100644
--- a/bundles/org.eclipse.ui.net/src/org/eclipse/net/internal/ui/NonProxyHostsLabelProvider.java
+++ b/bundles/org.eclipse.ui.net/src/org/eclipse/ui/internal/net/NonProxyHostsLabelProvider.java
@@ -12,7 +12,7 @@
* 20070201 154100 pmoogk@ca.ibm.com - Peter Moogk, Port internet code from WTP to Eclipse base.
*******************************************************************************/
-package org.eclipse.net.internal.ui;
+package org.eclipse.ui.internal.net;
import org.eclipse.jface.viewers.ILabelProviderListener;
diff --git a/bundles/org.eclipse.ui.net/src/org/eclipse/net/internal/ui/ProxyPreferencePage.java b/bundles/org.eclipse.ui.net/src/org/eclipse/ui/internal/net/ProxyPreferencePage.java
index fb7c94427..544323aed 100644
--- a/bundles/org.eclipse.ui.net/src/org/eclipse/net/internal/ui/ProxyPreferencePage.java
+++ b/bundles/org.eclipse.ui.net/src/org/eclipse/ui/internal/net/ProxyPreferencePage.java
@@ -13,18 +13,15 @@
* 20070201 154100 pmoogk@ca.ibm.com - Peter Moogk, Port internet code from WTP to Eclipse base.
* 20070219 174674 pmoogk@ca.ibm.com - Peter Moogk
*******************************************************************************/
-package org.eclipse.net.internal.ui;
+package org.eclipse.ui.internal.net;
+import org.eclipse.core.net.proxy.IProxyData;
+import org.eclipse.core.net.proxy.IProxyService;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.net.core.IProxyData;
-import org.eclipse.net.core.NetCore;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.*;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
@@ -57,6 +54,8 @@ public class ProxyPreferencePage extends PreferencePage implements
Text password;
+ private IProxyService proxyService;
+
public ProxyPreferencePage() {
super(NetUIMessages.ProxyPreferencePage_2);
setPreferenceStore(Activator.getDefault().getPreferenceStore());
@@ -68,7 +67,13 @@ public class ProxyPreferencePage extends PreferencePage implements
protected Control createContents(Composite parent) {
- proxyData = NetCore.getProxyManager().getProxyData();
+ proxyService = Activator.getDefault().getProxyService();
+ if (proxyService == null) {
+ Label l = new Label(parent, SWT.NONE);
+ l.setText(NetUIMessages.ProxyPreferencePage_40);
+ return l;
+ }
+ proxyData = proxyService.getProxyData();
entryList = new Entry[proxyData.length];
Composite composite = new Composite(parent, SWT.NONE);
@@ -203,13 +208,15 @@ public class ProxyPreferencePage extends PreferencePage implements
entryList[0].hostname.addModifyListener( modifyListener );
entryList[0].port.addModifyListener( modifyListener );
- restoreState(NetCore.getProxyManager().isProxiesEnabled());
+ restoreState(proxyService.isProxiesEnabled());
applyDialogFont(composite);
return composite;
}
protected void performApply() {
+ if (proxyService == null)
+ return;
boolean proxiesEnabled = manualProxyConfigurationButton.getSelection();
// Save the contents of the text fields to the proxy data.
@@ -217,11 +224,11 @@ public class ProxyPreferencePage extends PreferencePage implements
entryList[index].applyValues();
}
- NetCore.getProxyManager().setProxiesEnabled(proxiesEnabled);
+ proxyService.setProxiesEnabled(proxiesEnabled);
if (proxiesEnabled) {
try {
- NetCore.getProxyManager().setProxyData(proxyData);
- NetCore.getProxyManager().setNonProxiedHosts(
+ proxyService.setProxyData(proxyData);
+ proxyService.setNonProxiedHosts(
nonHostComposite.getList());
} catch (CoreException e) {
ErrorDialog.openError(getShell(), null, null, e.getStatus());
@@ -267,7 +274,9 @@ public class ProxyPreferencePage extends PreferencePage implements
directConnectionToButton.setSelection(!proxiesEnabled);
manualProxyConfigurationButton.setSelection(proxiesEnabled);
- String[] nonHostLists = NetCore.getProxyManager().getNonProxiedHosts();
+ String[] nonHostLists = null;
+ if (proxyService != null)
+ nonHostLists = proxyService.getNonProxiedHosts();
this.nonHostComposite.setList(nonHostLists == null ? new String[] {
"localhost", "127.0.0.1" } : nonHostLists); //$NON-NLS-1$ //$NON-NLS-2$
if (!proxiesEnabled) {
diff --git a/bundles/org.eclipse.ui.net/src/org/eclipse/net/internal/ui/auth/Authentication.java b/bundles/org.eclipse.ui.net/src/org/eclipse/ui/internal/net/auth/Authentication.java
index 0ad270e9b..c7d8a0bbb 100644
--- a/bundles/org.eclipse.ui.net/src/org/eclipse/net/internal/ui/auth/Authentication.java
+++ b/bundles/org.eclipse.ui.net/src/org/eclipse/ui/internal/net/auth/Authentication.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.net.internal.ui.auth;
+package org.eclipse.ui.internal.net.auth;
/**
* Keeps user and password strings.
diff --git a/bundles/org.eclipse.ui.net/src/org/eclipse/net/internal/ui/auth/NetAuthenticator.java b/bundles/org.eclipse.ui.net/src/org/eclipse/ui/internal/net/auth/NetAuthenticator.java
index e32fc0f75..4f5dade17 100644
--- a/bundles/org.eclipse.ui.net/src/org/eclipse/net/internal/ui/auth/NetAuthenticator.java
+++ b/bundles/org.eclipse.ui.net/src/org/eclipse/ui/internal/net/auth/NetAuthenticator.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.net.internal.ui.auth;
+package org.eclipse.ui.internal.net.auth;
import java.net.*;
diff --git a/bundles/org.eclipse.ui.net/src/org/eclipse/net/internal/ui/auth/UserValidationDialog.java b/bundles/org.eclipse.ui.net/src/org/eclipse/ui/internal/net/auth/UserValidationDialog.java
index 1c6eb5272..1328fdd73 100644
--- a/bundles/org.eclipse.ui.net/src/org/eclipse/net/internal/ui/auth/UserValidationDialog.java
+++ b/bundles/org.eclipse.ui.net/src/org/eclipse/ui/internal/net/auth/UserValidationDialog.java
@@ -8,17 +8,17 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.net.internal.ui.auth;
+package org.eclipse.ui.internal.net.auth;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.net.internal.ui.NetUIMessages;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.internal.net.NetUIMessages;
/**
* User authentication dialog
diff --git a/bundles/org.eclipse.ui.net/src/org/eclipse/net/internal/ui/messages.properties b/bundles/org.eclipse.ui.net/src/org/eclipse/ui/internal/net/messages.properties
index e25fae0d8..dec3244ef 100644
--- a/bundles/org.eclipse.ui.net/src/org/eclipse/net/internal/ui/messages.properties
+++ b/bundles/org.eclipse.ui.net/src/org/eclipse/ui/internal/net/messages.properties
@@ -40,6 +40,7 @@ ProxyPreferencePage_27=Specifies the basic authentication password
ProxyPreferencePage_37=&HTTP proxy:
ProxyPreferencePage_38=&SSL proxy:
ProxyPreferencePage_39=S&OCKS proxy:
+ProxyPreferencePage_40=The proxy service is not available
UserValidationDialog_0=Password Required
UserValidationDialog_1=Connect to: {0}
UserValidationDialog_2=&Password:
diff --git a/tests/org.eclipse.core.tests.net/.project b/tests/org.eclipse.core.tests.net/.project
index e9bf707bf..bb53ef766 100644
--- a/tests/org.eclipse.core.tests.net/.project
+++ b/tests/org.eclipse.core.tests.net/.project
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>org.eclipse.net.tests</name>
+ <name>org.eclipse.core.tests.net</name>
<comment></comment>
<projects>
</projects>
diff --git a/tests/org.eclipse.core.tests.net/META-INF/MANIFEST.MF b/tests/org.eclipse.core.tests.net/META-INF/MANIFEST.MF
index 534cbda5f..bc41efbf7 100644
--- a/tests/org.eclipse.core.tests.net/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.core.tests.net/META-INF/MANIFEST.MF
@@ -1,11 +1,11 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Net Tests Plug-in
-Bundle-SymbolicName: org.eclipse.net.tests
+Bundle-SymbolicName: org.eclipse.core.tests.net
Bundle-Version: 1.0.0
-Bundle-Activator: org.eclipse.net.internal.tests.Activator
+Bundle-Activator: org.eclipse.core.tests.net.Activator
Bundle-Vendor: Eclipse.org
-Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.net.core,
+Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.3.0,4.0.0)",
+ org.eclipse.core.net;bundle-version="[1.0.0,2.0.0)",
org.junit
Eclipse-LazyStart: true
diff --git a/tests/org.eclipse.core.tests.net/src/org/eclipse/net/internal/tests/Activator.java b/tests/org.eclipse.core.tests.net/src/org/eclipse/core/tests/net/Activator.java
index c1e30d835..e8ca7359b 100644
--- a/tests/org.eclipse.core.tests.net/src/org/eclipse/net/internal/tests/Activator.java
+++ b/tests/org.eclipse.core.tests.net/src/org/eclipse/core/tests/net/Activator.java
@@ -1,7 +1,9 @@
-package org.eclipse.net.internal.tests;
+package org.eclipse.core.tests.net;
+import org.eclipse.core.net.proxy.IProxyService;
import org.eclipse.core.runtime.Plugin;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
/**
* The activator class controls the plug-in life cycle
@@ -47,4 +49,11 @@ public class Activator extends Plugin {
return plugin;
}
+ public IProxyService getProxyService() {
+ ServiceReference serviceReference = getBundle().getBundleContext().getServiceReference(IProxyService.class.getName());
+ if (serviceReference != null)
+ return (IProxyService)getBundle().getBundleContext().getService(serviceReference);
+ return null;
+ }
+
}
diff --git a/tests/org.eclipse.core.tests.net/src/org/eclipse/net/internal/tests/AllNetTests.java b/tests/org.eclipse.core.tests.net/src/org/eclipse/core/tests/net/AllNetTests.java
index 63d856aeb..3d2441984 100644
--- a/tests/org.eclipse.core.tests.net/src/org/eclipse/net/internal/tests/AllNetTests.java
+++ b/tests/org.eclipse.core.tests.net/src/org/eclipse/core/tests/net/AllNetTests.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.net.internal.tests;
+package org.eclipse.core.tests.net;
import junit.framework.*;
diff --git a/tests/org.eclipse.core.tests.net/src/org/eclipse/net/internal/tests/NetTest.java b/tests/org.eclipse.core.tests.net/src/org/eclipse/core/tests/net/NetTest.java
index 1104eb953..e9d78b309 100644
--- a/tests/org.eclipse.core.tests.net/src/org/eclipse/net/internal/tests/NetTest.java
+++ b/tests/org.eclipse.core.tests.net/src/org/eclipse/core/tests/net/NetTest.java
@@ -8,16 +8,16 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.net.internal.tests;
+package org.eclipse.core.tests.net;
import java.util.*;
import junit.framework.*;
+import org.eclipse.core.internal.net.ProxyType;
+import org.eclipse.core.net.proxy.IProxyData;
+import org.eclipse.core.net.proxy.IProxyService;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.net.core.IProxyData;
-import org.eclipse.net.core.NetCore;
-import org.eclipse.net.internal.core.ProxyType;
public class NetTest extends TestCase {
@@ -46,16 +46,20 @@ public class NetTest extends TestCase {
protected void tearDown() throws Exception {
super.tearDown();
setProxiesEnabled(false);
- IProxyData[] data = NetCore.getProxyManager().getProxyData();
+ IProxyData[] data = getProxyManager().getProxyData();
for (int i = 0; i < data.length; i++) {
IProxyData proxyData = data[i];
proxyData.disable();
}
- NetCore.getProxyManager().setProxyData(data);
+ getProxyManager().setProxyData(data);
}
+ private IProxyService getProxyManager() {
+ return Activator.getDefault().getProxyService();
+ }
+
private void assertProxyDataEqual(IProxyData expectedData) {
- IProxyData data = NetCore.getProxyManager().getProxyData(expectedData.getType());
+ IProxyData data = getProxyManager().getProxyData(expectedData.getType());
assertEquals(expectedData.getType(), data.getType());
assertEquals(expectedData.getHost(), data.getHost());
assertEquals(expectedData.getPort(), data.getPort());
@@ -78,7 +82,7 @@ public class NetTest extends TestCase {
private void assertHttpSystemProperties(IProxyData proxyData, String keyPrefix) {
Properties sysProps = System.getProperties();
- if (NetCore.getProxyManager().isProxiesEnabled()) {
+ if (this.getProxyManager().isProxiesEnabled()) {
boolean isSet = Boolean.getBoolean(keyPrefix + ".proxySet");
assertEquals(proxyData.getHost() != null, isSet); //$NON-NLS-1$
assertEquals(proxyData.getHost(), sysProps.get(keyPrefix + ".proxyHost")); //$NON-NLS-1$
@@ -88,7 +92,7 @@ public class NetTest extends TestCase {
port = Integer.parseInt(portString);
assertEquals(proxyData.getPort(), port);
if (isSet)
- assertEquals(ProxyType.convertHostsToPropertyString(NetCore.getProxyManager().getNonProxiedHosts()), sysProps.get(keyPrefix + ".nonProxyHosts")); //$NON-NLS-1$
+ assertEquals(ProxyType.convertHostsToPropertyString(this.getProxyManager().getNonProxiedHosts()), sysProps.get(keyPrefix + ".nonProxyHosts")); //$NON-NLS-1$
else
assertNull(sysProps.get(keyPrefix + ".nonProxyHosts"));
assertEquals(proxyData.getUserId(), sysProps.get(keyPrefix + ".proxyUser")); //$NON-NLS-1$
@@ -107,7 +111,7 @@ public class NetTest extends TestCase {
private void assertSocksSystemProperties(IProxyData proxyData) {
Properties sysProps = System.getProperties();
- if (NetCore.getProxyManager().isProxiesEnabled()) {
+ if (this.getProxyManager().isProxiesEnabled()) {
assertEquals(proxyData.getHost(), sysProps.get("socksProxyHost")); //$NON-NLS-1$
String portString = (String)sysProps.get("socksProxyPort"); //$NON-NLS-1$
int port = -1;
@@ -123,7 +127,7 @@ public class NetTest extends TestCase {
private IProxyData getProxyData(String type) {
IProxyData data = (IProxyData)dataCache.get(type);
if (data == null) {
- data = NetCore.getProxyManager().getProxyData(type);
+ data = this.getProxyManager().getProxyData(type);
assertProxyDataEqual(data);
}
return data;
@@ -131,7 +135,7 @@ public class NetTest extends TestCase {
private void setProxyData(IProxyData data) throws CoreException {
if (isSetEnabled) {
- NetCore.getProxyManager().setProxyData(new IProxyData[] { data });
+ this.getProxyManager().setProxyData(new IProxyData[] { data });
assertProxyDataEqual(data);
} else {
dataCache.put(data.getType(), data);
@@ -186,8 +190,8 @@ public class NetTest extends TestCase {
}
private void setProxiesEnabled(boolean enabled) {
- NetCore.getProxyManager().setProxiesEnabled(enabled);
- assertEquals(enabled, NetCore.getProxyManager().isProxiesEnabled());
+ this.getProxyManager().setProxiesEnabled(enabled);
+ assertEquals(enabled, this.getProxyManager().isProxiesEnabled());
}
private void delaySettingData() {
@@ -196,7 +200,7 @@ public class NetTest extends TestCase {
private void performSettingData() throws CoreException {
IProxyData[] data = (IProxyData[]) dataCache.values().toArray(new IProxyData[dataCache.size()]);
- NetCore.getProxyManager().setProxyData(data);
+ this.getProxyManager().setProxyData(data);
for (int i = 0; i < data.length; i++) {
IProxyData proxyData = data[i];
assertProxyDataEqual(proxyData);
@@ -209,7 +213,7 @@ public class NetTest extends TestCase {
setDataTest(IProxyData.HTTP_PROXY_TYPE);
setDataTest(IProxyData.HTTPS_PROXY_TYPE);
setDataTest(IProxyData.SOCKS_PROXY_TYPE);
- IProxyData[] data = NetCore.getProxyManager().getProxyData();
+ IProxyData[] data = this.getProxyManager().getProxyData();
for (int i = 0; i < data.length; i++) {
IProxyData proxyData = data[i];
disableProxy(proxyData);
@@ -224,7 +228,7 @@ public class NetTest extends TestCase {
performSettingData();
delaySettingData();
- IProxyData[] data = NetCore.getProxyManager().getProxyData();
+ IProxyData[] data = this.getProxyManager().getProxyData();
for (int i = 0; i < data.length; i++) {
IProxyData proxyData = data[i];
disableProxy(proxyData);
@@ -241,7 +245,7 @@ public class NetTest extends TestCase {
public void testDisableAfterSet() throws CoreException {
String type = IProxyData.HTTP_PROXY_TYPE;
setHost(type);
- IProxyData data = NetCore.getProxyManager().getProxyData(type);
+ IProxyData data = this.getProxyManager().getProxyData(type);
setProxiesEnabled(false);
assertProxyDataEqual(data);
}
@@ -251,16 +255,16 @@ public class NetTest extends TestCase {
setDataTest(IProxyData.HTTPS_PROXY_TYPE);
setDataTest(IProxyData.SOCKS_PROXY_TYPE);
- IProxyData[] allData = NetCore.getProxyManager().getProxyDataForHost("www.randomhot.com");
+ IProxyData[] allData = this.getProxyManager().getProxyDataForHost("www.randomhot.com");
assertEquals(3, allData.length);
- IProxyData data = NetCore.getProxyManager().getProxyDataForHost("www.randomhot.com", IProxyData.HTTP_PROXY_TYPE);
+ IProxyData data = this.getProxyManager().getProxyDataForHost("www.randomhot.com", IProxyData.HTTP_PROXY_TYPE);
assertNotNull(data);
- allData = NetCore.getProxyManager().getProxyDataForHost("localhost");
+ allData = this.getProxyManager().getProxyDataForHost("localhost");
assertEquals(0, allData.length);
- data = NetCore.getProxyManager().getProxyDataForHost("localhost", IProxyData.HTTP_PROXY_TYPE);
+ data = this.getProxyManager().getProxyDataForHost("localhost", IProxyData.HTTP_PROXY_TYPE);
assertNull(data);
}
@@ -269,28 +273,28 @@ public class NetTest extends TestCase {
setDataTest(IProxyData.HTTPS_PROXY_TYPE);
setDataTest(IProxyData.SOCKS_PROXY_TYPE);
- String[] oldHosts = NetCore.getProxyManager().getNonProxiedHosts();
- NetCore.getProxyManager().setNonProxiedHosts(new String[] { "*ignore.com" });
+ String[] oldHosts = this.getProxyManager().getNonProxiedHosts();
+ this.getProxyManager().setNonProxiedHosts(new String[] { "*ignore.com" });
- IProxyData[] allData = NetCore.getProxyManager().getProxyDataForHost("www.randomhot.com");
+ IProxyData[] allData = this.getProxyManager().getProxyDataForHost("www.randomhot.com");
assertEquals(3, allData.length);
- IProxyData data = NetCore.getProxyManager().getProxyDataForHost("www.randomhot.com", IProxyData.HTTP_PROXY_TYPE);
+ IProxyData data = this.getProxyManager().getProxyDataForHost("www.randomhot.com", IProxyData.HTTP_PROXY_TYPE);
assertNotNull(data);
- allData = NetCore.getProxyManager().getProxyDataForHost("www.ignore.com");
+ allData = this.getProxyManager().getProxyDataForHost("www.ignore.com");
assertEquals(0, allData.length);
- data = NetCore.getProxyManager().getProxyDataForHost("www.ignore.com", IProxyData.HTTP_PROXY_TYPE);
+ data = this.getProxyManager().getProxyDataForHost("www.ignore.com", IProxyData.HTTP_PROXY_TYPE);
assertNull(data);
- allData = NetCore.getProxyManager().getProxyDataForHost("ignore.com");
+ allData = this.getProxyManager().getProxyDataForHost("ignore.com");
assertEquals(0, allData.length);
- data = NetCore.getProxyManager().getProxyDataForHost("ignore.com", IProxyData.HTTP_PROXY_TYPE);
+ data = this.getProxyManager().getProxyDataForHost("ignore.com", IProxyData.HTTP_PROXY_TYPE);
assertNull(data);
- NetCore.getProxyManager().setNonProxiedHosts(oldHosts);
+ this.getProxyManager().setNonProxiedHosts(oldHosts);
}
}

Back to the top