void (@NotNull AnActionEvent e) { e.getPresentation().setText(VcsBundle.messagePointer("action.name.compare")); e.getPresentation().setDescription(VcsBundle.messagePointer("action.description.compare")); VcsFileRevision[] revisions = e.getData(VcsDataKeys.VCS_FILE_REVISIONS); VcsHistorySession historySession = e.getData(VcsDataKeys.HISTORY_SESSION); FilePath filePath = e.getData(VcsDataKeys.FILE_PATH); VcsHistoryProvider provider = e.getData(VcsDataKeys.HISTORY_PROVIDER); boolean isEnabled; if (revisions == null || historySession == null || filePath == null || provider == null) { isEnabled = false; } else if (revisions.length == 1) { isEnabled = historySession.isContentAvailable(revisions[0]) && e.getData(FileHistoryPanelImpl.PREVIOUS_REVISION_FOR_DIFF) != null; } else if (revisions.length == 2) { isEnabled = historySession.isContentAvailable(revisions[0]) && historySession.isContentAvailable(revisions[revisions.length - 1]); } else { isEnabled = false; } e.getPresentation().setEnabled(isEnabled); }