本文整理汇总了Java中org.eclipse.text.edits.TextEdit.getCoverage方法的典型用法代码示例。如果您正苦于以下问题:Java TextEdit.getCoverage方法的具体用法?Java TextEdit.getCoverage怎么用?Java TextEdit.getCoverage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.text.edits.TextEdit
的用法示例。
在下文中一共展示了TextEdit.getCoverage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getEditChangeOffsetUpdates
import org.eclipse.text.edits.TextEdit; //导入方法依赖的package包/类
/**
* @param change
* @return Map <Integer oldOffset, Integer updatedOffset>
*/
private static Map<Integer, Integer> getEditChangeOffsetUpdates(TextChange change) {
TextEditChangeGroup[] editChanges = change.getTextEditChangeGroups();
Map<Integer, Integer> offsetUpdates = new HashMap<Integer, Integer>(editChanges.length);
for (int i = 0; i < editChanges.length; i++) {
TextEditChangeGroup editChange = editChanges[i];
IRegion oldRegion = editChange.getRegion();
if (oldRegion == null) continue;
IRegion updatedRegion =
TextEdit.getCoverage(change.getPreviewEdits(editChange.getTextEdits()));
if (updatedRegion == null) continue;
offsetUpdates.put(new Integer(oldRegion.getOffset()), new Integer(updatedRegion.getOffset()));
}
return offsetUpdates;
}
示例2: getNewRegion
import org.eclipse.text.edits.TextEdit; //导入方法依赖的package包/类
private IRegion getNewRegion(TextEditBasedChangeGroup[] changes) {
if (changes == ALL_EDITS) {
if (fEdit == null) return null;
return fCopier.getCopy(fEdit).getRegion();
} else {
List result = new ArrayList();
for (int c = 0; c < changes.length; c++) {
TextEdit[] edits = changes[c].getTextEditGroup().getTextEdits();
for (int e = 0; e < edits.length; e++) {
TextEdit copy = fCopier.getCopy(edits[e]);
if (copy != null) result.add(copy);
}
}
if (result.size() == 0) return null;
return TextEdit.getCoverage((TextEdit[]) result.toArray(new TextEdit[result.size()]));
}
}
示例3: getCorrespondingEditChangeRange
import org.eclipse.text.edits.TextEdit; //导入方法依赖的package包/类
private static IRegion getCorrespondingEditChangeRange(
SearchMatch searchResult, TextChangeManager manager) {
TextChange change = getTextChange(searchResult, manager);
if (change == null) return null;
IRegion oldMatchRange = createTextRange(searchResult);
TextEditChangeGroup[] editChanges = change.getTextEditChangeGroups();
for (int i = 0; i < editChanges.length; i++) {
if (oldMatchRange.equals(editChanges[i].getRegion()))
return TextEdit.getCoverage(change.getPreviewEdits(editChanges[i].getTextEdits()));
}
return null;
}
示例4: getRegion
import org.eclipse.text.edits.TextEdit; //导入方法依赖的package包/类
private IRegion getRegion(TextEditBasedChangeGroup[] changes) {
if (changes == ALL_EDITS) {
if (fEdit == null) return null;
return fEdit.getRegion();
} else {
List edits = new ArrayList();
for (int i = 0; i < changes.length; i++) {
edits.addAll(Arrays.asList(changes[i].getTextEditGroup().getTextEdits()));
}
if (edits.size() == 0) return null;
return TextEdit.getCoverage((TextEdit[]) edits.toArray(new TextEdit[edits.size()]));
}
}