comparison dwtx/jface/operation/IRunnableWithProgress.d @ 6:1a6747be662d

Jface operations
author Frank Benoit <benoit@tionex.de>
date Fri, 28 Mar 2008 19:31:01 +0100
parents
children 89776a9bb8b2
comparison
equal deleted inserted replaced
5:103ab03b77eb 6:1a6747be662d
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.IRunnableWithProgress;
14
15 import dwtx.core.runtime.IProgressMonitor;
16
17 import dwt.dwthelper.utils;
18
19 /**
20 * The <code>IRunnableWithProgress</code> interface should be implemented by any
21 * class whose instances are intended to be executed as a long-running operation.
22 * Long-running operations are typically presented at the UI via a modal dialog
23 * showing a progress indicator and a Cancel button.
24 * The class must define a <code>run</code> method that takes a progress monitor.
25 * The <code>run</code> method is usually not invoked directly, but rather by
26 * passing the <code>IRunnableWithProgress</code> to the <code>run</code> method of
27 * an <code>IRunnableContext</code>, which provides the UI for the progress monitor
28 * and Cancel button.
29 *
30 * @see IRunnableContext
31 */
32 public interface IRunnableWithProgress {
33 /**
34 * Runs this operation. Progress should be reported to the given progress monitor.
35 * This method is usually invoked by an <code>IRunnableContext</code>'s <code>run</code> method,
36 * which supplies the progress monitor.
37 * A request to cancel the operation should be honored and acknowledged
38 * by throwing <code>InterruptedException</code>.
39 *
40 * @param monitor the progress monitor to use to display progress and receive
41 * requests for cancelation
42 * @exception InvocationTargetException if the run method must propagate a checked exception,
43 * it should wrap it inside an <code>InvocationTargetException</code>; runtime exceptions are automatically
44 * wrapped in an <code>InvocationTargetException</code> by the calling context
45 * @exception InterruptedException if the operation detects a request to cancel,
46 * using <code>IProgressMonitor.isCanceled()</code>, it should exit by throwing
47 * <code>InterruptedException</code>
48 *
49 * @see IRunnableContext#run
50 */
51 public void run(IProgressMonitor monitor);
52 }