1 /******************************************************************************* 2 * Copyright (c) 2006, 2007 IBM Corporation and others. 3 * All rights reserved. This program and the accompanying materials 4 * are made available under the terms of the Eclipse Public License v1.0 5 * which accompanies this distribution, and is available at 6 * http://www.eclipse.org/legal/epl-v10.html 7 * 8 * Contributors: 9 * IBM Corporation - initial API and implementation 10 *******************************************************************************/ 11 package org.eclipse.debug.core.commands; 12 13 14 15 /** 16 * Handles a command for a debugger. Specific command handlers extend this interface. 17 * <p> 18 * The debug platform provides actions for common debug commands that operate against 19 * these handler interfaces. For example, the platform provides a terminate action that 20 * operates on the active debug context (selected element in the debug view). The action 21 * delegates to the active context's {@link ITerminateHandler} implementation to update 22 * its enabled state and execute the command. Debug model elements may implement supported 23 * command handler interfaces directly or provide them as adapters. The debug platform 24 * provides implementations of handlers for standard debug models. 25 * </p> 26 * <p> 27 * Clients are not intended to implement this interface directly. Clients may 28 * implement specific command handler interfaces that extend this interface. 29 * </p> 30 * @see org.eclipse.core.runtime.IAdaptable 31 * @see IDisconnectHandler 32 * @see IDropToFrameHandler 33 * @see IResumeHandler 34 * @see IStepFiltersHandler 35 * @see IStepIntoHandler 36 * @see IStepOverHandler 37 * @see IStepReturnHandler 38 * @see ISuspendHandler 39 * @see ITerminateHandler 40 * @since 3.3 41 */ 42 public interface IDebugCommandHandler { 43 44 /** 45 * Determines whether this handler can execute on the elements specified 46 * in the given request by reporting enabled state to the request. 47 * <p> 48 * Implementations must be non-blocking and may respond asynchronously to the 49 * given request. Errors can reported by setting an appropriate status 50 * on the given request. A request can be canceled by this handler or caller. 51 * A <code>null</code> status is equivalent to an OK status. 52 * When a request succeeds, fails, or is canceled, implementations must call 53 * <code>done()</code> on the given request. 54 * </p> 55 * <p> 56 * Clients are expected to poll the request (using <code>isCanceled</code>) 57 * periodically and abort at their earliest convenience calling <code>done()</code> 58 * on the request. 59 * </p> 60 * @param request specifies elements to operate on and collects enabled state 61 */ 62 public void canExecute(IEnabledStateRequest request); 63 64 /** 65 * Executes this command on the elements specified in the given request 66 * reporting status to the given request and returns whether this handler should 67 * remain enabled while the command is executing. 68 * <p> 69 * Implementations must be non-blocking and may respond asynchronously to the 70 * given request. Errors can reported by setting an appropriate status 71 * on the given request. A request can be canceled by this handler or the caller. 72 * A <code>null</code> status is equivalent to an OK status. When a request is 73 * complete, has encountered an error, or cancelled, implementations must call 74 * <code>done()</code> on the given collector. 75 * </p> 76 * <p> 77 * Handlers are expected to poll the request (using <code>isCanceled</code>) 78 * periodically and abort at their earliest convenience calling <code>done()</code> 79 * on the request. 80 * </p> 81 * @param request specifies elements to operate on and collects execution status 82 * @return whether this handler remains enabled while command is executing 83 */ 84 public boolean execute(IDebugCommandRequest request); 85 86 } 87