Skip to content

Commit a752103

Browse files
committed
Add active launch indicator to launch history menu
Adds a visual indicator to launch configurations that are currently active in the launch history menu.
1 parent b1b8226 commit a752103

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

debug/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AbstractLaunchHistoryAction.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.eclipse.core.resources.IResource;
2424
import org.eclipse.core.runtime.CoreException;
2525
import org.eclipse.debug.core.DebugPlugin;
26+
import org.eclipse.debug.core.ILaunch;
2627
import org.eclipse.debug.core.ILaunchConfiguration;
2728
import org.eclipse.debug.core.ILaunchConfigurationType;
2829
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
@@ -347,8 +348,12 @@ protected void fillMenu(Menu menu) {
347348

348349
// Add favorites
349350
int accelerator = 1;
351+
ILaunch[] launches = DebugPlugin.getDefault().getLaunchManager().getLaunches();
350352
for (ILaunchConfiguration launch : favoriteList) {
351353
LaunchAction action= new LaunchAction(launch, getMode());
354+
if (launches.length > 0 && checkIfLaunched(launch, launches)) {
355+
action.setText(action.getText() + " \u2699"); //$NON-NLS-1$
356+
}
352357
addToMenu(menu, action, accelerator);
353358
accelerator++;
354359
}
@@ -361,6 +366,9 @@ protected void fillMenu(Menu menu) {
361366
// Add history launches next
362367
for (ILaunchConfiguration launch : historyList) {
363368
LaunchAction action= new LaunchAction(launch, getMode());
369+
if (launches.length > 0 && checkIfLaunched(launch, launches)) {
370+
action.setText(action.getText() + " \u2699"); //$NON-NLS-1$
371+
}
364372
addToMenu(menu, action, accelerator);
365373
accelerator++;
366374
}
@@ -373,6 +381,22 @@ protected void fillMenu(Menu menu) {
373381
}
374382
}
375383

384+
/**
385+
* Returns whether the given launch configuration has been launched.
386+
*
387+
* @param launchConfiguration the launch configuration
388+
* @param launches the current active launches
389+
* @return {@code true} if a matching launch exists, {@code false} otherwise
390+
*/
391+
private boolean checkIfLaunched(ILaunchConfiguration launchConfiguration, ILaunch[] launches) {
392+
for (ILaunch launch : launches) {
393+
if (launch.getLaunchConfiguration().equals(launchConfiguration) && !launch.isTerminated()) {
394+
return true;
395+
}
396+
}
397+
return false;
398+
}
399+
376400
/**
377401
* Adds a separator to the given menu
378402
*

0 commit comments

Comments
 (0)