Search in sources :

Example 26 with ChildListPropertyDescriptor

use of org.eclipse.jdt.core.dom.ChildListPropertyDescriptor in project xtext-xtend by eclipse.

the class ASTFlattenerUtils method genericChildListProperty.

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;
}
Also used : ASTNode(org.eclipse.jdt.core.dom.ASTNode) ChildListPropertyDescriptor(org.eclipse.jdt.core.dom.ChildListPropertyDescriptor)

Aggregations

ChildListPropertyDescriptor (org.eclipse.jdt.core.dom.ChildListPropertyDescriptor)26 ASTNode (org.eclipse.jdt.core.dom.ASTNode)20 ListRewrite (org.eclipse.jdt.core.dom.rewrite.ListRewrite)17 ASTRewrite (org.eclipse.jdt.core.dom.rewrite.ASTRewrite)14 AST (org.eclipse.jdt.core.dom.AST)10 BodyDeclaration (org.eclipse.jdt.core.dom.BodyDeclaration)10 MethodDeclaration (org.eclipse.jdt.core.dom.MethodDeclaration)10 ICompilationUnit (org.eclipse.jdt.core.ICompilationUnit)8 ITypeBinding (org.eclipse.jdt.core.dom.ITypeBinding)8 Expression (org.eclipse.jdt.core.dom.Expression)7 ImportRewriteContext (org.eclipse.jdt.core.dom.rewrite.ImportRewrite.ImportRewriteContext)7 CompilationUnit (org.eclipse.jdt.core.dom.CompilationUnit)6 ExpressionStatement (org.eclipse.jdt.core.dom.ExpressionStatement)6 Statement (org.eclipse.jdt.core.dom.Statement)6 Type (org.eclipse.jdt.core.dom.Type)6 VariableDeclarationFragment (org.eclipse.jdt.core.dom.VariableDeclarationFragment)6 Block (org.eclipse.jdt.core.dom.Block)5 ForStatement (org.eclipse.jdt.core.dom.ForStatement)5 SimpleName (org.eclipse.jdt.core.dom.SimpleName)5 VariableDeclarationExpression (org.eclipse.jdt.core.dom.VariableDeclarationExpression)5