diff --git a/java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationPresentation.java b/java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationPresentation.java index 28f3a2e9dfce..69056e49d799 100644 --- a/java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationPresentation.java +++ b/java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationPresentation.java @@ -23,6 +23,7 @@ import com.intellij.codeInspection.ui.*; import com.intellij.codeInspection.util.RefFilter; import com.intellij.icons.AllIcons; import com.intellij.lang.annotation.HighlightSeverity; +import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.Editor; @@ -211,6 +212,20 @@ public class UnusedDeclarationPresentation extends DefaultInspectionToolPresenta super(InspectionsBundle.message("inspection.dead.code.entry.point.quickfix"), null, KeyStroke.getKeyStroke(KeyEvent.VK_INSERT, 0), toolWrapper); } + @Override + public void update(AnActionEvent e) { + super.update(e); + if (e.getPresentation().isEnabledAndVisible()) { + final RefEntity[] elements = getInvoker(e).getTree().getSelectedElements(); + for (RefEntity element : elements) { + if (!((RefElement) element).isEntry()) { + return; + } + } + e.getPresentation().setEnabled(false); + } + } + @Override protected boolean applyFix(@NotNull RefEntity[] refElements) { final EntryPointsManager entryPointsManager = getEntryPointsManager();