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