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.contextlaunching.ContextRunner; 17 import org.eclipse.debug.internal.ui.contextlaunching.LaunchingResourceManager; 18 import org.eclipse.debug.internal.ui.launchConfigurations.OrganizeFavoritesAction; 19 import org.eclipse.debug.ui.DebugUITools; 20 import org.eclipse.jface.action.IAction; 21 import org.eclipse.jface.viewers.StructuredSelection; 22 import org.eclipse.swt.widgets.Menu; 23 24 32 public class AbstractLaunchToolbarAction extends AbstractLaunchHistoryAction { 33 34 35 42 public AbstractLaunchToolbarAction(String launchGroupIdentifier) { 43 super(launchGroupIdentifier); 44 } 45 46 52 protected void fillMenu(Menu menu) { 53 super.fillMenu(menu); 54 if (menu.getItemCount() > 0) { 56 addSeparator(menu); 57 } 58 addToMenu(menu, new LaunchShortcutsAction(getLaunchGroupIdentifier()), -1); 59 addToMenu(menu, getOpenDialogAction(), -1); 60 addToMenu(menu, new OrganizeFavoritesAction(getLaunchGroupIdentifier()), -1); 61 } 62 63 67 protected IAction getOpenDialogAction() { 68 return new OpenLaunchDialogAction(getLaunchGroupIdentifier()); 69 } 70 71 76 public void run(IAction action) { 77 if(LaunchingResourceManager.isContextLaunchEnabled() && 79 !getLaunchGroupIdentifier().equals("org.eclipse.ui.externaltools.launchGroup")) { ContextRunner.getDefault().launch(DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(getLaunchGroupIdentifier())); 81 } 82 else { 83 ILaunchConfiguration configuration = getLastLaunch(); 84 if (configuration == null) { 85 DebugUITools.openLaunchConfigurationDialogOnGroup(DebugUIPlugin.getShell(), new StructuredSelection(), getLaunchGroupIdentifier()); 86 } else { 87 DebugUITools.launch(configuration, getMode()); 88 } 89 } 90 } 91 } 92 | Popular Tags |