Java Code Examples for com.intellij.openapi.util.AsyncResult#done()

The following examples show how to use com.intellij.openapi.util.AsyncResult#done() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LazyUiDisposable.java    From consulo with Apache License 2.0 6 votes vote down vote up
private static AsyncResult<Disposable> findDisposable(Disposable defaultValue, final Key<? extends Disposable> key) {
  if (defaultValue == null) {
    if (ApplicationManager.getApplication() != null) {
      final AsyncResult<Disposable> result = AsyncResult.undefined();
      DataManager.getInstance().getDataContextFromFocus().doWhenDone(context -> {
        Disposable disposable = context.getData(key);
        if (disposable == null) {
          disposable = Disposer.get("ui");
        }
        result.setDone(disposable);
      });
      return result;
    }
    else {
      return null;
    }
  }
  else {
    return AsyncResult.done(defaultValue);
  }
}
 
Example 2
Source File: XValue.java    From consulo with Apache License 2.0 5 votes vote down vote up
/**
 * Asynchronously calculates expression which evaluates to the current value
 */
@Nonnull
public AsyncResult<XExpression> calculateEvaluationExpression() {
  String expression = getEvaluationExpression();
  XExpression res =
          expression != null ? XDebuggerUtil.getInstance().createExpression(expression, null, null, EvaluationMode.EXPRESSION) : null;
  return AsyncResult.done(res);
}
 
Example 3
Source File: AsyncProgramRunner.java    From consulo with Apache License 2.0 5 votes vote down vote up
protected static void startRunProfile(ExecutionEnvironment environment,
                                      RunProfileState state,
                                      ProgramRunner.Callback callback,
                                      @javax.annotation.Nullable RunProfileStarter starter) {

  ThrowableComputable<AsyncResult<RunContentDescriptor>, ExecutionException> func = () -> {
    AsyncResult<RunContentDescriptor> promise = starter == null ? AsyncResult.done(null) : starter.executeAsync(state, environment);
    return promise.doWhenDone(it -> BaseProgramRunner.postProcess(environment, it, callback));
  };

  ExecutionManager.getInstance(environment.getProject()).startRunProfile(runProfileStarter(func), state, environment);
}
 
Example 4
Source File: ToolWindowHeadlessManagerImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public AsyncResult<Void> getReady(@Nonnull Object requestor) {
  return AsyncResult.done(null);
}
 
Example 5
Source File: ToolWindowHeadlessManagerImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public AsyncResult<Void> getReady(@Nonnull Object requestor) {
  return AsyncResult.done(null);
}
 
Example 6
Source File: ToolWindowHeadlessManagerImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public AsyncResult<Void> requestFocus(@Nullable final Content content, final boolean forced) {
  return AsyncResult.done(null);
}
 
Example 7
Source File: AutoScrollToSourceHandler.java    From consulo with Apache License 2.0 4 votes vote down vote up
private AsyncResult<Void> getReady(DataContext context) {
  ToolWindow toolWindow = context.getData(PlatformDataKeys.TOOL_WINDOW);
  return toolWindow != null ? toolWindow.getReady(this) : AsyncResult.done(null);
}
 
Example 8
Source File: XDebugProcess.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
public AsyncResult<Void> stopAsync() {
  stop();
  return AsyncResult.done(null);
}
 
Example 9
Source File: WatchNodeImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
@Nonnull
public AsyncResult<XExpression> calculateEvaluationExpression() {
  return AsyncResult.done(myExpression);
}
 
Example 10
Source File: WebProjectViewImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public AsyncResult<Void> changeViewCB(@Nonnull String viewId, String subId) {
  return AsyncResult.done(null);
}
 
Example 11
Source File: RunProfileStarter.java    From consulo with Apache License 2.0 2 votes vote down vote up
/**
 * You should NOT throw exceptions in this method.
 * Instead return {@link AsyncResult#done(Object)} (Throwable)} or call {@link AsyncResult#rejectWithThrowable(Throwable)} 
 */
public AsyncResult<RunContentDescriptor> executeAsync(@Nonnull RunProfileState state, @Nonnull ExecutionEnvironment environment) throws ExecutionException {
  return AsyncResult.done(execute(state, environment));
}