Examples of PlanElement


Examples of org.eclipse.egit.core.internal.rebase.RebaseInteractivePlan.PlanElement

      IStructuredSelection structured = (IStructuredSelection) selection;

      Object obj = structured.getFirstElement();
      if (!(obj instanceof PlanElement))
        return;
      PlanElement firstSelectedEntry = (PlanElement) obj;
      PlanElement lastSelectedEntry = firstSelectedEntry;

      ElementAction type = firstSelectedEntry.getPlanElementAction();

      boolean singleTypeSelected = true;

      if (!theToolbar.isEnabled()
          && !view.getCurrentPlan().hasRebaseBeenStartedYet())
        theToolbar.setEnabled(true);

      if (structured.size() > 1) {
        // multi selection
        for (Object selectedObj : structured.toList()) {
          if (!(selectedObj instanceof PlanElement))
            continue;
          PlanElement entry = (PlanElement) selectedObj;
          lastSelectedEntry = entry;
          if (type != entry.getPlanElementAction()) {
            singleTypeSelected = false;
          }
        }
      }
View Full Code Here

Examples of org.eclipse.egit.core.internal.rebase.RebaseInteractivePlan.PlanElement

    ISelection selection = planViewer.getSelection();
    if (selection instanceof IStructuredSelection) {
      IStructuredSelection structuredSelection = (IStructuredSelection) selection;
      for (Object selectedRow : structuredSelection.toList()) {
        if (selectedRow instanceof PlanElement) {
          PlanElement planElement = (PlanElement) selectedRow;
          planElement.setPlanElementAction(action);
        }
      }
      actionToolbarProvider.mapActionItemsToSelection(selection);
    }
  }
View Full Code Here

Examples of org.eclipse.egit.core.internal.rebase.RebaseInteractivePlan.PlanElement

    setupListeners();
    createLocalDragandDrop();
    planTreeViewer.addDoubleClickListener(new IDoubleClickListener() {

      public void doubleClick(DoubleClickEvent event) {
        PlanElement element = (PlanElement) ((IStructuredSelection) event
            .getSelection()).getFirstElement();
        if (element == null)
          return;

        RepositoryCommit commit = loadCommit(element.getCommit());
        if (commit != null)
          CommitEditor.openQuiet(commit);

      }
View Full Code Here

Examples of org.eclipse.egit.core.internal.rebase.RebaseInteractivePlan.PlanElement

    rebasePlanSection.setTextClient(actionToolBarProvider.getTheToolbar());
  }

  private static RebaseInteractivePlan.ElementType getType(Object element) {
    if (element instanceof PlanElement) {
      PlanElement planLine = (PlanElement) element;
      return planLine.getElementType();
    } else
      return null;
  }
View Full Code Here

Examples of org.eclipse.egit.core.internal.rebase.RebaseInteractivePlan.PlanElement

    TreeViewerColumn stepColumn = createColumn(headings[1], 55);
    stepColumn.setLabelProvider(new HighlightingColumnLabelProvider() {
      @Override
      public String getText(Object element) {
        if (element instanceof PlanElement) {
          PlanElement planLine = (PlanElement) element;
          return (planIndexer.indexOf(planLine) + 1) + "."; //$NON-NLS-1$
        }
        return super.getText(element);
      }
    });
    stepColumn.getColumn().addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        Tree tree = planTreeViewer.getTree();

        boolean orderReversed = tree.getSortDirection() == SWT.DOWN;

        RebaseInteractivePreferences.setOrderReversed(!orderReversed);

        int newDirection = (orderReversed ? SWT.UP : SWT.DOWN);
        tree.setSortDirection(newDirection);

        TreeItem topmostVisibleItem = tree.getTopItem();
        refreshUI();
        if (topmostVisibleItem != null)
          tree.showItem(topmostVisibleItem);
      }
    });

    int direction = (RebaseInteractivePreferences.isOrderReversed() ? SWT.DOWN
        : SWT.UP);

    Tree planTree = planTreeViewer.getTree();
    planTree.setSortColumn(stepColumn.getColumn());
    planTree.setSortDirection(direction);

    TreeViewerColumn actionColumn = createColumn(headings[2], 90);
    actionColumn.setLabelProvider(new HighlightingColumnLabelProvider() {

      @Override
      public Image getImage(Object element) {
        ElementAction a = getAction(element);
        if (a != null) {
          switch (a) {
          case EDIT:
            return UIIcons.getImage(resources, UIIcons.EDITCONFIG);
          case FIXUP:
            if (RebaseInteractivePreferences.isOrderReversed())
              return UIIcons.getImage(resources,
                  UIIcons.FIXUP_DOWN);
            else
              return UIIcons.getImage(resources,
                  UIIcons.FIXUP_UP);
          case PICK:
            return UIIcons.getImage(resources, UIIcons.CHERRY_PICK);
          case REWORD:
            return UIIcons.getImage(resources, UIIcons.REWORD);
          case SKIP:
            return UIIcons.getImage(resources, UIIcons.REBASE_SKIP);
          case SQUASH:
            if (RebaseInteractivePreferences.isOrderReversed())
              return UIIcons.getImage(resources,
                  UIIcons.SQUASH_DOWN);
            else
              return UIIcons.getImage(resources,
                  UIIcons.SQUASH_UP);
          default:
            // fall through
          }
        }
        return super.getImage(element);
      }

      @Override
      public String getText(Object element) {
        ElementAction a = getAction(element);
        return (a != null) ? a.name() : super.getText(element);
      }

      private ElementAction getAction(Object element) {
        if (element instanceof PlanElement) {
          PlanElement planLine = (PlanElement) element;
          return planLine.getPlanElementAction();
        } else
          return null;
      }
    });

    TreeViewerColumn commitIDColumn = createColumn(headings[3], 70);
    commitIDColumn.setLabelProvider(new HighlightingColumnLabelProvider() {
      @Override
      public String getText(Object element) {
        if (element instanceof PlanElement) {
          PlanElement planLine = (PlanElement) element;
          return planLine.getCommit().name();
        }
        return super.getText(element);
      }
    });

    TreeViewerColumn commitMessageColumn = createColumn(headings[4], 200);
    commitMessageColumn
        .setLabelProvider(new HighlightingColumnLabelProvider() {
          @Override
          public String getText(Object element) {
            if (element instanceof PlanElement) {
              PlanElement planLine = (PlanElement) element;
              return planLine.getShortMessage();
            }
            return super.getText(element);
          }
        });

    TreeViewerColumn authorColumn = createColumn(headings[5], 120);
    authorColumn.setLabelProvider(new HighlightingColumnLabelProvider() {
      @Override
      public String getText(Object element) {
        if (element instanceof PlanElement) {
          PlanElement planLine = (PlanElement) element;
          return planLine.getAuthor();
        }
        return super.getText(element);
      }
    });

    TreeViewerColumn authoredDateColumn = createColumn(headings[6], 80);
    authoredDateColumn
        .setLabelProvider(new HighlightingColumnLabelProvider() {
          @Override
          public String getText(Object element) {
            if (element instanceof PlanElement) {
              PlanElement planLine = (PlanElement) element;
              return planLine.getAuthoredDate(dateFormatter);
            }
            return super.getText(element);
          }
        });

    TreeViewerColumn committerColumn = createColumn(headings[7], 120);
    committerColumn.setLabelProvider(new HighlightingColumnLabelProvider() {
      @Override
      public String getText(Object element) {
        if (element instanceof PlanElement) {
          PlanElement planLine = (PlanElement) element;
          return planLine.getCommitter();
        }
        return super.getText(element);
      }
    });

    TreeViewerColumn commitDateColumn = createColumn(headings[8], 80);
    commitDateColumn
        .setLabelProvider(new HighlightingColumnLabelProvider() {
          @Override
          public String getText(Object element) {
            if (element instanceof PlanElement) {
              PlanElement planLine = (PlanElement) element;
              return planLine.getCommittedDate(dateFormatter);
            }
            return super.getText(element);
          }
        });
    dynamicColumns = new TreeViewerColumn[] { commitMessageColumn,
View Full Code Here

Examples of org.eclipse.egit.core.internal.rebase.RebaseInteractivePlan.PlanElement

    // how to mock repository?
  }

  @SuppressWarnings("boxing")
  private PlanElement createPlanElement(boolean isComment) {
    PlanElement element1 = Mockito.mock(PlanElement.class);
    Mockito.when(element1.isComment()).thenReturn(isComment);
    return element1;
  }
