@Override
 public void actionPerformed(@NotNull AnActionEvent e) {
   PrevNextDifferenceIterable iterable =
       DiffDataKeys.PREV_NEXT_DIFFERENCE_ITERABLE.getData(e.getDataContext());
   if (iterable != null && iterable.canGoPrev()) {
     iterable.goPrev();
   }
 }
Exemplo n.º 2
0
 @Override
 public Object getData(@NonNls String dataId) {
   if (CommonDataKeys.PROJECT.is(dataId)) {
     return myModel.getProject();
   } else if (DIR_DIFF_MODEL.is(dataId)) {
     return myModel;
   } else if (DIR_DIFF_TABLE.is(dataId)) {
     return myTable;
   } else if (DiffDataKeys.NAVIGATABLE_ARRAY.is(dataId)) {
     return getNavigatableArray();
   } else if (DiffDataKeys.PREV_NEXT_DIFFERENCE_ITERABLE.is(dataId)) {
     return myPrevNextDifferenceIterable;
   }
   return null;
 }
    @Override
    public void update(@NotNull AnActionEvent e) {
      if (!ActionPlaces.DIFF_TOOLBAR.equals(e.getPlace())) {
        e.getPresentation().setEnabled(true);
        return;
      }

      PrevNextDifferenceIterable iterable =
          DiffDataKeys.PREV_NEXT_DIFFERENCE_ITERABLE.getData(e.getDataContext());
      if (iterable != null && iterable.canGoPrev()) {
        e.getPresentation().setEnabled(true);
        return;
      }

      e.getPresentation().setEnabled(false);
    }