1 11 package org.eclipse.pde.ui.launcher; 12 13 import org.eclipse.core.runtime.CoreException; 14 import org.eclipse.core.runtime.IProgressMonitor; 15 import org.eclipse.core.runtime.IStatus; 16 import org.eclipse.core.runtime.Status; 17 import org.eclipse.debug.core.ILaunch; 18 import org.eclipse.debug.core.ILaunchConfiguration; 19 import org.eclipse.debug.core.model.LaunchConfigurationDelegate; 20 import org.eclipse.osgi.util.NLS; 21 import org.eclipse.pde.internal.ui.IPDEUIConstants; 22 import org.eclipse.pde.internal.ui.PDEPlugin; 23 import org.eclipse.pde.internal.ui.PDEUIMessages; 24 import org.eclipse.pde.internal.ui.launcher.OSGiFrameworkManager; 25 26 33 public class OSGiLaunchConfigurationDelegate extends LaunchConfigurationDelegate { 34 35 41 public void launch(ILaunchConfiguration configuration, String mode, 42 ILaunch launch, IProgressMonitor monitor) throws CoreException { 43 OSGiFrameworkManager manager = PDEPlugin.getDefault().getOSGiFrameworkManager(); 44 String id = configuration.getAttribute(IPDELauncherConstants.OSGI_FRAMEWORK_ID, 45 manager.getDefaultFramework()); 46 LaunchConfigurationDelegate launcher = manager.getFrameworkLauncher(id); 47 if (launcher != null) { 48 launcher.launch(configuration, mode, launch, monitor); 49 } else { 50 String name = manager.getFrameworkName(id); 51 if (name == null) 52 name = PDEUIMessages.OSGiLaunchConfiguration_selected; 53 String message = NLS.bind(PDEUIMessages.OSGiLaunchConfiguration_cannotFindLaunchConfiguration, name); 54 IStatus status = new Status(IStatus.ERROR, IPDEUIConstants.PLUGIN_ID, IStatus.OK, message , null); 55 throw new CoreException(status); 56 } 57 } 58 59 } 60 | Popular Tags |