Package org.eclipse.egit.ui.internal.commit

Examples of org.eclipse.egit.ui.internal.commit.DiffStyleRangeFormatter


  private void formatDiffs(final List<FileDiff> diffs) {
    final Repository repository = fileViewer.getRepository();
    Job formatJob = new Job(UIText.GitHistoryPage_FormatDiffJobName) {
      protected IStatus run(IProgressMonitor monitor) {
        final IDocument document = new Document();
        final DiffStyleRangeFormatter formatter = new DiffStyleRangeFormatter(
            document);

        monitor.beginTask("", diffs.size()); //$NON-NLS-1$
        for (FileDiff diff : diffs) {
          if (monitor.isCanceled())
            break;
          if (diff.getCommit().getParentCount() > 1)
            break;
          monitor.setTaskName(diff.getPath());
          try {
            formatter.write(repository, diff);
          } catch (IOException ignore) {
            // Ignored
          }
          monitor.worked(1);
        }
View Full Code Here


    diffText.setEditable(false);
    diffText.getControl().setLayoutData(
        GridDataFactory.fillDefaults().grab(true, true).create());

    IDocument document = new Document();
    DiffStyleRangeFormatter diffFormatter = new DiffStyleRangeFormatter(
        document);
    diffFormatter.setContext(1);
    diffFormatter.setRepository(revision.getRepository());
    diffFormatter.format(interestingDiff, diff.getOldText(),
        diff.getNewText());

    diffText.setDocument(document);
    diffText.setFormatter(diffFormatter);
  }
View Full Code Here

  }

  @Test
  public void testRanges() throws Exception {
    IDocument document = new Document();
    DiffStyleRangeFormatter formatter = new DiffStyleRangeFormatter(
        document);
    formatter.setRepository(repository);
    formatter.format(commit.getTree(), commit.getParent(0).getTree());
    assertTrue(document.getLength() > 0);
    DiffStyleRange[] ranges = formatter.getRanges();
    assertNotNull(ranges);
    assertTrue(ranges.length > 0);
    for (DiffStyleRange range : ranges) {
      assertNotNull(range);
      assertNotNull(range.diffType);
View Full Code Here

TOP

Related Classes of org.eclipse.egit.ui.internal.commit.DiffStyleRangeFormatter

Copyright © 2018 www.massapicom. 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.