void (@NotNull AnActionEvent e) { final InspectionResultsView view = getInvoker(e); if (view == null) { e.getPresentation().setEnabled(false); return; } e.getPresentation().setEnabledAndVisible(false); Object[] selectedNodes = e.getData(PlatformCoreDataKeys.SELECTED_ITEMS); if (selectedNodes == null) return; final InspectionToolWrapper<?,?> toolWrapper = InspectionTree.findWrapper(selectedNodes); if (toolWrapper == null || toolWrapper != myToolWrapper) { return; } if (!isProblemDescriptorsAcceptable() && InspectionTree.getSelectedRefElements(e).length > 0 || isProblemDescriptorsAcceptable() && view.getTree().getSelectedDescriptors(e).length > 0) { e.getPresentation().setEnabledAndVisible(true); } }