comparison org.eclipse.core.commands/src/org/eclipse/core/commands/operations/IOperationApprover.d @ 12:bc29606a740c

Added dwt-addons in original directory structure of eclipse.org
author Frank Benoit <benoit@tionex.de>
date Sat, 14 Mar 2009 18:23:29 +0100
parents
children
comparison
equal deleted inserted replaced
11:43904fec5dca 12:bc29606a740c
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 org.eclipse.core.commands.operations.IOperationApprover;
14
15 import org.eclipse.core.runtime.IAdaptable;
16 import org.eclipse.core.runtime.IStatus;
17
18 import org.eclipse.core.commands.operations.IUndoableOperation;
19 import org.eclipse.core.commands.operations.IOperationHistory;
20
21 import java.lang.all;
22
23 /**
24 * <p>
25 * IOperationApprover defines an interface for approving the undo or redo of a
26 * particular operation within an operation history. Operations that are
27 * candidates for undo or redo have already been validated against their current
28 * state and according to the rules of the history.
29 * </p>
30 * <p>
31 * By the time an IOperationApprover is consulted, the undo has already been
32 * requested. Approvers should return an <code>IStatus</code> object with
33 * severity <code>OK</code> if the operation should proceed, and any other
34 * severity if it should not. When an operation is not approved, it is expected
35 * that the object not allowing the operation has already consulted the user if
36 * necessary or otherwise provided any necessary information to the user about
37 * the fact that the operation is not approved.
38 * </p>
39 * <p>
40 * Operation approvers must be prepared to receive the approval messages from a
41 * background thread. Any UI access occurring inside the implementation must be
42 * properly synchronized using the techniques specified by the client's widget
43 * library.
44 * </p>
45 *
46 * @since 3.1
47 */
48 public interface IOperationApprover {
49
50 /**
51 * Return a status indicating whether the specified operation should be
52 * redone. Any status that does not have severity <code>IStatus.OK</code>
53 * will not be approved. Implementers should not assume that the redo will
54 * be performed when the status is <code>OK</code>, since other operation
55 * approvers may veto the redo.
56 *
57 * @param operation
58 * the operation to be redone
59 * @param history
60 * the history redoing the operation
61 * @param info
62 * the IAdaptable (or <code>null</code>) provided by the
63 * caller in order to supply UI information for prompting the
64 * user if necessary. When this parameter is not
65 * <code>null</code>, it should minimally contain an adapter
66 * for the org.eclipse.swt.widgets.Shell.class. Even if UI
67 * information is provided, the implementation of this method
68 * must be prepared for being called from a background thread.
69 * Any UI access must be properly synchronized using the
70 * techniques specified by the client's widget library.
71 * @return the IStatus describing whether the operation is approved. The
72 * redo will not proceed if the status severity is not
73 * <code>OK</code>, and the caller requesting the redo will be
74 * returned the status that caused the rejection. Any other status
75 * severities will not be interpreted by the history.
76 */
77 IStatus proceedRedoing(IUndoableOperation operation,
78 IOperationHistory history, IAdaptable info);
79
80 /**
81 * Return a status indicating whether the specified operation should be
82 * undone. Any status that does not have severity <code>IStatus.OK</code>
83 * will not be approved. Implementers should not assume that the undo will
84 * be performed when the status is <code>OK</code>, since other operation
85 * approvers can veto the undo.
86 *
87 * @param operation
88 * the operation to be undone
89 * @param history
90 * the history undoing the operation
91 * @param info
92 * the IAdaptable (or <code>null</code>) provided by the
93 * caller in order to supply UI information for prompting the
94 * user if necessary. When this parameter is not
95 * <code>null</code>, it should minimally contain an adapter
96 * for the org.eclipse.swt.widgets.Shell.class. Even if UI
97 * information is provided, the implementation of this method
98 * must be prepared for being called from a background thread.
99 * Any UI access must be properly synchronized using the
100 * techniques specified by the client's widget library.
101 * @return the IStatus describing whether the operation is approved. The
102 * undo will not proceed if the status severity is not
103 * <code>OK</code>, and the caller requesting the undo will be
104 * returned the status that caused the rejection. Any other status
105 * severities will not be interpreted by the history.
106 */
107 IStatus proceedUndoing(IUndoableOperation operation,
108 IOperationHistory history, IAdaptable info);
109
110 }