1 11 package org.eclipse.debug.ui.actions; 12 13 14 import org.eclipse.debug.core.ILaunchConfiguration; 15 import org.eclipse.debug.internal.ui.DebugUIPlugin; 16 import org.eclipse.debug.internal.ui.IDebugHelpContextIds; 17 import org.eclipse.debug.ui.DebugUITools; 18 import org.eclipse.jface.action.Action; 19 import org.eclipse.jface.viewers.IStructuredSelection; 20 import org.eclipse.jface.viewers.StructuredSelection; 21 import org.eclipse.swt.SWT; 22 import org.eclipse.swt.widgets.Event; 23 import org.eclipse.ui.PlatformUI; 24 25 33 public class LaunchAction extends Action { 34 35 38 private ILaunchConfiguration fConfiguration; 39 42 private String fMode; 43 44 52 public LaunchAction(ILaunchConfiguration configuration, String mode) { 53 fConfiguration = configuration; 54 fMode = mode; 55 setText(configuration.getName()); 56 setImageDescriptor(DebugUITools.getDefaultImageDescriptor(configuration)); 57 PlatformUI.getWorkbench().getHelpSystem().setHelp( 58 this, 59 IDebugHelpContextIds.RELAUNCH_HISTORY_ACTION); 60 } 61 62 65 public void run() { 66 DebugUITools.launch(fConfiguration, fMode); 67 } 68 69 75 public void runWithEvent(Event event) { 76 if ((event.stateMask & SWT.MOD1) > 0) { 77 IStructuredSelection selection = new StructuredSelection(fConfiguration); 78 String id = DebugUITools.getLaunchGroup(fConfiguration, fMode).getIdentifier(); 79 DebugUITools.openLaunchConfigurationDialogOnGroup(DebugUIPlugin.getShell(), selection, id); 80 } else { 81 run(); 82 } 83 } 84 85 } 86 | Popular Tags |