6
|
1 /*******************************************************************************
|
|
2 * Copyright (c) 2000, 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 dwtx.jface.operation.IRunnableContext;
|
|
14
|
|
15 import dwtx.jface.operation.IRunnableWithProgress;
|
|
16
|
|
17 import dwt.dwthelper.utils;
|
|
18
|
|
19 /**
|
|
20 * Interface for UI components which can execute a long-running operation
|
|
21 * in the form of an <code>IRunnableWithProgress</code>.
|
|
22 * The context is responsible for displaying a progress indicator and Cancel
|
|
23 * button to the end user while the operation is in progress; the context
|
|
24 * supplies a progress monitor to be used from code running inside the operation.
|
|
25 * Note that an <code>IRunnableContext</code> is not a runnable itself.
|
|
26 * <p>
|
|
27 * For examples of UI components which implement this interface,
|
|
28 * see <code>ApplicationWindow</code>, <code>ProgressMonitorDialog</code>,
|
|
29 * and <code>WizardDialog</code>.
|
|
30 * </p>
|
|
31 *
|
|
32 * @see IRunnableWithProgress
|
|
33 * @see dwtx.jface.window.ApplicationWindow
|
|
34 * @see dwtx.jface.dialogs.ProgressMonitorDialog
|
|
35 * @see dwtx.jface.wizard.WizardDialog
|
|
36 */
|
|
37 public interface IRunnableContext {
|
|
38 /**
|
|
39 * <p>
|
|
40 * Runs the given <code>IRunnableWithProgress</code> in this context.
|
|
41 * For example, if this is a <code>ProgressMonitorDialog</code> then the runnable
|
|
42 * is run using this dialog's progress monitor.
|
|
43 * </p>
|
|
44 * <p>
|
|
45 * If <code>fork</code> is <code>false</code>, the current thread is used
|
|
46 * to run the runnable. Note that if <code>fork</code> is <code>true</code>,
|
|
47 * it is unspecified whether or not this method blocks until the runnable
|
|
48 * has been run. Implementers should document whether the runnable is run
|
|
49 * synchronously (blocking) or asynchronously (non-blocking), or if no
|
|
50 * assumption can be made about the blocking behaviour.
|
|
51 * </p>
|
|
52 *
|
|
53 * @param fork <code>true</code> if the runnable should be run in a separate thread,
|
|
54 * and <code>false</code> to run in the same thread
|
|
55 * @param cancelable <code>true</code> to enable the cancelation, and
|
|
56 * <code>false</code> to make the operation uncancellable
|
|
57 * @param runnable the runnable to run
|
|
58 *
|
|
59 * @exception InvocationTargetException wraps any exception or error which occurs
|
|
60 * while running the runnable
|
|
61 * @exception InterruptedException propagated by the context if the runnable
|
|
62 * acknowledges cancelation by throwing this exception. This should not be thrown
|
|
63 * if cancelable is <code>false</code>.
|
|
64 */
|
|
65 public void run(bool fork, bool cancelable,
|
|
66 IRunnableWithProgress runnable);
|
|
67 }
|