KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > operation > IRunnableContext


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  *******************************************************************************/

11 package org.eclipse.jface.operation;
12
13 import java.lang.reflect.InvocationTargetException JavaDoc;
14
15 /**
16  * Interface for UI components which can execute a long-running operation
17  * in the form of an <code>IRunnableWithProgress</code>.
18  * The context is responsible for displaying a progress indicator and Cancel
19  * button to the end user while the operation is in progress; the context
20  * supplies a progress monitor to be used from code running inside the operation.
21  * Note that an <code>IRunnableContext</code> is not a runnable itself.
22  * <p>
23  * For examples of UI components which implement this interface,
24  * see <code>ApplicationWindow</code>, <code>ProgressMonitorDialog</code>,
25  * and <code>WizardDialog</code>.
26  * </p>
27  *
28  * @see IRunnableWithProgress
29  * @see org.eclipse.jface.window.ApplicationWindow
30  * @see org.eclipse.jface.dialogs.ProgressMonitorDialog
31  * @see org.eclipse.jface.wizard.WizardDialog
32  */

33 public interface IRunnableContext {
34     /**
35      * <p>
36      * Runs the given <code>IRunnableWithProgress</code> in this context.
37      * For example, if this is a <code>ProgressMonitorDialog</code> then the runnable
38      * is run using this dialog's progress monitor.
39      * </p>
40      * <p>
41      * If <code>fork</code> is <code>false</code>, the current thread is used
42      * to run the runnable. Note that if <code>fork</code> is <code>true</code>,
43      * it is unspecified whether or not this method blocks until the runnable
44      * has been run. Implementers should document whether the runnable is run
45      * synchronously (blocking) or asynchronously (non-blocking), or if no
46      * assumption can be made about the blocking behaviour.
47      * </p>
48      *
49      * @param fork <code>true</code> if the runnable should be run in a separate thread,
50      * and <code>false</code> to run in the same thread
51      * @param cancelable <code>true</code> to enable the cancelation, and
52      * <code>false</code> to make the operation uncancellable
53      * @param runnable the runnable to run
54      *
55      * @exception InvocationTargetException wraps any exception or error which occurs
56      * while running the runnable
57      * @exception InterruptedException propagated by the context if the runnable
58      * acknowledges cancelation by throwing this exception. This should not be thrown
59      * if cancelable is <code>false</code>.
60      */

61     public void run(boolean fork, boolean cancelable,
62             IRunnableWithProgress runnable) throws InvocationTargetException JavaDoc,
63             InterruptedException JavaDoc;
64 }
65
Popular Tags