Java 类com.intellij.psi.search.searches.DefinitionsSearch 实例源码

项目:tools-idea    文件:ImplementationSearcher.java   
@Nullable("For the case the search has been cancelled")
protected PsiElement[] searchDefinitions(final PsiElement element) {
  final PsiElement[][] result = new PsiElement[1][];
  if (!ProgressManager.getInstance().runProcessWithProgressSynchronously(new Runnable() {
    @Override
    public void run() {
      try {
        result[0] = DefinitionsSearch.search(element).toArray(PsiElement.EMPTY_ARRAY);
      }
      catch (IndexNotReadyException e) {
        dumbModeNotification(element);
        result[0] = null;
      }
    }
  }, SEARCHING_FOR_IMPLEMENTATIONS, true, element.getProject())) {
    return null;
  }
  return result[0];
}
项目:tools-idea    文件:GotoImplementationAction.java   
@Override
public void update(final AnActionEvent event) {
  if (!DefinitionsSearch.INSTANCE.hasAnyExecutors()) {
    event.getPresentation().setVisible(false);
  }
  else {
    super.update(event);
  }
}
项目:intellij-haxe    文件:HaxeInheritanceDefinitionsSearchExecutor.java   
public static List<HaxeClass> getItemsByQName(final HaxeClass haxeClass) {
  final List<HaxeClass> result = new ArrayList<HaxeClass>();
  DefinitionsSearch.search(haxeClass).forEach(new Processor<PsiElement>() {
    @Override
    public boolean process(PsiElement element) {
      if (element instanceof HaxeClass) {
        result.add((HaxeClass)element);
      }
      return true;
    }
  });
  return result;
}