| Index: editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/internal/corext/refactoring/util/ExecutionUtils.java
|
| diff --git a/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/internal/corext/refactoring/util/ExecutionUtils.java b/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/internal/corext/refactoring/util/ExecutionUtils.java
|
| index dc77250f7a46669bbbf105f1711c8a64fd452615..f4dd0a83f77cbf02b229760e9c00ff82004823ea 100644
|
| --- a/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/internal/corext/refactoring/util/ExecutionUtils.java
|
| +++ b/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/internal/corext/refactoring/util/ExecutionUtils.java
|
| @@ -18,6 +18,7 @@ import com.google.dart.tools.core.DartCore;
|
| import org.eclipse.core.runtime.CoreException;
|
| import org.eclipse.core.runtime.IStatus;
|
| import org.eclipse.core.runtime.Status;
|
| +import org.eclipse.swt.widgets.Display;
|
|
|
| /**
|
| * Utilities for executing actions, such as {@link RunnableObjectEx}.
|
| @@ -137,6 +138,21 @@ public class ExecutionUtils {
|
| }
|
|
|
| /**
|
| + * Runs given {@link RunnableEx} inside of UI thread, using {@link Display#syncExec(Runnable)}.
|
| + */
|
| + @SuppressWarnings("unchecked")
|
| + public static <T> T runObjectUI(final RunnableObjectEx<T> runnable) {
|
| + final Object[] result = new Object[1];
|
| + runRethrowUI(new RunnableEx() {
|
| + @Override
|
| + public void run() throws Exception {
|
| + result[0] = runObject(runnable);
|
| + }
|
| + });
|
| + return (T) result[0];
|
| + }
|
| +
|
| + /**
|
| * Runs given {@link RunnableEx} and re-throws any exceptions without declaring it.
|
| */
|
| public static void runRethrow(RunnableEx runnable) {
|
| @@ -159,6 +175,18 @@ public class ExecutionUtils {
|
| }
|
|
|
| /**
|
| + * Runs given {@link RunnableEx} inside of UI thread, using {@link Display#syncExec(Runnable)}.
|
| + */
|
| + public static void runRethrowUI(final RunnableEx runnable) {
|
| + Display.getDefault().syncExec(new Runnable() {
|
| + @Override
|
| + public void run() {
|
| + ExecutionUtils.runRethrow(runnable);
|
| + }
|
| + });
|
| + }
|
| +
|
| + /**
|
| * Sleeps given number of milliseconds, ignoring exceptions.
|
| */
|
| public static void sleep(final int millis) {
|
|
|