本文整理汇总了Java中com.intellij.openapi.vcs.checkin.StepIntersection.process方法的典型用法代码示例。如果您正苦于以下问题:Java StepIntersection.process方法的具体用法?Java StepIntersection.process怎么用?Java StepIntersection.process使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.vcs.checkin.StepIntersection
的用法示例。
在下文中一共展示了StepIntersection.process方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import com.intellij.openapi.vcs.checkin.StepIntersection; //导入方法依赖的package包/类
public List<Pair<TextRange, TextAttributes>> execute() {
final TodoItemData[] todoItems = getTodoItems();
final StepIntersection<TodoItemData, TextRange> stepIntersection =
new StepIntersection<TodoItemData, TextRange>(new Convertor<TodoItemData, TextRange>() {
@Override
public TextRange convert(TodoItemData o) {
return o.getTextRange();
}
}, Convertor.SELF, myRanges, new Getter<String>() {
@Override
public String get() {
return "";
}
}
);
final List<TodoItemData> filtered = stepIntersection.process(Arrays.asList(todoItems));
final List<Pair<TextRange, TextAttributes>> result = new ArrayList<Pair<TextRange, TextAttributes>>(filtered.size());
int offset = 0;
for (TextRange range : myRanges) {
Iterator<TodoItemData> iterator = filtered.iterator();
while (iterator.hasNext()) {
TodoItemData item = iterator.next();
if (range.contains(item.getTextRange())) {
TextRange todoRange = new TextRange(offset - range.getStartOffset() + item.getTextRange().getStartOffset(),
offset - range.getStartOffset() + item.getTextRange().getEndOffset());
result.add(Pair.create(todoRange, item.getPattern().getAttributes().getTextAttributes()));
iterator.remove();
} else {
break;
}
}
offset += range.getLength() + 1 + myAdditionalOffset;
}
return result;
}
示例2: execute
import com.intellij.openapi.vcs.checkin.StepIntersection; //导入方法依赖的package包/类
public List<Pair<TextRange, TextAttributes>> execute() {
final TodoItemData[] todoItems = getTodoItems();
final StepIntersection<TodoItemData, TextRange> stepIntersection =
new StepIntersection<TodoItemData, TextRange>(new Convertor<TodoItemData, TextRange>() {
@Override
public TextRange convert(TodoItemData o) {
return o.getTextRange();
}
}, Convertor.SELF, myRanges, new Getter<String>() {
@Override
public String get() {
return "";
}
}
);
final List<TodoItemData> filtered = stepIntersection.process(Arrays.asList(todoItems));
final List<Pair<TextRange, TextAttributes>> result = new ArrayList<Pair<TextRange, TextAttributes>>(filtered.size());
int offset = 0;
for (TextRange range : myRanges) {
Iterator<TodoItemData> iterator = filtered.iterator();
while (iterator.hasNext()) {
TodoItemData item = iterator.next();
if (range.contains(item.getTextRange())) {
TextRange todoRange = new TextRange(offset - range.getStartOffset() + item.getTextRange().getStartOffset(),
offset - range.getStartOffset() + item.getTextRange().getEndOffset());
result.add(new Pair<TextRange, TextAttributes>(todoRange, item.getPattern().getAttributes().getTextAttributes()));
iterator.remove();
} else {
break;
}
}
offset += range.getLength() + 1 + myAdditionalOffset;
}
return result;
}