1 12 package org.eclipse.core.internal.runtime; 13 14 import org.eclipse.core.runtime.*; 15 import org.eclipse.equinox.internal.app.CommandLineArgs; 16 import org.osgi.framework.*; 17 18 21 public class PlatformActivator extends Plugin implements BundleActivator { 22 private static BundleContext context; 23 private ServiceRegistration entryLocatorRegistration; 24 25 public static BundleContext getContext() { 26 return context; 27 } 28 29 public void start(BundleContext runtimeContext) throws Exception { 30 PlatformActivator.context = runtimeContext; 31 InternalPlatform.getDefault().start(runtimeContext); 32 startAppContainer(); 33 InternalPlatform.getDefault().setRuntimeInstance(this); 34 super.start(runtimeContext); 35 } 36 37 public void stop(BundleContext runtimeContext) { 38 unregisterEntryLocator(); 40 InternalPlatform.getDefault().stop(runtimeContext); 42 InternalPlatform.getDefault().setRuntimeInstance(null); 43 } 44 45 private void startAppContainer() { 46 CommandLineArgs.getApplicationArgs(); 48 } 49 50 private void unregisterEntryLocator() { 51 if (entryLocatorRegistration != null) { 52 entryLocatorRegistration.unregister(); 53 entryLocatorRegistration = null; 54 } 55 } 56 } 57 | Popular Tags |