Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2012 IBM Corporation and others.
* Copyright (c) 2007, 2026 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -31,6 +31,8 @@ public class ContextMessages extends NLS {
public static String ContextRunner_7;
public static String LaunchingResourceManager_0;
public static String LaunchingResourceManager_1;
public static String OpenDebugConfigButton;
public static String OpenRunConfigButton;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, ContextMessages.class);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
###############################################################################
# Copyright (c) 2007, 2012 IBM Corporation and others.
# Copyright (c) 2007, 2026 IBM Corporation and others.
#
# This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -18,6 +18,8 @@ ContextRunner_13=The resource ''{0}'' is not accessible for launching
ContextRunner_14=As...
ContextRunner_15=...
ContextRunner_1={0} Not Supported
OpenDebugConfigButton=Open Debug Config
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Open ... Config" is not correct wording.

"Open ... Configurations Dialog" is probably what we want.

OpenRunConfigButton=Open Run Config
Comment on lines +21 to +22
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Button labels use abbreviated text (“Open Debug Config”, “Open Run Config”) and omit the standard ellipsis used in Eclipse to indicate a dialog will open. Elsewhere in debug UI the convention is “{0} Configurations...” (see ActionMessages.properties key OpenLaunchDialogAction_1). Consider aligning these labels (and possibly reusing that existing pattern) for consistency and clearer user expectations.

Suggested change
OpenDebugConfigButton=Open Debug Config
OpenRunConfigButton=Open Run Config
OpenDebugConfigButton=Open Debug Configurations...
OpenRunConfigButton=Open Run Configurations...

Copilot uses AI. Check for mistakes.

#The possible values for {0} are the names of the launch configurations in the current workspace
LaunchingResourceManager_0={0} (already running)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2025 IBM Corporation and others.
* Copyright (c) 2007, 2026 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -22,6 +22,7 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.core.ILaunchMode;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
Expand All @@ -38,6 +39,8 @@
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorPart;

/**
Expand Down Expand Up @@ -153,7 +156,12 @@ else if(esize > 1) {
else if(esize < 1) {
if(DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_LAUNCH_LAST_IF_NOT_LAUNCHABLE)) {
if (!launchLast(group, isShift)) {
MessageDialog.openInformation(DebugUIPlugin.getShell(), ContextMessages.ContextRunner_0, ContextMessages.ContextRunner_7);
LaunchFailedDialog launchDialog = new LaunchFailedDialog(DebugUIPlugin.getShell(),
ContextMessages.ContextRunner_0, null, ContextMessages.ContextRunner_7,
MessageDialog.INFORMATION,
new String[] { launchButtonName(mode), IDialogConstants.OK_LABEL },
group.getIdentifier());
launchDialog.open();
Comment on lines +159 to +164
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same LaunchFailedDialog construction block is duplicated in three branches with only the message text changing. Consider extracting a small helper (e.g., openNoRecentLaunchDialog(groupId, mode, message)) to reduce duplication and keep future UI tweaks localized.

Copilot uses AI. Check for mistakes.
}
} else {
if(resource != null) {
Expand All @@ -166,12 +174,21 @@ else if(esize < 1) {
if(!resource.isAccessible()) {
msg = MessageFormat.format(ContextMessages.ContextRunner_13, resource.getName());
}
MessageDialog.openInformation(DebugUIPlugin.getShell(), ContextMessages.ContextRunner_0, msg);
LaunchFailedDialog launchDialog = new LaunchFailedDialog(DebugUIPlugin.getShell(),
ContextMessages.ContextRunner_0, null, msg, MessageDialog.INFORMATION,
new String[] { launchButtonName(mode), IDialogConstants.OK_LABEL },
group.getIdentifier());
launchDialog.open();
}
}
else {
if (!launchLast(group, isShift)) {
MessageDialog.openInformation(DebugUIPlugin.getShell(), ContextMessages.ContextRunner_0, ContextMessages.ContextRunner_7);
LaunchFailedDialog launchDialog = new LaunchFailedDialog(DebugUIPlugin.getShell(),
ContextMessages.ContextRunner_0, null, ContextMessages.ContextRunner_7,
MessageDialog.INFORMATION,
new String[] { launchButtonName(mode), IDialogConstants.OK_LABEL },
group.getIdentifier());
launchDialog.open();
}
}
}
Expand All @@ -188,6 +205,46 @@ else if(csize > 1){
}
}

/**
* Returns the label for the launch configuration button based on the given
* launch mode.
*
* @param launchMode launch mode identifier (e.g., run or debug)
* @return the corresponding button label for opening the launch configuration
* dialog
*/
private String launchButtonName(String launchMode) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, if you have profiler installed, there will be "Profile" dialog, and if you have JaCoCo installed, there will be "Coverage" dialog and so on... BTW, by default there is also "External Tools Configuration" dialog.

