Promise<TreePath> () { JComponent panel = createCenterPanel(); myTree.addTreeSelectionListener(__ -> { if (myPopup.isVisible()) { PopupUpdateProcessor updateProcessor = myPopup.getUserData(PopupUpdateProcessor.class); if (updateProcessor != null) { AbstractTreeNode node = getSelectedNode(); updateProcessor.updatePopup(node); } } }); myPopup = JBPopupFactory.getInstance().createComponentPopupBuilder(panel, myTree) .setTitle(myTitle) .setResizable(true) .setModalContext(false) .setFocusable(true) .setRequestFocus(true) .setMovable(true) .setBelongsToGlobalPopupStack(true) //.setCancelOnClickOutside(false) //for debug and snapshots .setCancelOnOtherWindowOpen(true) .setCancelKeyEnabled(false) .setDimensionServiceKey(myProject, getDimensionServiceKey(), true) .setCancelCallback(() -> { FileStructurePopupListener listener = myProject.getMessageBus().syncPublisher(FileStructurePopupListener.TOPIC); listener.stateChanged(false); return myCanClose; }) .setAdvertiser(new SpeedSearchAdvertiser().addSpeedSearchAdvertisement()) .createPopup(); Disposer.register(myPopup, this); myTree.getEmptyText().setText(CommonBundle.getLoadingTreeNodeText()); myPopup.showCenteredInCurrentWindow(myProject); ((AbstractPopup)myPopup).setShowHints(true); IdeFocusManager.getInstance(myProject).requestFocus(myTree, true); return rebuildAndSelect(false, myInitialElement, null).onProcessed(path -> UIUtil.invokeLaterIfNeeded(() -> { TreeUtil.ensureSelection(myTree); myProject.getService(FileStructurePopupLoadingStateUpdater.class).installUpdater(this::installUpdater, myProject, myTreeModel); showTime = System.nanoTime(); })); }