本文整理匯總了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()]));
}
}