void (@NotNull AnActionEvent e) { Project project = e.getProject(); Editor editor = e.getData(CommonDataKeys.EDITOR); Integer selectedOffset = e.getData(SELECTED_OFFSET_KEY); if (project == null || editor == null) { e.getPresentation().setEnabledAndVisible(false); return; } LineStatusTracker<?> tracker = LineStatusTrackerManager.getInstance(project).getLineStatusTracker(editor.getDocument()); if (tracker == null || !tracker.isValid() || !tracker.isAvailableAt(editor) || !isEnabled(tracker, editor)) { e.getPresentation().setEnabledAndVisible(false); return; } boolean isEnabled; if (selectedOffset != null) { int line = editor.getDocument().getLineNumber(selectedOffset); isEnabled = tracker.getRangeForLine(line) != null; } else { isEnabled = isSomeChangeSelected(editor, tracker); } e.getPresentation().setVisible(true); e.getPresentation().setEnabled(isEnabled); }