public void actionPerformed(AnActionEvent e) { final DataContext dc = e.getDataContext(); if ((!isVisible(dc)) || (!isEnabled(dc))) return; final Project project = CommonDataKeys.PROJECT.getData(dc); final Iterable<Pair<VirtualFilePointer, FileStatus>> iterable = VcsDataKeys.UPDATE_VIEW_FILES_ITERABLE.getData(dc); final Label before = (Label) VcsDataKeys.LABEL_BEFORE.getData(dc); final Label after = (Label) VcsDataKeys.LABEL_AFTER.getData(dc); final String selectedUrl = VcsDataKeys.UPDATE_VIEW_SELECTED_PATH.getData(dc); ShowDiffAction.showDiffForChange( new MyIterableWrapper(iterable.iterator(), before, after), new MySelectionMarker(selectedUrl), project, new ShowDiffUIContext(true)); }
private boolean isVisible(final DataContext dc) { final Project project = CommonDataKeys.PROJECT.getData(dc); return (project != null) && (VcsDataKeys.LABEL_BEFORE.getData(dc) != null) && (VcsDataKeys.LABEL_AFTER.getData(dc) != null); }