@Override public void update(AnActionEvent e) { final DataContext dc = e.getDataContext(); final Presentation presentation = e.getPresentation(); // presentation.setVisible(isVisible(dc)); presentation.setEnabled(isVisible(dc) && isEnabled(dc)); }
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); }