本文整理汇总了Java中com.intellij.openapi.diff.ex.DiffFragment.unchanged方法的典型用法代码示例。如果您正苦于以下问题:Java DiffFragment.unchanged方法的具体用法?Java DiffFragment.unchanged怎么用?Java DiffFragment.unchanged使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.diff.ex.DiffFragment
的用法示例。
在下文中一共展示了DiffFragment.unchanged方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testConnectSingleSideToChange
import com.intellij.openapi.diff.ex.DiffFragment; //导入方法依赖的package包/类
public void testConnectSingleSideToChange() throws FilesTooBigForDiffException {
DiffFragment first = DiffFragment.unchanged("a", "A");
DiffFragment oneSide = new DiffFragment(null, "b");
DiffFragment equal = new DiffFragment("c", "c");
DiffFragment last = DiffFragment.unchanged("g", "G");
DiffFragment[] fragments = DiffCorrection.ConnectSingleSideToChange.INSTANCE.correct(new DiffFragment[]{
first,
oneSide,
equal,
new DiffFragment(null, "d"), new DiffFragment("e", "E"), new DiffFragment("f", null),
last
});
CHECK.compareAll(new DiffFragment[]{
first, oneSide, equal,
new DiffFragment("ef", "dE"),
last
}, fragments);
}
示例2: testUniteFormattingOnly
import com.intellij.openapi.diff.ex.DiffFragment; //导入方法依赖的package包/类
public void testUniteFormattingOnly() {
prepareForFragments();
DiffFragment[] first = new DiffFragment[]{DiffFragment.unchanged("123", "abc")};
DiffFragment[] last = new DiffFragment[]{new DiffFragment("qqq", "qqq")};
DiffFragment inline1 = new DiffFragment(" ", " ");
DiffFragment inline2 = DiffFragment.unchanged("xyz", "cba");
DiffFragment inline3 = new DiffFragment(" ", " ");
DiffFragment inline4 = DiffFragment.unchanged("098", "890");
DiffFragment[][] lines = new DiffFragment[][]{
first,
new DiffFragment[]{inline1, inline2},
new DiffFragment[]{inline3, inline4},
last};
lines = Util.uniteFormattingOnly(lines);
CHECK.compareAll(new DiffFragment[][]{
first,
new DiffFragment[]{inline1, inline2, inline3, inline4},
last},
lines
);
}
示例3: 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);
}
示例4: unite
import com.intellij.openapi.diff.ex.DiffFragment; //导入方法依赖的package包/类
@NotNull
public static DiffFragment unite(@NotNull DiffFragment fragment1, @NotNull DiffFragment fragment2) {
LOG.assertTrue(isSameType(fragment1, fragment2));
if (!fragment1.isOneSide()) {
DiffString unitedText1 = DiffString.concatenateNullable(fragment1.getText1(), fragment2.getText1());
DiffString unitedText2 = DiffString.concatenateNullable(fragment1.getText2(), fragment2.getText2());
LOG.assertTrue(fragment1.isEqual() == fragment2.isEqual());
return fragment1.isEqual() ? DiffFragment.unchanged(unitedText1, unitedText2) :
new DiffFragment(unitedText1, unitedText2);
}
FragmentSide side = FragmentSide.chooseSide(fragment1);
return side
.createFragment(DiffString.concatenateNullable(side.getText(fragment1), side.getText(fragment2)), null, fragment1.isModified());
}
示例5: createFragment
import com.intellij.openapi.diff.ex.DiffFragment; //导入方法依赖的package包/类
@NotNull
@Override
public DiffFragment createFragment(@NotNull Word word1, @NotNull Word word2) {
DiffString text1 = word1.getText();
DiffString text2 = word2.getText();
if (word1.isWhitespace() && word2.isWhitespace() &&
word1.atEndOfLine() && word2.atEndOfLine()) {
return DiffFragment.unchanged(text1, text2);
}
return createFragment(text1, text2);
}