void (final @NotNull AnActionEvent e) { final Presentation presentation = e.getPresentation(); presentation.setEnabledAndVisible(false); final Project project = e.getProject(); if (project == null) { return; } ErrorTreeElement errorTreeElement = e.getUpdateSession() .compute(this, "getSelectedErrorTreeElement", ActionUpdateThread.EDT, CompilerErrorTreeView.this::getSelectedErrorTreeElement); if (errorTreeElement instanceof NavigatableMessageElement messageElement) { final String[] text = messageElement.getText(); if (text.length > 0) { if (text[0].startsWith("[") && text[0].contains("]")) { final Navigatable navigatable = messageElement.getNavigatable(); if (navigatable instanceof OpenFileDescriptor fileDescriptor) { final VirtualFile virtualFile = fileDescriptor.getFile(); final Module module = ModuleUtilCore.findModuleForFile(virtualFile, project); if (module == null) { return; } final Sdk jdk = ModuleRootManager.getInstance(module).getSdk(); if (jdk == null) { return; } final boolean is_1_5 = JavaSdk.getInstance().isOfVersionOrHigher(jdk, JavaSdkVersion.JDK_1_5); if (!is_1_5) { return; } final PsiFile psiFile = PsiManager.getInstance(project).findFile(virtualFile); if (psiFile == null) { return; } if (LanguageLevelUtil.getEffectiveLanguageLevel(module).compareTo(LanguageLevel.JDK_1_5) < 0) return; final PsiElement context = psiFile.findElementAt(fileDescriptor.getOffset()); if (context == null) { return; } final String id = text[0].substring(1, text[0].indexOf("]")); final SuppressFix suppressInspectionFix = getSuppressAction(id); final boolean available = suppressInspectionFix.isAvailable(project, context); presentation.setEnabledAndVisible(available); if (available) { presentation.setText(suppressInspectionFix.getText()); } } } } } }