Package com.intellij.openapi.diff.ex

Examples of com.intellij.openapi.diff.ex.DiffFragment


  }

  public DiffFragment createFragment(String text1, String text2) {
    text1 = toNull(text1);
    text2 = toNull(text2);
    if (text1 == null && text2 == null) return new DiffFragment("", "");
    DiffFragment result = new DiffFragment(text1, text2);
    if (text1 != null && text2 != null) {
      result.setModified(!getWrapper(text1).equals(getWrapper(text2)));
    }
    return result;
  }
View Full Code Here


  }

  public void addAll(DiffFragment[] line) {
    ensureRowExists();
    for (int i = 0; i < line.length; i++) {
      DiffFragment value = line[i];
      myCurrentRow.add(value);
    }
  }
View Full Code Here

    public DiffFragment[] getFragments() { return myFragments; }

    public void processAll(DiffFragment[] fragments, FragmentProcessor<ActualRunner> processor) throws FilesTooBigForDiffException {
      myFragments = fragments;
      for (;myIndex < myFragments.length; myIndex++) {
        DiffFragment fragment = myFragments[myIndex];
        processor.process(fragment, (ActualRunner)this);
      }
    }
View Full Code Here

      String toCompare1 = toNotNull(text1);
      String toCompare2 = toNotNull(text2);
      if (getWrapper(toCompare1).equals(getWrapper(toCompare2))) {
        return DiffFragment.unchanged(toCompare1, toCompare2);
      }
      return new DiffFragment(text1, text2);
    }
View Full Code Here

      text2 = concatenate(mySource2, myLastLine2, start - 1);
    }
    if (text1 != null || text2 != null) {
      myData.add(DiffFragment.unchanged(text1, text2));
    }
    myData.add(new DiffFragment(null, concatenate(mySource2, start, end)));
    myLastLine1 = line + 1;
    myLastLine2 = end + 1;
  }
View Full Code Here

      text2 = concatenate(mySource2, myLastLine2, start2 - 1);
    }
    if (text1 != null || text2 != null) {
      myData.add(DiffFragment.unchanged(text1, text2));
    }
    myData.add(new DiffFragment(concatenate(mySource1, start1, end1),
                                concatenate(mySource2, start2, end2)));
    myLastLine1 = end1 + 1;
    myLastLine2 = end2 + 1;
  }
View Full Code Here

      text2 = concatenate(mySource2, myLastLine2, line);
    }
    if (text1 != null || text2 != null) {
      myData.add(DiffFragment.unchanged(text1, text2));
    }
    myData.add(new DiffFragment(concatenate(mySource1, start, end), null));
    myLastLine1 = end + 1;
    myLastLine2 = line + 1;
  }
View Full Code Here

public class DiffFragmentsProcessor {
  public ArrayList<LineFragment> process(DiffFragment[] fragments) {
    LineFragmentsCollector collector = new LineFragmentsCollector();
    for (int i = 0; i < fragments.length; i++) {
      DiffFragment fragment = fragments[i];
      collector.addDiffFragment(fragment);
    }
    return collector.getFragments();
  }
View Full Code Here

      LOG.error("1:<" + fragment.getText1() + "> 2:<" + fragment.getText2() + ">");
    }
    int length = lines1 == null ? lines2.length : lines1.length;
    DiffFragment[] lines = new DiffFragment[length];
    for (int i = 0; i < lines.length; i++) {
      lines[i] = new DiffFragment(lines1 == null? null : lines1[i], lines2 == null ? null : lines2[i]);
    }
    return lines;
  }
View Full Code Here

  }

  public static DiffFragment[][] splitByUnchangedLines(DiffFragment[] fragments) {
    List2D result = new List2D();
    for (int i = 0; i < fragments.length; i++) {
      DiffFragment fragment = fragments[i];
      if (!fragment.isEqual()) {
        result.add(fragment);
        continue;
      }
      String text1 = fragment.getText1();
      String text2 = fragment.getText2();
      if (StringUtil.endsWithChar(text1, '\n') && StringUtil.endsWithChar(text2, '\n')) {
        result.add(fragment);
        result.newRow();
        continue;
      }
View Full Code Here

TOP

Related Classes of com.intellij.openapi.diff.ex.DiffFragment

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.