Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Prigogin2015-08-05 20:57:09 +0000
committerThomas Watson2015-08-28 18:57:35 +0000
commit8a8f71942a1034d52acef423a973eee8415f576b (patch)
treedb2099a7fb92ac6e0d785b630433b399a4500e13 /bundles
parentd56bdf10278de5bf2c36745ccac842190eeb72c6 (diff)
downloadrt.equinox.bundles-8a8f71942a1034d52acef423a973eee8415f576b.tar.gz
rt.equinox.bundles-8a8f71942a1034d52acef423a973eee8415f576b.tar.xz
rt.equinox.bundles-8a8f71942a1034d52acef423a973eee8415f576b.zip
Bug 474264 - Need an easier to use variant of Job.create method
Added ICoreRunnable interface to be used by Job.create(String name, final ICoreRunnable runnable) method. This interface is structurally identical to IWorkspaceRunnable and is intentionally documented in neutral terms to allow it to be used outside of the Jobs framework. Change-Id: I0fc5c7037124a845f095589738b0d26b8b3c8512 Signed-off-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/ICoreRunnable.java37
1 files changed, 37 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/ICoreRunnable.java b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/ICoreRunnable.java
new file mode 100644
index 000000000..3813ca4e5
--- /dev/null
+++ b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/ICoreRunnable.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Google Inc and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.core.runtime;
+
+/**
+ * A functional interface for a runnable that can be cancelled and can report progress
+ * using the progress monitor passed to the {@link #run(IProgressMonitor)} method.
+ * <p>
+ * Clients may implement this interface.
+ *
+ * @since 3.8
+ */
+public interface ICoreRunnable {
+ /**
+ * Executes this runnable.
+ * <p>
+ * The provided monitor can be used to report progress and respond to
+ * cancellation. If the progress monitor has been canceled, the runnable
+ * should finish its execution at the earliest convenience and throw
+ * a {@link CoreException} with a status of severity {@link IStatus#CANCEL}.
+ * The singleton cancel status {@link Status#CANCEL_STATUS} can be used for
+ * this purpose. The monitor is only valid for the duration of the invocation
+ * of this method.
+ *
+ * @param monitor the monitor to be used for reporting progress and
+ * responding to cancellation. The monitor is never {@code null}.
+ * It is the caller's responsibility to call {@link IProgressMonitor#done()}
+ * after this method returns or throws an exception.
+ * @exception CoreException if this operation fails.
+ */
+ public void run(IProgressMonitor monitor) throws CoreException;
+}

Back to the top