if (ILaunchManager.DEBUG_MODE.equals(launchMode)) {
return ContextMessages.OpenDebugConfigButton;
}
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

launchButtonName only distinguishes between debug and “everything else”. This will mislabel the button for other launch modes supported by the platform (e.g., profile), showing the Run text even when opening a profile launch group. Consider deriving the label from the actual ILaunchMode label (via ILaunchManager#getLaunchMode) or using the launch group’s label to build a generic “{mode} Configurations...” button text.

Suggested change
}
}
if (ILaunchManager.RUN_MODE.equals(launchMode)) {
return ContextMessages.OpenRunConfigButton;
}
ILaunchMode mode = DebugPlugin.getDefault().getLaunchManager().getLaunchMode(launchMode);
if (mode != null && mode.getLabel() != null && !mode.getLabel().isEmpty()) {
return MessageFormat.format("{0} Configurations...", mode.getLabel());
}

Copilot uses AI. Check for mistakes.
return ContextMessages.OpenRunConfigButton;
}

/**
* Custom dialog shown when a launch fails with no recent configurations.
* Provides an option to directly open the corresponding launch configuration
* group.
*/
class LaunchFailedDialog extends MessageDialog {

private String launchGroup;

LaunchFailedDialog(Shell parentShell, String dialogTitle, Image dialogTitleImage, String dialogMessage,
int dialogImageType, String[] dialogButtonLabels, String launchGroup) {
super(parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, 1);
this.launchGroup = launchGroup;
}

@Override
protected void buttonPressed(int buttonId) {
super.buttonPressed(buttonId);
if (buttonId == 0) {
DebugUITools.openLaunchConfigurationDialogOnGroup(getShell(), null, launchGroup);
Comment on lines +228 to +242
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LaunchFailedDialog is a non-static inner class with a mutable launchGroup field and package-default visibility. Since it’s only used within ContextRunner, making it private static and storing a final launchGroupIdentifier avoids capturing the outer instance and reduces unintended API surface.

Suggested change
class LaunchFailedDialog extends MessageDialog {
private String launchGroup;
LaunchFailedDialog(Shell parentShell, String dialogTitle, Image dialogTitleImage, String dialogMessage,
int dialogImageType, String[] dialogButtonLabels, String launchGroup) {
super(parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, 1);
this.launchGroup = launchGroup;
}
@Override
protected void buttonPressed(int buttonId) {
super.buttonPressed(buttonId);
if (buttonId == 0) {
DebugUITools.openLaunchConfigurationDialogOnGroup(getShell(), null, launchGroup);
private static class LaunchFailedDialog extends MessageDialog {
private final String launchGroupIdentifier;
LaunchFailedDialog(Shell parentShell, String dialogTitle, Image dialogTitleImage, String dialogMessage,
int dialogImageType, String[] dialogButtonLabels, String launchGroupIdentifier) {
super(parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, 1);
this.launchGroupIdentifier = launchGroupIdentifier;
}
@Override
protected void buttonPressed(int buttonId) {
super.buttonPressed(buttonId);
if (buttonId == 0) {
DebugUITools.openLaunchConfigurationDialogOnGroup(getShell(), null, launchGroupIdentifier);

Copilot uses AI. Check for mistakes.
close();
}
Comment on lines +240 to +244
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

buttonPressed calls super.buttonPressed(buttonId) before handling the custom action. In JFace dialogs this typically sets the return code and closes the dialog, which can dispose the shell; calling DebugUITools.openLaunchConfigurationDialogOnGroup(getShell(), ...) afterwards can then run with a disposed shell (and close() becomes redundant). Handle buttonId == 0 before calling super, or avoid calling super for that branch and explicitly set the return code + close after opening the launch configuration dialog.

Suggested change
super.buttonPressed(buttonId);
if (buttonId == 0) {
DebugUITools.openLaunchConfigurationDialogOnGroup(getShell(), null, launchGroup);
close();
}
if (buttonId == 0) {
DebugUITools.openLaunchConfigurationDialogOnGroup(getShell(), null, launchGroup);
setReturnCode(buttonId);
close();
return;
}
super.buttonPressed(buttonId);

Copilot uses AI. Check for mistakes.
}
}

/**
* Validates the given launch mode and launches.
*
Expand Down
Loading