本文整理汇总了Java中org.eclipse.jdt.internal.corext.dom.ASTNodes.copySubtree方法的典型用法代码示例。如果您正苦于以下问题:Java ASTNodes.copySubtree方法的具体用法?Java ASTNodes.copySubtree怎么用?Java ASTNodes.copySubtree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.internal.corext.dom.ASTNodes
的用法示例。
在下文中一共展示了ASTNodes.copySubtree方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: moveNode
import org.eclipse.jdt.internal.corext.dom.ASTNodes; //导入方法依赖的package包/类
/**
* If this occurrence update is called from within a declaration update (i.e., to update the call
* inside the newly created delegate), the old node does not yet exist and therefore cannot be a
* move target.
*
* <p>Normally, always use createMoveTarget as this has the advantage of being able to add changes
* inside changed nodes (for example, a method call within a method call, see test case #4) and
* preserving comments inside calls.
*
* @param oldNode original node
* @param rewrite an AST rewrite
* @return the node to insert at the target location
*/
protected <T extends ASTNode> T moveNode(T oldNode, ASTRewrite rewrite) {
T movedNode;
if (ASTNodes.isExistingNode(oldNode))
movedNode = ASTNodes.createMoveTarget(rewrite, oldNode); // node must be one of ast
else movedNode = ASTNodes.copySubtree(rewrite.getAST(), oldNode);
return movedNode;
}