1 11 package org.eclipse.debug.internal.ui.actions; 12 13 import org.eclipse.debug.core.DebugException; 14 import org.eclipse.debug.core.ILaunch; 15 import org.eclipse.debug.core.model.ITerminate; 16 import org.eclipse.debug.internal.ui.DebugUIPlugin; 17 18 23 public class TerminateAndRelaunchAction extends AbstractListenerActionDelegate { 24 25 protected void doAction(Object element) throws DebugException { 26 final ILaunch launch= RelaunchActionDelegate.getLaunch(element); 27 if (launch == null || !(element instanceof ITerminate)) { 28 return; 30 } 31 32 ((ITerminate)element).terminate(); 33 DebugUIPlugin.getStandardDisplay().asyncExec(new Runnable () { 34 public void run() { 35 RelaunchActionDelegate.relaunch(launch.getLaunchConfiguration(), launch.getLaunchMode()); 37 } 38 }); 39 } 40 41 44 protected boolean isRunInBackground() { 45 return true; 46 } 47 48 51 protected boolean isEnabledFor(Object element) { 52 return element instanceof ITerminate && ((ITerminate)element).canTerminate() && 53 RelaunchActionDelegate.getLaunch(element) != null; 54 } 55 } 56 | Popular Tags |