comparison org.eclipse.core.commands/src/org/eclipse/core/commands/operations/IOperationApprover2.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.IOperationApprover2;
14
15 import org.eclipse.core.runtime.IAdaptable;
16 import org.eclipse.core.runtime.IStatus;
17
18 import org.eclipse.core.commands.operations.IOperationApprover;
19 import org.eclipse.core.commands.operations.IUndoableOperation;
20 import org.eclipse.core.commands.operations.IOperationHistory;
21
22 import java.lang.all;
23
24 /**
25 * Extends {@link IOperationApprover} to approve the execution of a particular
26 * operation within an operation history. Operations that are candidates for
27 * execution have already been validated against their current state and
28 * according to the rules of the history. Prior to 3.2, an operation approver
29 * was only consulted for undo and redo of an operation, not its initial
30 * execution.
31 * <p>
32 * By the time an IOperationApprover2 is consulted, the execution has already
33 * been requested and it has been determined that the operation is valid.
34 * Approvers should return an <code>IStatus</code> object with severity
35 * <code>OK</code> if the operation should proceed, and any other severity if
36 * it should not. When an operation is not approved, it is expected that the
37 * object not allowing the operation has already consulted the user if necessary
38 * or otherwise provided any necessary information to the user about the fact
39 * that the operation is not approved.
40 * </p>
41 * <p>
42 * Like {@link IOperationApprover}, implementers of this extension must be
43 * prepared to receive the approval messages from a background thread. Any UI
44 * access occurring inside the implementation must be properly synchronized
45 * using the techniques specified by the client's widget library.
46 * </p>
47 *
48 * @since 3.2
49 */
50 public interface IOperationApprover2 : IOperationApprover {
51 /**
52 * Return a status indicating whether the specified operation should be
53 * executed. Any status that does not have severity <code>IStatus.OK</code>
54 * will not be approved. Implementers should not assume that the execution
55 * will be performed when the status is <code>OK</code>, since other
56 * operation approvers may veto the execution.
57 *
58 * @param operation
59 * the operation to be executed
60 * @param history
61 * the history performing the execution of the operation
62 * @param info
63 * the IAdaptable (or <code>null</code>) provided by the
64 * caller in order to supply UI information for prompting the
65 * user if necessary. When this parameter is not
66 * <code>null</code>, it should minimally contain an adapter
67 * for the org.eclipse.swt.widgets.Shell.class. Even if UI
68 * information is provided, the implementation of this method
69 * must be prepared for being called from a background thread.
70 * Any UI access must be properly synchronized using the
71 * techniques specified by the client's widget library.
72 * @return the IStatus describing whether the operation is approved. The
73 * execution will not proceed if the status severity is not
74 * <code>OK</code>, and the caller requesting the execution will
75 * be returned the status that caused the rejection. Any other
76 * status severities will not be interpreted by the history.
77 */
78 IStatus proceedExecuting(IUndoableOperation operation,
79 IOperationHistory history, IAdaptable info);
80 }