1 /******************************************************************************* 2 * Copyright (c) 2005, 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.ui.contexts; 12 13 /** 14 * A suspend trigger notifies listeners when a launch suspends at a context 15 * where debugging should begin. For example, when a breakpoint is encountered. 16 * <p> 17 * The debug platform retrieves a suspend trigger from each registered launch 18 * and listens to suspend notifications in order to initiate debug sessions - i.e. 19 * switch to the desired perspective, activate the debug view, etc., based on user 20 * preferences. The debug platform asks each registered launch for its suspend 21 * trigger adapter or registers with the launch itself if it implements 22 * <code>ISuspendTrigger</code>. 23 * </p> 24 * <p> 25 * It is important that the same instance of a suspend trigger adapter is 26 * returned each time it is asked for the same object, such that listeners 27 * can be added and removed from the same instance. When a listener is removed 28 * and no more listeners are registered, this trigger can be disposed or replaced 29 * with a new adapter the next time one is requested. 30 * </p> 31 * <p> 32 * Clients may implement this interface. The debug platform provides a suspend trigger 33 * adapter for implementations of <code>ILaunch</code>. The implementation provided by 34 * the platform is based on a standard debug model that fires debug events. Clients 35 * wishing to provide their own implementation must also provide their own implementation 36 * of <code>ILaunch</code> (or subclass of <code>Launch</code>), in order to register 37 * their suspend trigger adapter. 38 * </p> 39 * @see ISuspendTriggerListener 40 * @since 3.3 41 */ 42 public interface ISuspendTrigger { 43 44 /** 45 * Registers the given listener for suspend notifications. 46 * 47 * @param listener suspend listener 48 */ 49 public void addSuspendTriggerListener(ISuspendTriggerListener listener); 50 51 /** 52 * Unregisters the given listener for suspend notifications. 53 * 54 * @param listener suspend listener 55 */ 56 public void removeSuspendTriggerListener(ISuspendTriggerListener listener); 57 58 } 59