2323import org .eclipse .core .resources .IResource ;
2424import org .eclipse .core .runtime .CoreException ;
2525import org .eclipse .debug .core .DebugPlugin ;
26+ import org .eclipse .debug .core .ILaunch ;
2627import org .eclipse .debug .core .ILaunchConfiguration ;
2728import org .eclipse .debug .core .ILaunchConfigurationType ;
2829import org .eclipse .debug .core .ILaunchConfigurationWorkingCopy ;
2930import org .eclipse .debug .core .ILaunchManager ;
3031import org .eclipse .debug .internal .core .IInternalDebugCoreConstants ;
32+ import org .eclipse .debug .internal .ui .DebugPluginImages ;
3133import org .eclipse .debug .internal .ui .DebugUIPlugin ;
3234import org .eclipse .debug .internal .ui .ILaunchHistoryChangedListener ;
3335import org .eclipse .debug .internal .ui .ILaunchLabelChangedListener ;
4042import org .eclipse .debug .internal .ui .launchConfigurations .LaunchShortcutExtension ;
4143import org .eclipse .debug .internal .ui .launchConfigurations .LaunchShortcutSelectionDialog ;
4244import org .eclipse .debug .internal .ui .stringsubstitution .SelectedResourceManager ;
45+ import org .eclipse .debug .ui .IDebugUIConstants ;
4346import org .eclipse .debug .ui .ILaunchGroup ;
4447import org .eclipse .debug .ui .ILaunchShortcut ;
4548import org .eclipse .jface .action .Action ;
4649import org .eclipse .jface .action .ActionContributionItem ;
4750import org .eclipse .jface .action .IAction ;
4851import org .eclipse .jface .dialogs .IDialogConstants ;
52+ import org .eclipse .jface .resource .ImageDescriptor ;
53+ import org .eclipse .jface .viewers .DecorationOverlayIcon ;
54+ import org .eclipse .jface .viewers .IDecoration ;
4955import org .eclipse .jface .viewers .ISelection ;
5056import org .eclipse .jface .viewers .IStructuredSelection ;
5157import org .eclipse .jface .viewers .StructuredSelection ;
5258import org .eclipse .swt .SWT ;
5359import org .eclipse .swt .events .MenuAdapter ;
5460import org .eclipse .swt .events .MenuEvent ;
61+ import org .eclipse .swt .graphics .Image ;
5562import org .eclipse .swt .widgets .Control ;
5663import org .eclipse .swt .widgets .Display ;
5764import org .eclipse .swt .widgets .Event ;
@@ -347,8 +354,28 @@ protected void fillMenu(Menu menu) {
347354
348355 // Add favorites
349356 int accelerator = 1 ;
357+ ILaunch [] launches = DebugPlugin .getDefault ().getLaunchManager ().getLaunches ();
350358 for (ILaunchConfiguration launch : favoriteList ) {
351359 LaunchAction action = new LaunchAction (launch , getMode ());
360+ if (checkIfLaunchActive (launch , launches )) {
361+ action .setText (action .getText () + " (Running)" ); //$NON-NLS-1$
362+
363+ ImageDescriptor base = action .getImageDescriptor ();
364+
365+ if (base != null ) {
366+ // Overlay icon (small running indicator)
367+ ImageDescriptor overlay = DebugPluginImages
368+ .getImageDescriptor (IDebugUIConstants .IMG_OBJS_INSTRUCTION_POINTER_TOP );
369+
370+ Image baseImage = base .createImage ();
371+
372+ DecorationOverlayIcon decorated = new DecorationOverlayIcon (baseImage , overlay ,
373+ IDecoration .TOP_LEFT );
374+
375+ action .setImageDescriptor (ImageDescriptor .createFromImage (decorated .createImage ()));
376+ }
377+
378+ }
352379 addToMenu (menu , action , accelerator );
353380 accelerator ++;
354381 }
@@ -361,6 +388,24 @@ protected void fillMenu(Menu menu) {
361388 // Add history launches next
362389 for (ILaunchConfiguration launch : historyList ) {
363390 LaunchAction action = new LaunchAction (launch , getMode ());
391+ if (checkIfLaunchActive (launch , launches )) {
392+ action .setText (action .getText () + " (Running)" ); //$NON-NLS-1$
393+
394+ ImageDescriptor base = action .getImageDescriptor ();
395+
396+ if (base != null ) {
397+ // Overlay icon (small running indicator)
398+ ImageDescriptor overlay = DebugPluginImages
399+ .getImageDescriptor (IDebugUIConstants .IMG_OBJS_INSTRUCTION_POINTER_TOP );
400+
401+ Image baseImage = base .createImage ();
402+
403+ DecorationOverlayIcon decorated = new DecorationOverlayIcon (baseImage , overlay ,
404+ IDecoration .TOP_LEFT );
405+
406+ action .setImageDescriptor (ImageDescriptor .createFromImage (decorated .createImage ()));
407+ }
408+ }
364409 addToMenu (menu , action , accelerator );
365410 accelerator ++;
366411 }
@@ -373,6 +418,24 @@ protected void fillMenu(Menu menu) {
373418 }
374419 }
375420
421+ /**
422+ * Returns whether the given launch configuration has been launched and active
423+ * now.
424+ *
425+ * @param launchConfiguration the launch configuration
426+ * @param launches the current active launches
427+ * @return {@code true} if a matching launch exists, {@code false} otherwise
428+ */
429+ private boolean checkIfLaunchActive (ILaunchConfiguration launchConfiguration , ILaunch [] launches ) {
430+ for (ILaunch launch : launches ) {
431+ ILaunchConfiguration activeLaunch = launch .getLaunchConfiguration ();
432+ if (activeLaunch != null && activeLaunch .equals (launchConfiguration ) && !launch .isTerminated ()) {
433+ return true ;
434+ }
435+ }
436+ return false ;
437+ }
438+
376439 /**
377440 * Adds a separator to the given menu
378441 *
0 commit comments