void (@NotNull AnActionEvent e) { final Presentation presentation = e.getPresentation(); presentation.setEnabledAndVisible(false); if (TestFinderHelper.getFinders().size() == 0) { return; } Project project = e.getProject(); Editor editor = e.getData(CommonDataKeys.EDITOR); if (editor == null || project == null) return; PsiFile psiFile = PsiUtilBase.getPsiFileInEditor(editor, project); if (psiFile == null) return; PsiElement element = GotoTestOrCodeHandler.getSelectedElement(editor, psiFile); if (TestFinderHelper.findSourceElement(element) == null) return; presentation.setEnabledAndVisible(true); boolean useShortName = ActionPlaces.MAIN_MENU.equals(e.getPlace()) || ActionPlaces.isPopupPlace(e.getPlace()); if (TestFinderHelper.isTest(element)) { presentation.setText(useShortName ? ActionsBundle.messagePointer("action.GotoTestSubject.MainMenu.text") : ActionsBundle.messagePointer("action.GotoTestSubject.text")); presentation.setDescription(ActionsBundle.messagePointer("action.GotoTestSubject.description")); } else { presentation.setText(useShortName ? ActionsBundle.messagePointer("action.GotoTest.MainMenu.text") : ActionsBundle.messagePointer("action.GotoTest.text")); presentation.setDescription(ActionsBundle.messagePointer("action.GotoTest.description")); } }