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
@@ -0,0 +1,28 @@
/*******************************************************************************
* 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:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.debug.core.commands;

/**
* A resume others handler typically resumes all suspended threads associated
* with the same debug target, excluding the selected thread.
* <p>
* Clients may implement this interface. The debug platform provides a "Resume
* Others" action that delegates to this handler interface.
* </p>
*
* @since 3.23
*/
public interface IResumeOthersHandler extends IDebugCommandHandler {

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.eclipse.debug.core.commands.IDisconnectHandler;
import org.eclipse.debug.core.commands.IDropToFrameHandler;
import org.eclipse.debug.core.commands.IResumeHandler;
import org.eclipse.debug.core.commands.IResumeOthersHandler;
import org.eclipse.debug.core.commands.IStepFiltersHandler;
import org.eclipse.debug.core.commands.IStepIntoHandler;
import org.eclipse.debug.core.commands.IStepOverHandler;
Expand All @@ -31,6 +32,7 @@
import org.eclipse.debug.core.model.IStep;
import org.eclipse.debug.core.model.ISuspendResume;
import org.eclipse.debug.core.model.ITerminate;
import org.eclipse.debug.core.model.IThread;

/**
* Adapter factory for debug commands.
Expand All @@ -48,6 +50,7 @@ public class CommandAdapterFactory implements IAdapterFactory {
private static IDisconnectHandler fgDisconnectCommand = new DisconnectCommand();
private static ISuspendHandler fgSuspendCommand = new SuspendCommand();
private static IResumeHandler fgResumeCommand = new ResumeCommand();
private static IResumeOthersHandler fgResumeOthersCommand = new ResumeOthersCommand();
private static IStepFiltersHandler fgStepFiltersCommand = new StepFiltersCommand();
Comment thread
SougandhS marked this conversation as resolved.

@SuppressWarnings("unchecked")
Expand Down Expand Up @@ -91,6 +94,11 @@ public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
return (T) fgResumeCommand;
}
}
if (IResumeOthersHandler.class.equals(adapterType)) {
if (adaptableObject instanceof ISuspendResume && adaptableObject instanceof IThread) {
return (T) fgResumeOthersCommand;
}
}
Comment thread
SougandhS marked this conversation as resolved.
if (IDisconnectHandler.class.equals(adapterType)) {
if (adaptableObject instanceof IDisconnect) {
return (T) fgDisconnectCommand;
Expand All @@ -113,6 +121,7 @@ public Class<?>[] getAdapterList() {
IStepReturnHandler.class,
ISuspendHandler.class,
IResumeHandler.class,
IResumeOthersHandler.class,
IDropToFrameHandler.class,
IDisconnectHandler.class,
IStepFiltersHandler.class};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*******************************************************************************
* 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:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.debug.internal.core.commands;

import java.util.Arrays;
import java.util.Set;
import java.util.stream.Collectors;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.debug.core.IRequest;
import org.eclipse.debug.core.commands.IDebugCommandRequest;
import org.eclipse.debug.core.commands.IResumeOthersHandler;
import org.eclipse.debug.core.model.IDebugTarget;
import org.eclipse.debug.core.model.IThread;

/**
* Default resume others command for the standard debug model.
*
* @since 3.3
*/
public class ResumeOthersCommand extends SuspendCommand implements IResumeOthersHandler {

@Override
protected void execute(Object target) throws CoreException {
IThread currentThread = (IThread) target;
if (currentThread.canResume()) {
currentThread.resume();
}
}
@Override
protected void doExecute(Object[] targets, IProgressMonitor monitor, IRequest request) throws CoreException {

Set<IThread> selectedThreads = Arrays.stream(targets).map(IThread.class::cast).collect(Collectors.toSet());

IDebugTarget debugTarget = ((IThread) targets[0]).getDebugTarget();

for (IThread thread : debugTarget.getThreads()) {
if (!selectedThreads.contains(thread)) {
execute(thread);
monitor.worked(1);
}
}
}

@Override
protected boolean isExecutable(Object target) {
return ((IThread) target).canResume();
}
Comment thread
SougandhS marked this conversation as resolved.

@Override
protected Object getEnabledStateJobFamily(IDebugCommandRequest request) {
return IResumeOthersHandler.class;
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2009, 2023 IBM Corporation and others.
* Copyright (c) 2009, 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 @@ -48,6 +48,7 @@
import org.eclipse.debug.tests.statushandlers.StatusHandlerTests;
import org.eclipse.debug.tests.stepfilters.StepFiltersTests;
import org.eclipse.debug.tests.ui.LaunchConfigurationTabGroupViewerTest;
import org.eclipse.debug.tests.ui.ResumeOthersCommandTests;
import org.eclipse.debug.tests.ui.VariableValueEditorManagerTests;
import org.eclipse.debug.tests.view.memory.MemoryRenderingTests;
import org.eclipse.debug.tests.view.memory.TableRenderingTests;
Expand Down Expand Up @@ -142,6 +143,7 @@

// Logical structure
LogicalStructureCacheTest.class, //
ResumeOthersCommandTests.class,
})
public class AutomatedSuite {
}
Loading
Loading