本文整理汇总了Java中org.eclipse.text.edits.TextEdit.getChildren方法的典型用法代码示例。如果您正苦于以下问题:Java TextEdit.getChildren方法的具体用法?Java TextEdit.getChildren怎么用?Java TextEdit.getChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.text.edits.TextEdit
的用法示例。
在下文中一共展示了TextEdit.getChildren方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: flatten
import org.eclipse.text.edits.TextEdit; //导入方法依赖的package包/类
private static void flatten(TextEdit edit, MultiTextEdit result) {
if (!edit.hasChildren()) {
result.addChild(edit);
} else {
TextEdit[] children = edit.getChildren();
for (int i = 0; i < children.length; i++) {
TextEdit child = children[i];
child.getParent().removeChild(0);
flatten(child, result);
}
}
}
示例2: flatten
import org.eclipse.text.edits.TextEdit; //导入方法依赖的package包/类
private void flatten(List result, TextEdit edit) {
result.add(edit);
TextEdit[] children = edit.getChildren();
for (int i = 0; i < children.length; i++) {
flatten(result, children[i]);
}
}
示例3: isPacked
import org.eclipse.text.edits.TextEdit; //导入方法依赖的package包/类
/**
* Returns true if the given <code>edit</code> is minimal.
*
* <p>That is if:
*
* <ul>
* <li><b>true</b> if <code>edit</code> is a leaf
* <li>if <code>edit</code> is a inner node then <b>true</b> if
* <ul>
* <li><code>edit</code> has same size as all its children
* <li><code>isPacked</code> is <b>true</b> for all children
* </ul>
* </ul>
*
* @param edit the edit to verify
* @return true if edit is minimal
* @since 3.4
*/
public static boolean isPacked(TextEdit edit) {
if (!(edit instanceof MultiTextEdit)) return true;
if (!edit.hasChildren()) return true;
TextEdit[] children = edit.getChildren();
if (edit.getOffset() != children[0].getOffset()) return false;
if (edit.getExclusiveEnd() != children[children.length - 1].getExclusiveEnd()) return false;
for (int i = 0; i < children.length; i++) {
if (!isPacked(children[i])) return false;
}
return true;
}
示例4: cacheEdit
import org.eclipse.text.edits.TextEdit; //导入方法依赖的package包/类
private final void cacheEdit(final TextEdit edit) {
fEdits.add(edit);
final TextEdit[] edits = edit.getChildren();
for (int index = 0; index < edits.length; index++) cacheEdit(edits[index]);
}