Java 类com.intellij.util.concurrency.FutureResult 实例源码

项目:intellij-ce-playground    文件:OutputLineSplitterTest.java   
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;
}
项目:intellij-ce-playground    文件:ClipboardSynchronizer.java   
@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;
  }
}
项目:tools-idea    文件:OutputLineSplitterTest.java   
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;
}
项目:consulo    文件:OutputLineSplitterTest.java   
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;
}
项目:intellij-ce-playground    文件:CompletionThreading.java   
@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;
}
项目:intellij-ce-playground    文件:MavenRemoteManager.java   
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;
}
项目:tools-idea    文件:CompletionThreading.java   
@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;
}
项目:consulo    文件:CompletionThreading.java   
@Override
public Future<?> startThread(final ProgressIndicator progressIndicator, Runnable runnable) {
  ProgressManager.getInstance().runProcess(runnable, progressIndicator);

  FutureResult<Object> result = new FutureResult<>();
  result.set(true);
  return result;
}