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) 2016, 2017 SSI Schaefer IT Solutions GmbH and others.
* Copyright (c) 2016, 2026 SSI Schaefer IT Solutions GmbH 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,7 +31,7 @@
*/
public class GroupMemberChangeListener implements ILaunchConfigurationListener {

private static final String GROUP_TYPE_ID = "org.eclipse.debug.core.groups.GroupLaunchConfigurationType"; //$NON-NLS-1$
public static final String GROUP_TYPE_ID = "org.eclipse.debug.core.groups.GroupLaunchConfigurationType"; //$NON-NLS-1$

@Override
public void launchConfigurationAdded(ILaunchConfiguration configuration) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2025 IBM Corporation and others.
* Copyright (c) 2000, 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 @@ -89,7 +89,7 @@ public class LaunchConfigurationView extends AbstractDebugView implements ILaunc
private UnlinkPrototypeAction fUnlinkPrototypeAction;
private ResetWithPrototypeValuesAction fResetWithPrototypeValuesAction;
private ImportLaunchConfigurationAction fImportAction;

private QuickGroupLaunch quickGroupLaunchAction;
/**
* Action for providing filtering to the Launch Configuration Dialog
* @since 3.2
Expand Down Expand Up @@ -233,6 +233,10 @@ protected void createActions() {

fResetWithPrototypeValuesAction = new ResetWithPrototypeValuesAction(getViewer(), getLaunchGroup().getMode());
setAction(ResetWithPrototypeValuesAction.ID_RESET_WITH_PROTOTYPE_VALUES_ACTION, fResetWithPrototypeValuesAction);

quickGroupLaunchAction = new QuickGroupLaunch(getViewer(), getLaunchGroup().getMode());
setAction(QuickGroupLaunch.ID_QUICK_GROUP_LAUNCH_ACTION, quickGroupLaunchAction);

}

/**
Expand All @@ -253,6 +257,7 @@ protected void fillContextMenu(IMenuManager menu) {
menu.add(fExportAction);
menu.add(fDuplicateAction);
menu.add(fDeleteAction);
menu.add(quickGroupLaunchAction);
menu.add(new Separator());
menu.add(fLinkPrototypeAction);
menu.add(fUnlinkPrototypeAction);
Expand Down Expand Up @@ -290,6 +295,7 @@ public void dispose() {
fLinkPrototypeAction.dispose();
fUnlinkPrototypeAction.dispose();
fResetWithPrototypeValuesAction.dispose();
quickGroupLaunchAction.dispose();
getLaunchManager().removeLaunchConfigurationListener(this);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2025 IBM Corporation and others.
* Copyright (c) 2000, 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 @@ -863,6 +863,17 @@ protected AbstractLaunchConfigurationAction getNewAction() {
return (AbstractLaunchConfigurationAction)fLaunchConfigurationView.getAction(CreateLaunchConfigurationAction.ID_CREATE_ACTION);
}

/**
* Gets the quick group launch menu action
*
* @return the quick group launch menu action
*
* @since 3.13
*/
protected AbstractLaunchConfigurationAction getQuickGroupLaunchAction() {
return (AbstractLaunchConfigurationAction) fLaunchConfigurationView
.getAction(QuickGroupLaunch.ID_QUICK_GROUP_LAUNCH_ACTION);
}
/**
* Gets the new prototype menu action
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2025 IBM Corporation and others.
* Copyright (c) 2000, 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 @@ -315,4 +315,8 @@ public class LaunchConfigurationsMessages extends NLS {

public static String LaunchConfigurationTabGroupViewer_19;

public static String QuickGroupLaunchActionLabel;

public static String QuickGroupLaunchActionToolTip;

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
###############################################################################
# Copyright (c) 2000, 2025 IBM Corporation and others.
# Copyright (c) 2000, 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 @@ -198,6 +198,8 @@ LinkPrototypeAction_Link_prototype_1=&Link Prototype...
UnlinkPrototypeAction_Unlink_prototype_1=&Unlink Prototype
ResetWithPrototypeValuesAction_Reset_with_prototype_values_1=&Reset with Prototype Values
ImportLaunchConfigurationAction=Import
QuickGroupLaunchActionLabel=Quick Group Launch
QuickGroupLaunchActionToolTip=Create a new launch group with the selected launches

EnvironmentTab_Variable_1=Variable
EnvironmentTab_Value_2=Value
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
/*******************************************************************************
* Copyright (c) 2026 IBM Corporation.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/
package org.eclipse.debug.internal.ui.launchConfigurations;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.internal.core.groups.GroupLaunchConfigurationDelegate;
import org.eclipse.debug.internal.core.groups.GroupLaunchElement;
import org.eclipse.debug.internal.core.groups.GroupLaunchElement.GroupElementPostLaunchAction;
import org.eclipse.debug.internal.core.groups.GroupMemberChangeListener;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.widgets.Display;

/**
* Quickly create a group launch configuration with launch configuration
* selections
*
* @since 3.13
*/
public class QuickGroupLaunch extends AbstractLaunchConfigurationAction {

/**
* Action identifier for IDebugView#getAction(String)
*/
public static final String ID_QUICK_GROUP_LAUNCH_ACTION = DebugUIPlugin.getUniqueIdentifier()
+ ".ID_QUICK_GROUP_LAUNCH_ACTION"; //$NON-NLS-1$

/**
* Constructs an action to apply a prototype to a launch configuration
*
* @param viewer the viewer
* @param mode the mode the action applies to
*/
public QuickGroupLaunch(Viewer viewer, String mode) {
super(LaunchConfigurationsMessages.QuickGroupLaunchActionLabel, viewer, mode);
}

/**
* @see AbstractLaunchConfigurationAction#performAction()
*/
@Override
protected void performAction() {
String mode = getMode();
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();

try {
ILaunchConfigurationType groupType = manager
.getLaunchConfigurationType(GroupMemberChangeListener.GROUP_TYPE_ID);

ILaunchConfigurationWorkingCopy wc = groupType.newInstance(
null,
manager.generateLaunchConfigurationName(
LaunchConfigurationsMessages.CreateLaunchConfigurationAction_New_configuration_2));

List<GroupLaunchElement> input = new ArrayList<>();

IStructuredSelection selection = getStructuredSelection();

for (Object selected : selection) {
if (selected instanceof ILaunchConfiguration launchConfig) {
GroupLaunchElement element = new GroupLaunchElement();
element.index = input.size();
element.enabled = true;
element.name = launchConfig.getName();
element.data = launchConfig;
element.mode = mode;
element.action = GroupElementPostLaunchAction.NONE;
element.adoptIfRunning = false;
element.actionParam = GroupElementPostLaunchAction.NONE;

input.add(element);
}
}

GroupLaunchConfigurationDelegate.storeLaunchElements(wc, input);

ILaunchConfiguration config = wc.doSave();

String launchGroupId = ILaunchManager.DEBUG_MODE.equals(mode) ? IDebugUIConstants.ID_DEBUG_LAUNCH_GROUP
: IDebugUIConstants.ID_RUN_LAUNCH_GROUP;

DebugUITools.openLaunchConfigurationDialogOnGroup(Display.getDefault().getActiveShell(),
new StructuredSelection(config), launchGroupId);

} catch (CoreException e) {
DebugPlugin.log(e);
}
}

/**
* @see org.eclipse.ui.actions.SelectionListenerAction#updateSelection(org.eclipse.jface.viewers.IStructuredSelection)
*/
@Override
protected boolean updateSelection(IStructuredSelection selection) {
return selection.size() > 1;
}

@Override
public ImageDescriptor getImageDescriptor() {
return DebugUITools.getImageDescriptor(IInternalDebugUIConstants.IMG_OBJS_LAUNCH_GROUP);
}

@Override
public String getToolTipText() {
return LaunchConfigurationsMessages.QuickGroupLaunchActionToolTip;
}
}
Loading