From 5e839868c2e2099f055ea9dcf40c303e4b71cb2e Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Tue, 29 Jan 2019 10:04:49 +0100 Subject: Bug 543927 - Remove Activator from org.eclipse.equinox.p2.metadata Change-Id: I4b9e5bb4041045ed71c8a4c707a36ecb40709a3d Signed-off-by: Lars Vogel --- .../META-INF/MANIFEST.MF | 1 - .../internal/p2/metadata/MetadataActivator.java | 41 ---------------------- .../internal/p2/metadata/TranslationSupport.java | 5 ++- .../p2/metadata/expression/CoercingComparator.java | 4 +-- 4 files changed, 6 insertions(+), 45 deletions(-) delete mode 100644 bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/MetadataActivator.java diff --git a/bundles/org.eclipse.equinox.p2.metadata/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.metadata/META-INF/MANIFEST.MF index 4cf89b8d7..4ac2b1ea3 100644 --- a/bundles/org.eclipse.equinox.p2.metadata/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.metadata/META-INF/MANIFEST.MF @@ -3,7 +3,6 @@ Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.p2.metadata;singleton:=true Bundle-Version: 2.4.300.qualifier -Bundle-Activator: org.eclipse.equinox.internal.p2.metadata.MetadataActivator Bundle-Vendor: %providerName Bundle-Localization: plugin Export-Package: org.eclipse.equinox.internal.p2.metadata; diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/MetadataActivator.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/MetadataActivator.java deleted file mode 100644 index d6763f4ec..000000000 --- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/MetadataActivator.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2017 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.internal.p2.metadata; - -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; - -public class MetadataActivator implements BundleActivator { - public static final String PI_METADATA = "org.eclipse.equinox.p2.metadata"; //$NON-NLS-1$ - - public static MetadataActivator instance; - - private BundleContext context; - - public static BundleContext getContext() { - MetadataActivator activator = instance; - return activator == null ? null : activator.context; - } - - @Override - public void start(BundleContext aContext) throws Exception { - context = aContext; - instance = this; - } - - @Override - public void stop(BundleContext aContext) throws Exception { - instance = null; - } -} diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/TranslationSupport.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/TranslationSupport.java index 5de74e419..32b2ee46d 100644 --- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/TranslationSupport.java +++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/TranslationSupport.java @@ -54,6 +54,9 @@ import org.eclipse.osgi.service.localization.LocaleProvider; public class TranslationSupport { // TODO: these constants should come from API, eg. IInstallableUnit or ??? static final Locale DEFAULT_LOCALE = new Locale("df", "LT"); //$NON-NLS-1$//$NON-NLS-2$ + + public static final String PI_METADATA = "org.eclipse.equinox.p2.metadata"; //$NON-NLS-1$ + private static TranslationSupport instance; static final String NAMESPACE_IU_LOCALIZATION = "org.eclipse.equinox.p2.localization"; //$NON-NLS-1$ @@ -251,7 +254,7 @@ public class TranslationSupport { if (fragmentSource == null) { if (!loggedMissingSource) { loggedMissingSource = true; - LogHelper.log(new Status(IStatus.INFO, MetadataActivator.PI_METADATA, "No translation source unavailable. Default language will be used.")); //$NON-NLS-1$ + LogHelper.log(new Status(IStatus.INFO, PI_METADATA, "No translation source unavailable. Default language will be used.")); //$NON-NLS-1$ } return Collector.emptyCollector(); } diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/expression/CoercingComparator.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/expression/CoercingComparator.java index 19f8dd549..822df547e 100644 --- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/expression/CoercingComparator.java +++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/expression/CoercingComparator.java @@ -18,8 +18,8 @@ import java.lang.reflect.Constructor; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.Comparator; -import org.eclipse.equinox.internal.p2.metadata.MetadataActivator; import org.eclipse.equinox.p2.metadata.Version; +import org.osgi.framework.FrameworkUtil; /** * A comparator that performs coercion if needed before comparison. @@ -69,7 +69,7 @@ public abstract class CoercingComparator { return (Class) v; if (v instanceof String) { try { - return MetadataActivator.getContext().getBundle().loadClass(((String) v).trim()); + return FrameworkUtil.getBundle(CoercingComparator.class).loadClass(((String) v).trim()); } catch (Exception e) { // } -- cgit v1.2.3