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 = e.getRequiredData(VcsDataKeys.UPDATE_VIEW_FILES_ITERABLE); final Label before = (Label) e.getRequiredData(VcsDataKeys.LABEL_BEFORE); final Label after = (Label) e.getRequiredData(VcsDataKeys.LABEL_AFTER); final String selectedUrl = VcsDataKeys.UPDATE_VIEW_SELECTED_PATH.getData(dc); MyDiffRequestChain requestChain = new MyDiffRequestChain(project, iterable, before, after, selectedUrl); DiffManager.getInstance().showDiff(project, requestChain, DiffDialogHints.FRAME); }
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); }