Collection<Usage> (String @NotNull ... fileNames) { assertInitialized(); if (fileNames.length > 0) { // don't change configured files if already configured configureByFiles(fileNames); } EdtTestUtil.runInEdtAndWait(() -> myEditorTestFixture.performEditorAction(IdeActions.ACTION_FIND_USAGES)); Disposer.register(getTestRootDisposable(), () -> { UsageViewContentManager usageViewManager = UsageViewContentManager.getInstance(getProject()); Content selectedContent; while ((selectedContent = usageViewManager.getSelectedContent()) != null) { usageViewManager.closeContent(selectedContent); } }); return EdtTestUtil.runInEdtAndGet(() -> { long startMillis = System.currentTimeMillis(); UsageView view; boolean viewWasInitialized = false; while ((view = UsageViewManager.getInstance(getProject()).getSelectedUsageView()) == null || view.isSearchInProgress()) { IdeEventQueue.getInstance().flushQueue(); viewWasInitialized |= view != null; if (!viewWasInitialized && System.currentTimeMillis() - startMillis > TimeUnit.SECONDS.toMillis(10)) { fail("UsageView wasn't shown"); return Collections.emptyList(); } } return view.getUsages(); }); }