comparison dwtx/core/commands/operations/IAdvancedUndoableOperation.d @ 3:6518c18a01f7

eclipse.core package without osgi dependencies
author Frank Benoit <benoit@tionex.de>
date Wed, 26 Mar 2008 00:57:19 +0100
parents
children
comparison
equal deleted inserted replaced
2:a012107a911c 3:6518c18a01f7
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 * Port to the D programming language:
11 * Frank Benoit <benoit@tionex.de>
12 *******************************************************************************/
13 module dwtx.core.commands.operations.IAdvancedUndoableOperation;
14
15 import dwtx.core.commands.ExecutionException;
16 import dwtx.core.runtime.IProgressMonitor;
17 import dwtx.core.runtime.IStatus;
18
19 import dwtx.core.commands.operations.OperationHistoryEvent;
20
21 import dwt.dwthelper.utils;
22
23 /**
24 * <p>
25 * IAdvancedUndoableOperation defines an interface for undoable operations that
26 * modify one or more elements in a model and attempt to keep model listeners up
27 * to date with changes that occur in the undo and redo history involving particular
28 * model elements. It also defines methods for computing the validity of an operation
29 * for undo or redo before attempting to perform the undo or redo.
30 * </p>
31 * <p>
32 * This interface is intended to be used by legacy frameworks that are adapting
33 * their original undo and redo support to this framework. The methods in this
34 * interface allow legacy clients to maintain features not supported in the
35 * basic operations framework.
36 * </p>
37 *
38 * @since 3.1
39 *
40 */
41 public interface IAdvancedUndoableOperation {
42
43 /**
44 * <p>
45 * An operation history notification about this operation is about to be
46 * sent to operation history listeners. Any preparation needed before
47 * listeners are notified about this operation should be performed here.
48 *
49 * <p>
50 * This method has been added to support legacy undo frameworks that are
51 * adapting to IUndoableOperation. Operations that previously relied on
52 * notification from their containing history or stack before any listeners
53 * are notified about changes to the operation should implement this
54 * interface.
55 *
56 * @param event
57 * the event that is about to be sent with the pending
58 * notification
59 *
60 */
61 void aboutToNotify(OperationHistoryEvent event);
62
63 /**
64 * <p>
65 * Return an array of objects that are affected by executing, undoing, or
66 * redoing this operation. If it cannot be determined which objects are
67 * affected, return null.
68 * </p>
69 *
70 * @return the array of Objects modified by this operation, or
71 * <code>null</code> if the affected objects cannot be determined.
72 */
73 Object[] getAffectedObjects();
74
75 /**
76 * Return a status indicating the projected outcome of undoing the receiver.
77 *
78 * This method should be used to report the possible outcome of an undo and
79 * is used when computing the validity of an undo is too expensive to
80 * perform in {@link IUndoableOperation#canUndo()}. It is not called by the
81 * operation history, but instead is used by clients (such as implementers
82 * of {@link IOperationApprover}) who wish to perform advanced validation of
83 * an operation before attempting to undo it.
84 *
85 * If the result of this method is the discovery that an operation can in
86 * fact not be undone, then the operation is expected to correctly answer
87 * <code>false</code> on subsequent calls to
88 * {@link IUndoableOperation#canUndo()}.
89 *
90 * @param monitor
91 * the progress monitor (or <code>null</code>) to use for
92 * reporting progress to the user while computing the validity.
93 *
94 * @return the IStatus indicating the validity of the undo. The status
95 * severity should be set to <code>OK</code> if the undo can
96 * successfully be performed, and <code>ERROR</code> if it
97 * cannnot. Any other status is assumed to represent an ambiguous
98 * state.
99 * @throws ExecutionException
100 * if an exception occurs while computing the validity.
101 */
102 IStatus computeUndoableStatus(IProgressMonitor monitor);
103
104 /**
105 * Return a status indicating the projected outcome of redoing the receiver.
106 *
107 * This method should be used to report the possible outcome of a redo and
108 * is used when computing the validity of a redo is too expensive to perform
109 * in {@link IUndoableOperation#canRedo()}. It is not called by the
110 * operation history, but instead is used by clients (such as implementers
111 * of {@link IOperationApprover}) who wish to perform advanced validation of
112 * an operation before attempting to redo it.
113 *
114 * If the result of this method is the discovery that an operation can in
115 * fact not be redone, then the operation is expected to correctly answer
116 * <code>false</code> on subsequent calls to
117 * {@link IUndoableOperation#canRedo()}.
118 *
119 * @param monitor
120 * the progress monitor (or <code>null</code>) to use for
121 * reporting progress to the user while computing the validity.
122 *
123 * @return the IStatus indicating the validity of the redo. The status
124 * severity should be set to <code>OK</code> if the redo can
125 * successfully be performed, and <code>ERROR</code> if it
126 * cannnot. Any other status is assumed to represent an ambiguous
127 * state.
128 * @throws ExecutionException
129 * if an exception occurs while computing the validity.
130 */
131 IStatus computeRedoableStatus(IProgressMonitor monitor);
132
133 }