private Future<?> execute(final Runnable runnable) { final FutureResult<?> result = new FutureResult<Object>(); new Thread(new Runnable() { @Override public void run() { try { runnable.run(); result.set(null); } catch (Throwable e) { result.setException(e); } } },"line split").start(); return result; }
@Nullable private static Transferable getContentsSafe() { final FutureResult<Transferable> result = new FutureResult<Transferable>(); Foundation.executeOnMainThread(new Runnable() { @Override public void run() { Transferable transferable = getClipboardContentNatively(); if (transferable != null) { result.set(transferable); } } }, true, false); try { return result.get(10, TimeUnit.MILLISECONDS); } catch (Exception ignored) { return null; } }
private Future<?> execute(final Runnable runnable) { final FutureResult<?> result = new FutureResult<Object>(); new Thread(new Runnable() { @Override public void run() { try { runnable.run(); result.set(null); } catch (Throwable e) { result.setException(e); } } }).start(); return result; }
@Override public Future<?> startThread(final ProgressIndicator progressIndicator, Runnable runnable) { ProgressManager.getInstance().runProcess(runnable, progressIndicator); FutureResult<Object> result = new FutureResult<Object>(); result.set(true); return result; }
protected Future<Result> schedule(@NotNull RemoteTask task, @NotNull Argument argument) { final FutureResult<Result> future = new FutureResult<Result>(); schedule(task, argument, new MavenRemoteTask.ResultProcessor<Result>() { @Override public void process(Result result) { future.set(result); } }, true); return future; }
@Override public Future<?> startThread(final ProgressIndicator progressIndicator, Runnable runnable) { ProgressManager.getInstance().runProcess(runnable, progressIndicator); FutureResult<Object> result = new FutureResult<>(); result.set(true); return result; }