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


Java DiffFragment.getText2方法代码示例

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


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

示例1: add

import com.intellij.openapi.diff.ex.DiffFragment; //导入方法依赖的package包/类
private void add(@NotNull DiffFragment fragment) {
  DiffString text1 = fragment.getText1();
  DiffString text2 = fragment.getText2();
  if (text1 != null) myVersion1.addOffset(text1.length());
  if (text2 != null) myVersion2.addOffset(text2.length());
  if (fragment.isEqual() && !myFragments.isEmpty()) {
    int lastIndex = myFragments.size() - 1;
    DiffFragment prevFragment = myFragments.get(lastIndex);
    if (prevFragment.isEqual()) {
      prevFragment.appendText1(text1);
      prevFragment.appendText2(text2);
      return;
    }
  }
  myFragments.add(fragment);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ByWord.java

示例2: concatenate

import com.intellij.openapi.diff.ex.DiffFragment; //导入方法依赖的package包/类
@NotNull
public static DiffFragment concatenate(@NotNull DiffFragment[] line, int from, int to) {
  DiffString[] data1 = new DiffString[to - from];
  DiffString[] data2 = new DiffString[to - from];

  boolean isEqual = true;
  for (int i = 0; i < to - from; i++) {
    DiffFragment fragment = line[from + i];
    isEqual &= fragment.isEqual();
    data1[i] = fragment.getText1();
    data2[i] = fragment.getText2();
  }

  DiffString text1 = notEmptyContent(DiffString.concatenate(data1));
  DiffString text2 = notEmptyContent(DiffString.concatenate(data2));
  return isEqual ? DiffFragment.unchanged(text1, text2) : new DiffFragment(text1, text2);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:Util.java

示例3: execute

import com.intellij.openapi.diff.ex.DiffFragment; //导入方法依赖的package包/类
public void execute() {
  for (DiffFragment fragment : myFragments) {
    myContext.myFragment = fragment;
    process(fragment);
    DiffString text1 = fragment.getText1();
    DiffString text2 = fragment.getText2();
    myContext.myStarts[0] += StringUtil.length(text1);
    myContext.myStarts[1] += StringUtil.length(text2);
    myContext.myLines[0] += countLines(text1);
    myContext.myLines[1] += countLines(text2);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:ChangeList.java

示例4: getType

import com.intellij.openapi.diff.ex.DiffFragment; //导入方法依赖的package包/类
@Nullable
static TextDiffTypeEnum getType(@NotNull DiffFragment fragment) {
  TextDiffTypeEnum type;
  if (fragment.getText1() == null) type = TextDiffTypeEnum.INSERT;
  else if (fragment.getText2() == null) type = TextDiffTypeEnum.DELETED;
  else if (fragment.isModified()) type = TextDiffTypeEnum.CHANGED;
  else type = null;
  return type;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:LineFragmentsCollector.java

示例5: 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

示例6: 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

示例7: fromDiffFragment

import com.intellij.openapi.diff.ex.DiffFragment; //导入方法依赖的package包/类
@NotNull
static ChangeType fromDiffFragment(DiffFragment fragment) {
  if (fragment.getText1() == null) return INSERT;
  if (fragment.getText2() == null) return DELETED;
  return CHANGE;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:ChangeType.java


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