Fixed bug 78004 - PluginActivator.ensureNormalStartup() is a bogus check
diff --git a/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/compatibility/PluginActivator.java b/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/compatibility/PluginActivator.java index 3ae9a03..896993d 100644 --- a/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/compatibility/PluginActivator.java +++ b/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/compatibility/PluginActivator.java
@@ -11,44 +11,19 @@ package org.eclipse.core.internal.compatibility; import org.eclipse.core.internal.plugins.PluginDescriptor; -import org.eclipse.core.internal.runtime.InternalPlatform; -import org.eclipse.core.runtime.*; -import org.osgi.framework.*; -import org.osgi.service.startlevel.StartLevel; -import org.osgi.util.tracker.ServiceTracker; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Plugin; +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; public class PluginActivator implements BundleActivator { - private BundleContext context; private Plugin plugin; - private static ServiceTracker startLevelTracker = null; - - public static void closeStartLevelTracker() { - if (startLevelTracker == null) - return; - startLevelTracker.close(); - startLevelTracker = null; - } - public static StartLevel getStartLevel(BundleContext context) { - if (startLevelTracker == null) { - startLevelTracker = new ServiceTracker(context, StartLevel.class.getName(), null); - startLevelTracker.open(); - } - return (StartLevel) startLevelTracker.getService(); - } - - public BundleContext getBundleContext() { - return context; - } - public PluginActivator() { super(); } - public void start(BundleContext ctx) throws Exception { - // will bail if it is not time to start - ensureNormalStartup(ctx); - this.context = ctx; + public void start(BundleContext context) throws Exception { PluginDescriptor pd = (PluginDescriptor) Platform.getPluginRegistry().getPluginDescriptor(context.getBundle().getSymbolicName()); plugin = pd.getPlugin(); try { @@ -62,26 +37,9 @@ } } - private void ensureNormalStartup(BundleContext context) throws BundleException { - // TODO look at other ways of doing this to make it faster (getService is not as fast - // as we might like but it is not horrible. Also, we never close the tracker. - StartLevel startLevel = getStartLevel(InternalPlatform.getDefault().getBundleContext()); - if (startLevel == null) - return; - if (startLevel.getStartLevel() <= startLevel.getBundleStartLevel(context.getBundle())) { - IStatus status = new Status(IStatus.WARNING, Platform.PI_RUNTIME, 0, org.eclipse.core.internal.plugins.Policy.bind("activator.applicationNotStarted", context.getBundle().getSymbolicName()), null); //$NON-NLS-1$ - InternalPlatform.getDefault().log(status); - throw new BundleException(status.getMessage()); - } - } - public void stop(BundleContext context) throws Exception { - try { - plugin.shutdown(); - plugin.stop(context); - ((PluginDescriptor) plugin.getDescriptor()).doPluginDeactivation(); - } finally { - this.context = null; - } + plugin.shutdown(); + plugin.stop(context); + ((PluginDescriptor) plugin.getDescriptor()).doPluginDeactivation(); } } \ No newline at end of file
diff --git a/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/CompatibilityActivator.java b/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/CompatibilityActivator.java index df56825..753b968 100644 --- a/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/CompatibilityActivator.java +++ b/bundles/org.eclipse.core.runtime.compatibility/src-runtime/org/eclipse/core/internal/plugins/CompatibilityActivator.java
@@ -10,7 +10,6 @@ *******************************************************************************/ package org.eclipse.core.internal.plugins; -import org.eclipse.core.internal.compatibility.PluginActivator; import org.eclipse.core.internal.runtime.CompatibilityHelper; import org.eclipse.core.internal.runtime.InternalPlatform; import org.eclipse.core.runtime.IPluginDescriptor; @@ -29,7 +28,6 @@ IPluginDescriptor descriptor = CompatibilityHelper.getPluginDescriptor(Platform.PI_RUNTIME); CompatibilityHelper.setPlugin(descriptor, null); ((PluginRegistry) org.eclipse.core.internal.plugins.InternalPlatform.getPluginRegistry()).close(); - PluginActivator.closeStartLevelTracker(); CompatibilityHelper.nullCompatibility(); }