void (@NotNull DataContext dataContext, final boolean invokedByShortcut) { final Project project = CommonDataKeys.PROJECT.getData(dataContext); final PsiFile file = CommonDataKeys.PSI_FILE.getData(dataContext); if (project == null) return; PsiDocumentManager.getInstance(project).commitAllDocuments(); final Editor editor = PsiImplementationViewSession.getEditor(dataContext); Pair<PsiElement, PsiReference> pair = PsiImplementationViewSession.getElementAndReference(dataContext, project, file, editor); PsiElement element = pair != null ? pair.first : null; if (element == null) return; final PsiElement[] superElements = findSuperElements(element); if (superElements.length == 0) return; final boolean isMethod = superElements[0] instanceof PsiMethod; NavigatablePsiElement[] navigatablePsiElements = ContainerUtil.findAllAsArray(superElements, NavigatablePsiElement.class); final String title = isMethod ? CodeInsightBundle.message("show.siblings.choose.super.method.title") : JavaBundle.message("show.siblings.choose.super.class.title"); final String findUsagesTitle = isMethod ? JavaBundle.message("show.siblings.find.usages.method.title") : JavaBundle.message("show.siblings.find.usages.class.title"); final ListCellRenderer listRenderer = isMethod ? new MethodCellRenderer(false) : new PsiClassListCellRenderer(); final JBPopup popup = PsiElementListNavigator .navigateOrCreatePopup(navigatablePsiElements, title, findUsagesTitle, listRenderer, null, objects -> showSiblings(invokedByShortcut, project, editor, file, editor != null, objects[0])); if (popup != null) { if (editor != null) { popup.showInBestPositionFor(editor); } else { popup.showCenteredInCurrentWindow(project); } } }