private Object accessOriginalValue(ASTNode parent, StructuralPropertyDescriptor childProperty) { if (this.nodePropertyMapper != null) { return this.nodePropertyMapper.getOriginalValue(parent, childProperty); } return parent.getStructuralProperty(childProperty); }
private Object accessOriginalValue(ASTNode parent, StructuralPropertyDescriptor childProperty) { if (this.nodePropertyMapper != null) { return this.nodePropertyMapper.getOriginalValue(parent, childProperty); } return parent.getStructuralProperty(childProperty); }
private Object accessOriginalValue(ASTNode parent, StructuralPropertyDescriptor childProperty) { if (this.nodePropertyMapper != null) { return this.nodePropertyMapper.getOriginalValue(parent, childProperty); } return parent.getStructuralProperty(childProperty); }
private Object accessOriginalValue(ASTNode parent, StructuralPropertyDescriptor childProperty) { if (this.nodePropertyMapper != null) { return this.nodePropertyMapper.getOriginalValue(parent, childProperty); } return parent.getStructuralProperty(childProperty); }
private Object accessOriginalValue(ASTNode parent, StructuralPropertyDescriptor childProperty) { if (this.nodePropertyMapper != null) { return this.nodePropertyMapper.getOriginalValue(parent, childProperty); } return parent.getStructuralProperty(childProperty); }
private Object accessOriginalValue(ASTNode parent, StructuralPropertyDescriptor childProperty) { if (this.nodePropertyMapper != null) { return this.nodePropertyMapper.getOriginalValue(parent, childProperty); } return parent.getStructuralProperty(childProperty); }
public static List<ASTNode> getChildren(ASTNode node) { List<ASTNode> children = new ArrayList<ASTNode>(); List list = node.structuralPropertiesForType(); for (int i = 0; i < list.size(); i++) { Object child = node.getStructuralProperty((StructuralPropertyDescriptor)list.get(i)); if (child instanceof ASTNode) { children.add((ASTNode) child); } } return children; }
public Object[] getChildren(ASTNode node) { List list= node.structuralPropertiesForType(); for (int i= 0; i < list.size(); i++) { StructuralPropertyDescriptor curr= (StructuralPropertyDescriptor) list.get(i); Object child= node.getStructuralProperty(curr); if (child instanceof List) { return ((List) child).toArray(); } else if (child instanceof ASTNode) { return new Object[] { child }; } return new Object[0]; } }
private FieldDeclaration[] getFieldDeclarations(ChildListPropertyDescriptor descriptor) { final List bodyDeclarations= (List) getMethodDeclaration().getParent().getStructuralProperty(descriptor); List fields= new ArrayList(1); for (Iterator iter= bodyDeclarations.iterator(); iter.hasNext();) { Object each= iter.next(); if (each instanceof FieldDeclaration) fields.add(each); } return (FieldDeclaration[]) fields.toArray(new FieldDeclaration[fields.size()]); }
@Override void postValueChangeEvent(ASTNode node, SimplePropertyDescriptor property) { NodeRewriteEvent event = getNodeEvent(node, property); event.setNewValue(node.getStructuralProperty(property)); }
static ASTNode[] getSiblingNodes(ASTNode node) { ASTNode parent= node.getParent(); StructuralPropertyDescriptor locationInParent= node.getLocationInParent(); if (locationInParent.isChildListProperty()) { List siblings= (List) parent.getStructuralProperty(locationInParent); return (ASTNode[]) siblings.toArray(new ASTNode[siblings.size()]); } return null; }
void postValueChangeEvent(ASTNode node, SimplePropertyDescriptor property) { NodeRewriteEvent event = getNodeEvent(node, property); event.setNewValue(node.getStructuralProperty(property)); }
public List<ASTNode> genericChildListProperty(final ASTNode node, final String propertyName) { final Function1<ChildListPropertyDescriptor, Boolean> _function = (ChildListPropertyDescriptor it) -> { String _id = it.getId(); return Boolean.valueOf(Objects.equal(propertyName, _id)); }; final ChildListPropertyDescriptor property = IterableExtensions.<ChildListPropertyDescriptor>head(IterableExtensions.<ChildListPropertyDescriptor>filter(Iterables.<ChildListPropertyDescriptor>filter(node.structuralPropertiesForType(), ChildListPropertyDescriptor.class), _function)); if ((property != null)) { Object _structuralProperty = node.getStructuralProperty(property); return ((List<ASTNode>) _structuralProperty); } return null; }
public ASTNode genericChildProperty(final ASTNode node, final String propertyName) { final Function1<ChildPropertyDescriptor, Boolean> _function = (ChildPropertyDescriptor it) -> { String _id = it.getId(); return Boolean.valueOf(Objects.equal(propertyName, _id)); }; final ChildPropertyDescriptor property = IterableExtensions.<ChildPropertyDescriptor>head(IterableExtensions.<ChildPropertyDescriptor>filter(Iterables.<ChildPropertyDescriptor>filter(node.structuralPropertiesForType(), ChildPropertyDescriptor.class), _function)); if ((property != null)) { Object _structuralProperty = node.getStructuralProperty(property); return ((ASTNode) _structuralProperty); } return null; }
private ASTNode getPreviousNode(ASTNode node) { ArrayType arrayType = (ArrayType) node.getParent(); ASTNode prev = arrayType.getElementType(); List l = (List) node.getParent().getStructuralProperty(node.getLocationInParent()); int size = l.size(); int i = 0; for (; i < size; i++) { ASTNode currNode = (ASTNode) l.get(i); if (node == currNode) break; prev = currNode; } return i < size ? prev : null; }
private ASTNode getPreviousNode(ASTNode node) { ArrayType arrayType = (ArrayType) node.getParent(); ASTNode prev = arrayType.getElementType(); List l = (List) node.getParent().getStructuralProperty(node.getLocationInParent()); int size = l.size(); int i = 0; for (; i < size; i++) { ASTNode currNode = (ASTNode) l.get(i); if (node == currNode) break; prev = currNode; } return i < size ? prev : null; }
private ASTNode getPreviousNode(ASTNode node) { ArrayType arrayType = (ArrayType) node.getParent(); ASTNode prev = arrayType.getElementType(); List l = (List) node.getParent().getStructuralProperty(node.getLocationInParent()); int size = l.size(); int i = 0; for (; i < size; i++) { ASTNode currNode = (ASTNode) l.get(i); if (node == currNode) break; prev = currNode; } return i < size ? prev : null; }
private ASTNode getPreviousNode(ASTNode node) { ArrayType arrayType = (ArrayType) node.getParent(); ASTNode prev = arrayType.getElementType(); List l = (List) node.getParent().getStructuralProperty(node.getLocationInParent()); int size = l.size(); int i = 0; for (; i < size; i++) { ASTNode currNode = (ASTNode) l.get(i); if (node == currNode) break; prev = currNode; } return i < size ? prev : null; }
private ParameterAnnotationRewriteOperation.IndexedParameter findParameterDeclaration(ASTNode selectedNode) { VariableDeclaration argDecl= (selectedNode instanceof VariableDeclaration) ? (VariableDeclaration) selectedNode : ASTNodes.getParent(selectedNode, VariableDeclaration.class); if (argDecl != null) { StructuralPropertyDescriptor locationInParent= argDecl.getLocationInParent(); if (!locationInParent.isChildListProperty()) return null; List<?> containingList= (List<?>) argDecl.getParent().getStructuralProperty(locationInParent); return new ParameterAnnotationRewriteOperation.IndexedParameter(containingList.indexOf(argDecl), argDecl.getName().getIdentifier()); } return null; }
private void addFieldDeclaration(ASTRewrite rewrite) { final ChildListPropertyDescriptor descriptor= getBodyDeclarationListOfDeclaringType(); FieldDeclaration[] fields= getFieldDeclarations(getBodyDeclarationListOfDeclaringType()); final ASTNode parent= getMethodDeclaration().getParent(); int insertIndex; if (fields.length == 0) insertIndex= 0; else insertIndex= ((List) parent.getStructuralProperty(descriptor)).indexOf(fields[fields.length - 1]) + 1; final FieldDeclaration declaration= createNewFieldDeclaration(rewrite); rewrite.getListRewrite(parent, descriptor).insertAt(declaration, insertIndex, null); }