Bug 544454 - Remove Util class Use Platform#getBundle in PartHelper instead of Util#getBundle. Version bump for 4.11 Change-Id: I7934b2f727ce25a794259d1cb8dadbb08b45d7e2 Signed-off-by: Karsten Thoms <karsten.thoms@itemis.de>
diff --git a/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF index 858cfe4..8fc5685 100644 --- a/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.e4.tools.compat;singleton:=true -Bundle-Version: 4.7.300.qualifier +Bundle-Version: 4.7.400.qualifier Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", org.eclipse.core.runtime;bundle-version="3.6.0",
diff --git a/bundles/org.eclipse.e4.tools.compat/pom.xml b/bundles/org.eclipse.e4.tools.compat/pom.xml index b6f2fa9..2982004 100644 --- a/bundles/org.eclipse.e4.tools.compat/pom.xml +++ b/bundles/org.eclipse.e4.tools.compat/pom.xml
@@ -10,7 +10,7 @@ <groupId>eclipse.platform.ui.tools</groupId> <artifactId>org.eclipse.e4.tools.compat</artifactId> - <version>4.7.300-SNAPSHOT</version> + <version>4.7.400-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project>
diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/PartHelper.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/PartHelper.java index 0cbb440..3f6c071 100644 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/PartHelper.java +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/PartHelper.java
@@ -16,6 +16,7 @@ import java.lang.reflect.Method; import org.eclipse.core.runtime.ListenerList; +import org.eclipse.core.runtime.Platform; import org.eclipse.e4.core.contexts.ContextInjectionFactory; import org.eclipse.e4.core.contexts.IEclipseContext; import org.eclipse.e4.tools.services.IClipboardService; @@ -43,7 +44,7 @@ if (parentContext.get(ORG_ECLIPSE_E4_UI_WORKBENCH_I_PRESENTATION_ENGINE) != null) { // Hack to get the MPart-Context try { - final Class<?> clazz = Util.getBundle("org.eclipse.e4.ui.model.workbench").loadClass( //$NON-NLS-1$ + final Class<?> clazz = Platform.getBundle("org.eclipse.e4.ui.model.workbench").loadClass( //$NON-NLS-1$ "org.eclipse.e4.ui.model.application.ui.basic.MPart"); //$NON-NLS-1$ final Object instance = site.getService(clazz); final Method m = clazz.getMethod("getContext", new Class[0]); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/Util.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/Util.java deleted file mode 100644 index a72f261..0000000 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/Util.java +++ /dev/null
@@ -1,29 +0,0 @@ -package org.eclipse.e4.tools.compat.internal; - -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.FrameworkUtil; -import org.osgi.framework.ServiceReference; -import org.osgi.service.packageadmin.PackageAdmin; - -@SuppressWarnings("deprecation") -public class Util { - public static Bundle getBundle(String bundleName) { - final Bundle bundle = FrameworkUtil.getBundle(Util.class); - final BundleContext ctx = bundle.getBundleContext(); - final ServiceReference<PackageAdmin> ref = bundle.getBundleContext().getServiceReference( - PackageAdmin.class); - final PackageAdmin bundleAdmin = ctx.getService(ref); - final Bundle[] bundles = bundleAdmin.getBundles(bundleName, null); - if (bundles == null) { - return null; - } - // Return the first bundle that is not installed or uninstalled - for (int i = 0; i < bundles.length; i++) { - if ((bundles[i].getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0) { - return bundles[i]; - } - } - return null; - } -}