public static boolean canCreateRequest(Change change) { if (ChangesUtil.isTextConflictingChange(change) || change.isTreeConflict() || change.isPhantom()) return false; if (ShowDiffAction.isBinaryChange(change)) return false; final FilePath filePath = ChangesUtil.getFilePath(change); if (filePath.isDirectory()) return false; return true; }
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)); }