@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]; }
@Override public void update(final AnActionEvent event) { if (!DefinitionsSearch.INSTANCE.hasAnyExecutors()) { event.getPresentation().setVisible(false); } else { super.update(event); } }
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; }