void (@NotNull SelectionEvent e) { if (!available() || !myEditor.getSelectionModel().hasSelection()) return; PsiElement rootElement = myTreeStructure.getRootPsiElement(); if (rootElement == null) return; SelectionModel selection = myEditor.getSelectionModel(); TextRange textRange = rootElement.getTextRange(); int baseOffset = textRange != null ? textRange.getStartOffset() : 0; int start = selection.getSelectionStart() + baseOffset; int end = selection.getSelectionEnd() + baseOffset - 1; String progressDialogTitle = DevPsiViewerBundle.message("psi.viewer.progress.dialog.get.common.parent"); Callable<PsiElement> finder = () -> findCommonParent(InjectedLanguageUtilBase.findElementAtNoCommit(rootElement.getContainingFile(), start), InjectedLanguageUtilBase.findElementAtNoCommit(rootElement.getContainingFile(), end)); PsiElement element = computeSlowOperationsSafeInBgThread(myProject, progressDialogTitle, finder); if (element != null) { if (myEditor.getContentComponent().hasFocus()) { myBlockTree.selectNodeFromEditor(element); myStubTree.selectNodeFromEditor(element); } selectElement(element); } }