View Full Code Here

Examples of org.eclipse.egit.core.internal.rebase.RebaseInteractivePlan.PlanElement

    return element1;
  }

  @Test
  public void moveUpTestOneElement() throws Exception {
    PlanElement element1 = createPlanElement(false);
    toDoElements.add(element1);
    moveHelper.moveTodoEntryUp(element1);
    assertEquals(element1, toDoElements.get(0));
  }
View Full Code Here

Examples of org.eclipse.egit.core.internal.rebase.RebaseInteractivePlan.PlanElement

    assertEquals(element1, toDoElements.get(0));
  }

  @Test
  public void moveUpTestTwoElements() throws Exception {
    PlanElement element1 = createPlanElement(false);
    PlanElement element2 = createPlanElement(false);
    toDoElements.add(element1);
    toDoElements.add(element2);
    moveHelper.moveTodoEntryUp(element2);
    assertEquals(element2, toDoElements.get(0));
    assertEquals(element1, toDoElements.get(1));
View Full Code Here

Examples of org.eclipse.egit.core.internal.rebase.RebaseInteractivePlan.PlanElement

    assertEquals(element2, toDoElements.get(1));
  }

  @Test
  public void moveUpTestThreeElementsWithOneComment() throws Exception {
    PlanElement element1 = createPlanElement(false);
    PlanElement element2 = createPlanElement(true);
    PlanElement element3 = createPlanElement(false);
    toDoElements.add(element1);
    toDoElements.add(element2);
    toDoElements.add(element3);
    moveHelper.moveTodoEntryUp(element3);
    assertEquals(element3, toDoElements.get(0));
View Full Code Here

Examples of org.eclipse.egit.core.internal.rebase.RebaseInteractivePlan.PlanElement

    assertEquals(element2, toDoElements.get(2));
  }

  @Test
  public void moveDownTestOneElement() throws Exception {
    PlanElement element1 = createPlanElement(false);
    toDoElements.add(element1);
    moveHelper.moveTodoEntryDown(element1);
    assertEquals(element1, toDoElements.get(0));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.