예제 #1
0
 private void changeOperationForSelection() {
   for (int row : myTable.getSelectedRows()) {
     if (row != -1) {
       final DirDiffElementImpl element = myModel.getElementAt(row);
       if (element != null) {
         element.setNextOperation();
         myModel.fireTableRowsUpdated(row, row);
       }
     }
   }
 }
예제 #2
0
  private int getPrevRow() {
    if (myTable.getSelectedRows().length == 0) return -1;
    int row = myTable.getSelectionModel().getLeadSelectionIndex();

    while (true) {
      if (row <= 0) return -1;
      row--;
      DirDiffElementImpl element = myModel.getElementAt(row);
      if (element == null) return -1;
      if (!element.isSeparator()) break;
    }

    return row;
  }
예제 #3
0
 @Nullable
 private Navigatable[] getNavigatableArray() {
   Project project = myModel.getProject();
   List<DirDiffElementImpl> elements = myModel.getSelectedElements();
   List<Navigatable> navigatables = new ArrayList<>();
   for (DirDiffElementImpl element : elements) {
     DiffElement source = element.getSource();
     DiffElement target = element.getTarget();
     Navigatable navigatable1 = source != null ? source.getNavigatable(project) : null;
     Navigatable navigatable2 = target != null ? target.getNavigatable(project) : null;
     if (navigatable1 != null) navigatables.add(navigatable1);
     if (navigatable2 != null) navigatables.add(navigatable2);
   }
   return ContainerUtil.toArray(navigatables, new Navigatable[navigatables.size()]);
 }
예제 #4
0
 public ElementWrapper(@NotNull DirDiffElementImpl element) {
   sourceElement = element.getSource();
   targetElement = element.getTarget();
 }
예제 #5
0
 private void selectRow(int row, boolean extend) {
   if (row == -1) return;
   DirDiffElementImpl element = myModel.getElementAt(row);
   if (element == null || element.isSeparator()) return;
   myTable.changeSelection(row, (myModel.getColumnCount() - 1) / 2, false, extend);
 }