blob: 5820520aaf3e6a2b8a1384224ed12f437e406d90 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2003, 2006 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
* Julian Chen - fix for bug #92572, jclRM
*******************************************************************************/
package org.eclipse.core.internal.runtime;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.app.CommandLineArgs;
import org.osgi.framework.*;
/**
* Activator for the Eclipse runtime.
*/
public class PlatformActivator extends Plugin implements BundleActivator {
private static BundleContext context;
private ServiceRegistration entryLocatorRegistration;
public static BundleContext getContext() {
return context;
}
public void start(BundleContext runtimeContext) throws Exception {
PlatformActivator.context = runtimeContext;
InternalPlatform.getDefault().start(runtimeContext);
startAppContainer();
InternalPlatform.getDefault().setRuntimeInstance(this);
super.start(runtimeContext);
}
public void stop(BundleContext runtimeContext) {
// unregister the EntryLocator to prevent the Framework from calling it
unregisterEntryLocator();
// Stop the platform orderly.
InternalPlatform.getDefault().stop(runtimeContext);
InternalPlatform.getDefault().setRuntimeInstance(null);
}
private void startAppContainer() {
// just using a class out of app admin to force it to lazy-start
CommandLineArgs.getApplicationArgs();
}
private void unregisterEntryLocator() {
if (entryLocatorRegistration != null) {
entryLocatorRegistration.unregister();
entryLocatorRegistration = null;
}
}
}