当前位置: 首页>>代码示例>>Java>>正文


Java DiffFragment.isChange方法代码示例

本文整理汇总了Java中com.intellij.openapi.diff.ex.DiffFragment.isChange方法的典型用法代码示例。如果您正苦于以下问题:Java DiffFragment.isChange方法的具体用法?Java DiffFragment.isChange怎么用?Java DiffFragment.isChange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.diff.ex.DiffFragment的用法示例。


在下文中一共展示了DiffFragment.isChange方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: process

import com.intellij.openapi.diff.ex.DiffFragment; //导入方法依赖的package包/类
@Override
public void process(@NotNull DiffFragment fragment, @NotNull FragmentsCollector collector) throws FilesTooBigForDiffException {
  if (!fragment.isChange()) {
    collector.add(fragment);
    return;
  }
  DiffString text1 = fragment.getText1();
  DiffString text2 = fragment.getText2();
  while (StringUtil.startsWithChar(text1, '\n') || StringUtil.startsWithChar(text2, '\n')) {
    DiffString newLine1 = null;
    DiffString newLine2 = null;
    if (StringUtil.startsWithChar(text1, '\n')) {
      newLine1 = DiffString.create("\n");
      text1 = text1.substring(1);
    }
    if (StringUtil.startsWithChar(text2, '\n')) {
      newLine2 = DiffString.create("\n");
      text2 = text2.substring(1);
    }
    collector.add(new DiffFragment(newLine1, newLine2));
  }
  DiffString spaces1 = text1.getLeadingSpaces();
  DiffString spaces2 = text2.getLeadingSpaces();
  if (spaces1.isEmpty() && spaces2.isEmpty()) {
    DiffFragment trailing = myComparisonPolicy.createFragment(text1, text2);
    collector.add(trailing);
    return;
  }
  collector.addAll(myDiffPolicy.buildFragments(spaces1, spaces2));
  DiffFragment textFragment = myComparisonPolicy
    .createFragment(text1.substring(spaces1.length(), text1.length()), text2.substring(spaces2.length(), text2.length()));
  collector.add(textFragment);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:DiffCorrection.java

示例2: addTails

import com.intellij.openapi.diff.ex.DiffFragment; //导入方法依赖的package包/类
public void addTails() throws FilesTooBigForDiffException {
  DiffString tail1 = myVersion1.getNotProcessedTail();
  DiffString tail2 = myVersion2.getNotProcessedTail();
  if (tail1.isEmpty() && tail2.isEmpty()) return;
  DiffFragment[] fragments = fragmentsByChar(tail1, tail2);
  if (!myFragments.isEmpty()) {
    DiffFragment lastFragment = myFragments.get(myFragments.size() - 1);
    if (lastFragment.isChange()) {
      int oneSideCount = 0;
      while (oneSideCount < fragments.length && fragments[oneSideCount].isOneSide()) oneSideCount++;
      if (oneSideCount > 0) {
        myFragments.remove(myFragments.size() - 1);
        DiffFragment[] onesideFragments = new DiffFragment[oneSideCount];
        DiffFragment[] otherFragments = new DiffFragment[fragments.length - oneSideCount];
        System.arraycopy(fragments, 0, onesideFragments, 0, oneSideCount);
        System.arraycopy(fragments, oneSideCount, otherFragments, 0, otherFragments.length);
        DiffFragment startingOneSides = UniteSameType.uniteAll(onesideFragments);
        if (startingOneSides.isOneSide()) {
          myFragments.add(lastFragment);
          add(startingOneSides);
        } else {
          lastFragment = Util.unite(lastFragment, startingOneSides);
          myFragments.add(lastFragment);
        }
        fragments = otherFragments;
      }
    }
  }
  addAll(fragments);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:ByWord.java

示例3: isSameType

import com.intellij.openapi.diff.ex.DiffFragment; //导入方法依赖的package包/类
public static boolean isSameType(@NotNull DiffFragment fragment1, @NotNull DiffFragment fragment2) {
  if (fragment1.isEqual()) return fragment2.isEqual();
  if (fragment1.isChange()) return fragment2.isChange();
  if (fragment1.getText1() == null) return fragment2.getText1() == null;
  if (fragment1.getText2() == null) return fragment2.getText2() == null;
  LOG.assertTrue(false);
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:Util.java


注:本文中的com.intellij.openapi.diff.ex.DiffFragment.isChange方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。