private void findUsages( @NotNull final UsageInfoToUsageConverter.TargetElementsDescriptor descriptor, @NotNull final FindUsagesHandler handler, final boolean toSkipUsagePanelWhenOneUsage, final boolean toOpenInNewTab, @NotNull final FindUsagesOptions findUsagesOptions) { List<? extends PsiElement> elements = descriptor.getAllElements(); if (elements.isEmpty()) { throw new AssertionError(handler + " " + findUsagesOptions); } final UsageTarget[] targets = convertToUsageTargets(elements); myAnotherManager.searchAndShowUsages( targets, new Factory<UsageSearcher>() { @Override public UsageSearcher create() { return createUsageSearcher(descriptor, handler, findUsagesOptions, null); } }, !toSkipUsagePanelWhenOneUsage, true, createPresentation(elements.get(0), findUsagesOptions, toOpenInNewTab), null); addToHistory(elements, findUsagesOptions); }
@Override public void close() { // todo ? crazyness com.intellij.usages.UsageViewManager.getInstance(myProject).setCurrentSearchCancelled(true); UsageViewManager.getInstance(myProject).closeContent(myContent); }