Get rido of activator in o.e.core.tests.net.
Change-Id: Ifade1e925b3401d35318d3dbc221cc1c963691cd
Reviewed-on: https://git.eclipse.org/r/c/platform/eclipse.platform.team/+/179785
Tested-by: Platform Bot <platform-bot@eclipse.org>
Reviewed-by: Alexander Kurtakov <akurtako@redhat.com>
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 dd5644a..86da257 100644
--- a/tests/org.eclipse.core.tests.net/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.core.tests.net/META-INF/MANIFEST.MF
@@ -3,7 +3,6 @@
Bundle-Name: Net Tests Plug-in
Bundle-SymbolicName: org.eclipse.core.tests.net
Bundle-Version: 1.5.0.qualifier
-Bundle-Activator: org.eclipse.core.tests.net.Activator
Bundle-Vendor: Eclipse.org
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)",
diff --git a/tests/org.eclipse.core.tests.net/src/org/eclipse/core/tests/net/Activator.java b/tests/org.eclipse.core.tests.net/src/org/eclipse/core/tests/net/Activator.java
index ec1dfa6..dd34761 100644
--- a/tests/org.eclipse.core.tests.net/src/org/eclipse/core/tests/net/Activator.java
+++ b/tests/org.eclipse.core.tests.net/src/org/eclipse/core/tests/net/Activator.java
@@ -14,52 +14,18 @@
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;
+import org.osgi.framework.*;
/**
* The activator class controls the plug-in life cycle
*/
-public class Activator extends Plugin {
+public class Activator {
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.net.tests";
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- @Override
- 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;
- }
-
- public IProxyService getProxyService() {
- ServiceReference<IProxyService> serviceReference = getBundle().getBundleContext().getServiceReference(IProxyService.class);
+ public static IProxyService getProxyService() {
+ Bundle bundle = FrameworkUtil.getBundle(Activator.class);
+ ServiceReference<IProxyService> serviceReference = bundle.getBundleContext().getServiceReference(IProxyService.class);
if (serviceReference != null)
- return getBundle().getBundleContext().getService(serviceReference);
+ return bundle.getBundleContext().getService(serviceReference);
return null;
}
diff --git a/tests/org.eclipse.core.tests.net/src/org/eclipse/core/tests/net/NetTest.java b/tests/org.eclipse.core.tests.net/src/org/eclipse/core/tests/net/NetTest.java
index 734b4ab..3abeba2 100644
--- a/tests/org.eclipse.core.tests.net/src/org/eclipse/core/tests/net/NetTest.java
+++ b/tests/org.eclipse.core.tests.net/src/org/eclipse/core/tests/net/NetTest.java
@@ -61,7 +61,7 @@
}
private IProxyService getProxyManager() {
- return Activator.getDefault().getProxyService();
+ return Activator.getProxyService();
}
private void assertProxyDataEqual(IProxyData expected) {
diff --git a/tests/org.eclipse.core.tests.net/src/org/eclipse/core/tests/net/SystemProxyTest.java b/tests/org.eclipse.core.tests.net/src/org/eclipse/core/tests/net/SystemProxyTest.java
index e5718e6..3376dd2 100644
--- a/tests/org.eclipse.core.tests.net/src/org/eclipse/core/tests/net/SystemProxyTest.java
+++ b/tests/org.eclipse.core.tests.net/src/org/eclipse/core/tests/net/SystemProxyTest.java
@@ -55,7 +55,7 @@
}
private IProxyService getProxyManager() {
- return Activator.getDefault().getProxyService();
+ return Activator.getProxyService();
}
private boolean isProxiesEnabled() {