1 /******************************************************************************* 2 * Copyright (c) 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.core.commands.operations; 12 13 /** 14 * <p> 15 * An undo context is used to "tag" operations as being applicable to a certain 16 * context. The undo context is used to filter the history of operations 17 * available for undo or redo so that only operations appropriate for a given 18 * undo context are shown when the application is presenting that context. 19 * </p> 20 * <p> 21 * The scope of an undo context is defined by the application that is making 22 * undo and redo of operations available. Undo contexts may be related to 23 * application models, or may be associated with UI objects that are providing 24 * undo and redo support. 25 * </p> 26 * <p> 27 * An undo context may be defined as "matching" another context. This allows 28 * applications to provide specialized implementations of an undo context that 29 * will appear in the operation history for their matching context. 30 * 31 * @since 3.1 32 */ 33 34 public interface IUndoContext { 35 36 /** 37 * Get the label that describes the undo context. 38 * 39 * @return the label for the context. 40 */ 41 public String getLabel(); 42 43 /** 44 * Return whether the specified context is considered a match for the 45 * receiving context. When a context matches another context, operations 46 * that have the context are considered to also have the matching context. 47 * 48 * @param context 49 * the context to be checked against the receiving context. 50 * 51 * @return <code>true</code> if the receiving context can be considered a 52 * match for the specified context, and <code>false</code> if it 53 * cannot. 54 */ 55 public boolean matches(IUndoContext context); 56 57 } 58