当前位置: 首页>>代码示例>>Java>>正文


Java AsyncResult.setDone方法代码示例

本文整理汇总了Java中com.intellij.openapi.util.AsyncResult.setDone方法的典型用法代码示例。如果您正苦于以下问题:Java AsyncResult.setDone方法的具体用法?Java AsyncResult.setDone怎么用?Java AsyncResult.setDone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.util.AsyncResult的用法示例。


在下文中一共展示了AsyncResult.setDone方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: finish

import com.intellij.openapi.util.AsyncResult; //导入方法依赖的package包/类
public AsyncResult<SwitchTarget> finish(final boolean fadeAway) {
  myAlarm.cancelAllRequests();

  final AsyncResult<SwitchTarget> result = new AsyncResult<SwitchTarget>();
  final SwitchTarget selection = getSelection();
  if (selection != null) {
    selection.switchTo(true).doWhenDone(new Runnable() {
      public void run() {
        myManager.disposeCurrentSession(fadeAway);
        result.setDone(selection);
      }
    }).notifyWhenRejected(result);
  } else {
    Disposer.dispose(this);
    result.setDone();
  }

  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:SwitchingSession.java

示例2: getHintContainerShowPoint

import com.intellij.openapi.util.AsyncResult; //导入方法依赖的package包/类
AsyncResult<RelativePoint> getHintContainerShowPoint() {
  final AsyncResult<RelativePoint> result = new AsyncResult<RelativePoint>();
  if (myLocationCache == null) {
    if (myHintContainer != null) {
      final Point p = AbstractPopup.getCenterOf(myHintContainer, this);
      p.y -= myHintContainer.getVisibleRect().height / 4;
      myLocationCache = RelativePoint.fromScreen(p);
    } else {
      if (myContextComponent != null) {
        myLocationCache = JBPopupFactory.getInstance().guessBestPopupLocation(DataManager.getInstance().getDataContext(myContextComponent));
      } else {
        DataManager.getInstance().getDataContextFromFocus().doWhenDone(new Consumer<DataContext>() {
          @Override
          public void consume(DataContext dataContext) {
            myContextComponent = PlatformDataKeys.CONTEXT_COMPONENT.getData(dataContext);
            myLocationCache = JBPopupFactory.getInstance().guessBestPopupLocation(DataManager.getInstance().getDataContext(myContextComponent));
          }
        });
      }
    }
  }
  final Component c = myLocationCache.getComponent();
  if (!(c instanceof JComponent && c.isShowing())) {
    //Yes. It happens sometimes.
    // 1. Empty frame. call nav bar, select some package and open it in Project View
    // 2. Call nav bar, then Esc
    // 3. Hide all tool windows (Ctrl+Shift+F12), so we've got empty frame again
    // 4. Call nav bar. NPE. ta da
    final JComponent ideFrame = WindowManager.getInstance().getIdeFrame(getProject()).getComponent();
    final JRootPane rootPane = UIUtil.getRootPane(ideFrame);
    myLocationCache = JBPopupFactory.getInstance().guessBestPopupLocation(rootPane);
  }
  result.setDone(myLocationCache);
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:36,代码来源:NavBarPanel.java

示例3: getHintContainerShowPoint

import com.intellij.openapi.util.AsyncResult; //导入方法依赖的package包/类
AsyncResult<RelativePoint> getHintContainerShowPoint() {
  final AsyncResult<RelativePoint> result = new AsyncResult<RelativePoint>();
  if (myLocationCache == null) {
    if (myHintContainer != null) {
      final Point p = AbstractPopup.getCenterOf(myHintContainer, this);
      p.y -= myHintContainer.getVisibleRect().height / 4;
      myLocationCache = RelativePoint.fromScreen(p);
    } else {
      if (myContextComponent != null) {
        myLocationCache = JBPopupFactory.getInstance().guessBestPopupLocation(DataManager.getInstance().getDataContext(myContextComponent));
      } else {
        DataManager.getInstance().getDataContextFromFocus().doWhenDone(new AsyncResult.Handler<DataContext>() {
          @Override
          public void run(DataContext dataContext) {
            myContextComponent = PlatformDataKeys.CONTEXT_COMPONENT.getData(dataContext);
            myLocationCache = JBPopupFactory.getInstance().guessBestPopupLocation(DataManager.getInstance().getDataContext(myContextComponent));
          }
        });
      }
    }
  }
  final Component c = myLocationCache.getComponent();
  if (!(c instanceof JComponent && c.isShowing())) {
    //Yes. It happens sometimes.
    // 1. Empty frame. call nav bar, select some package and open it in Project View
    // 2. Call nav bar, then Esc
    // 3. Hide all tool windows (Ctrl+Shift+F12), so we've got empty frame again
    // 4. Call nav bar. NPE. ta da
    final JComponent ideFrame = WindowManager.getInstance().getIdeFrame(getProject()).getComponent();
    final JRootPane rootPane = UIUtil.getRootPane(ideFrame);
    myLocationCache = JBPopupFactory.getInstance().guessBestPopupLocation(rootPane);
  }
  result.setDone(myLocationCache);
  return result;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:36,代码来源:NavBarPanel.java

示例4: doOpenProjectAsync

import com.intellij.openapi.util.AsyncResult; //导入方法依赖的package包/类
public void doOpenProjectAsync(@Nonnull AsyncResult<Project> asyncResult,
                               @Nonnull VirtualFile virtualFile,
                               @Nullable Project projectToClose,
                               boolean forceOpenInNewFrame,
                               @Nonnull UIAccess uiAccess) {
  Project project = doOpenProject(virtualFile, projectToClose, forceOpenInNewFrame);
  if (project != null) {
    asyncResult.setDone(project);
  }
  else {
    asyncResult.reject("project not loaded");
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:14,代码来源:ProjectOpenProcessor.java


注:本文中的com.intellij.openapi.util.AsyncResult.setDone方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。