Try using Practically Macro Options
Just install it from the eclipse update site
http://puremvcnotificationviewer.googlecode.com/svn/trunk/PracticallyMacroGoogleUpdateSite
After installing and restarting eclipse. Go to
Windows-->Preferences-->Practically Macro options-->Editor Macro Defenitions
Click "New" and select "Editor Macro script (Beanshell)" in Available Commands and click "Add"
Use the following script
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.ui.DebugUITools;
try
{
// Terminate process if it already exists from a previous launch
org.eclipse.debug.core.ILaunch[] allLaunches=DebugPlugin.getDefault().getLaunchManager().getLaunches();
for (ILaunch l : allLaunches)
{
if (l.getLaunchConfiguration().getName().equals("YOUR CONFIG NAME"))
{
console.write("terminating launch: " );
console.writeln(l.getLaunchConfiguration().getName());
l.terminate();
break;
}
}
org.eclipse.debug.core.ILaunchConfiguration[] allConfigurations=DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations();
for (ILaunchConfiguration config : allConfigurations) {
if (config.getName().equals("YOUR CONFIG NAME"))
{
DebugUITools.launch(config, "debug");
break;
}
}
} catch (CoreException e) {
e.printStackTrace();
}
finally{}
Notes:
- Replace the YOUR CONFIG NAME with whatever you want
- DebugUITools.launch can be changed to run or debug
- Specify a macro name in the "Macro info" section
- Assign an id started with 1.. If you want to be able to see this macro in the standard Eclipse key binding dialog
Now Click "ok"
Go to Windows-->Preferences-->General-->Keys
Select your macro's name and assign it to any key you want.
Finally dont forget to restart your eclipse again!
For more help:
http://sourceforge.net/p/practicalmacro/discussion/878739/thread/891ddd13