1 /******************************************************************************* 2 * Copyright (c) 2000, 2005 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; 12 13 14 import org.eclipse.core.runtime.CoreException; 15 import org.eclipse.core.runtime.IStatus; 16 17 /** 18 * A status handler registers to handle a specific status - error 19 * or otherwise. Provides a mechanism for separating core (headless) 20 * function from UI interaction. The debug plug-in provides a 21 * status handlers extension point, against which handlers can 22 * register for specific status codes - identified by plug-in 23 * identifier and plug-in specific status code. The interaction between 24 * an object requiring a status handler (source), and the status handler 25 * is defined by the source and handler. 26 * <p> 27 * For example, a launch configuration delegate might encounter a timeout 28 * while launching an application. In this case the delegate could abort 29 * or, via the use of a status handler, prompt the user to continue. This 30 * allows the launcher to be implemented in a plug-in that does not require 31 * UI support, and allows another (UI) plug-in to register a handler. 32 * </p> 33 * <p> 34 * A status handler extension is defined in <code>plugin.xml</code>. 35 * Following is an example definition of a status handler extension. 36 * <pre> 37 * <extension point="org.eclipse.debug.core.statusHandlers"> 38 * <statusHandler 39 * id="com.example.ExampleIdentifier" 40 * class="com.example.ExampleStatusHandler" 41 * plugin="com.example.ExamplePluginId" 42 * code="123"> 43 * </statusHandler> 44 * </extension> 45 * </pre> 46 * The attributes are specified as follows: 47 * <ul> 48 * <li><code>id</code> specifies a unique identifier for this status handler.</li> 49 * <li><code>class</code> specifies the fully qualified name of the Java class 50 * that implements <code>IStatusHandler</code>.</li> 51 * <li><code>plugin</code> plug-in identifier that corresponds to the 52 * plug-in of the status this handler is registered for (i.e. 53 * <code>IStatus.getPlugin()</code>).</li> 54 * <li><code>code</code> specifies the status code this handler 55 * is registered for.</li> 56 * </ul> 57 * </p> 58 * <p> 59 * Clients may implement this interface. 60 * </p> 61 * @see DebugPlugin#getStatusHandler(IStatus) 62 * @since 2.0 63 */ 64 65 public interface IStatusHandler { 66 67 /** 68 * Notifies this status handler that the given status has been 69 * generated by the specified source object and requires resolution. 70 * 71 * @param status the status to handle 72 * @param source the object delegating to this status handler 73 * the given status 74 * @return an object representing the resolution of the status 75 * @exception CoreException if unable to resolve the status 76 */ 77 public Object handleStatus(IStatus status, Object source) throws CoreException; 78 } 79