comparison org.eclipse.core.commands/src/org/eclipse/core/commands/operations/IAdvancedUndoableOperation2.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) 2006 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.IAdvancedUndoableOperation2;
14
15 import org.eclipse.core.commands.ExecutionException;
16 import org.eclipse.core.runtime.IProgressMonitor;
17 import org.eclipse.core.runtime.IStatus;
18
19 import java.lang.all;
20
21 /**
22 * <p>
23 * IAdvancedUndoableOperation2 defines a method for computing the validity of
24 * executing an operation before attempting to execute it. It also defines a way
25 * for clients to specify that computing status should be done quietly, without
26 * consulting the user. This interface is useful when implementing
27 * {@link IOperationApprover2}, or any other object that performs validation of
28 * the undo history. It also allows operations to specify whether they should be
29 * run in the UI thread.
30 * </p>
31 *
32 * @since 3.3
33 *
34 */
35 public interface IAdvancedUndoableOperation2 {
36 /**
37 * Return a status indicating the projected outcome of executing the
38 * receiver.
39 *
40 * This method should be used to report the possible outcome of executing an
41 * operation when computing the validity of an execute is too expensive to
42 * perform in {@link IUndoableOperation#canExecute()}. It is not called by
43 * the operation history, but instead is used by clients (such as
44 * implementers of {@link IOperationApprover2}) who wish to perform
45 * advanced validation of an operation before attempting to execute it.
46 *
47 * If the result of this method is the discovery that an operation can in
48 * fact not be executed, then the operation is expected to correctly answer
49 * <code>false</code> on subsequent calls to
50 * {@link IUndoableOperation#canExecute()}.
51 *
52 * @param monitor
53 * the progress monitor (or <code>null</code>) to use for
54 * reporting progress to the user while computing the validity.
55 *
56 * @return the IStatus indicating the validity of the execute. The status
57 * severity should be set to <code>OK</code> if the execute can
58 * successfully be performed, and <code>ERROR</code> if it cannot.
59 * Any other severity is assumed to represent an ambiguous state.
60 * @throws ExecutionException
61 * if an exception occurs while computing the validity.
62 */
63 IStatus computeExecutionStatus(IProgressMonitor monitor);
64
65 /**
66 * Set a bool that instructs whether the computation of the receiver's
67 * execution, undo, or redo status should quietly compute status without
68 * consulting or prompting the user. The default value is <code>false</code>.
69 * This flag should only be set to <code>true</code> while the execution,
70 * undo, or redo status computations are being performed in the background,
71 * and should be restored to <code>false</code> when complete.
72 * <p>
73 * If the status computation methods typically need to consult the user in
74 * order to determine the severity of a particular situation, the least
75 * severe status that could be chosen by the user should be returned when
76 * this flag is <code>true</code>. This can help to prevent overzealous
77 * disposal of the operation history when an operation is in an ambiguous
78 * state. Typically, the status computation methods are invoked with this
79 * flag set to <code>false</code> just before the actual execution, undo,
80 * or redo occurs, so the user can be consulted for the final outcome.
81 *
82 * @param quiet
83 * <code>true</code> if it is inappropriate to consult or
84 * otherwise prompt the user while computing status, and
85 * <code>false</code> if the user may be prompted.
86 *
87 * @see #computeExecutionStatus(IProgressMonitor)
88 * @see IAdvancedUndoableOperation#computeUndoableStatus(IProgressMonitor)
89 * @see IAdvancedUndoableOperation#computeRedoableStatus(IProgressMonitor)
90 */
91 public void setQuietCompute(bool quiet);
92
93 /**
94 * Return a bool that instructs whether the operation should be executed,
95 * undone, or redone in a background thread.
96 *
97 * @return <code>true</code> if the operation should be run in the
98 * background, <code>false</code> if it should not.
99 */
100 public bool runInBackground();
101 }