KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > commands > operations > LinearUndoEnforcer


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 import org.eclipse.core.runtime.IAdaptable;
14 import org.eclipse.core.runtime.IStatus;
15 import org.eclipse.core.runtime.Status;
16
17 /**
18  * <p>
19  * An operation approver that enforces a strict linear undo. It does not allow
20  * the undo or redo of any operation that is not the latest available operation
21  * in all of its undo contexts. This class may be instantiated by clients.
22  * </p>
23  *
24  * @since 3.1
25  */

26 public final class LinearUndoEnforcer extends LinearUndoViolationDetector {
27     /**
28      * Create an instance of LinearUndoEnforcer.
29      */

30     public LinearUndoEnforcer() {
31         super();
32     }
33
34     /*
35      * Return whether a linear redo violation is allowable. A linear redo violation
36      * is defined as a request to redo a particular operation even if it is not the most
37      * recently added operation to the redo history.
38      */

39     protected IStatus allowLinearRedoViolation(IUndoableOperation operation,
40             IUndoContext context, IOperationHistory history, IAdaptable uiInfo) {
41         return Status.CANCEL_STATUS;
42     }
43
44     /*
45      * Return whether a linear undo violation is allowable. A linear undo violation
46      * is defined as a request to undo a particular operation even if it is not the most
47      * recently added operation to the undo history.
48      */

49     protected IStatus allowLinearUndoViolation(IUndoableOperation operation,
50             IUndoContext context, IOperationHistory history, IAdaptable uiInfo) {
51         return Status.CANCEL_STATUS;
52     }
53
54 }
55
Popular Tags