Example usage for org.eclipse.jdt.core.dom TypeDeclaration TYPE_PARAMETERS_PROPERTY

List of usage examples for org.eclipse.jdt.core.dom TypeDeclaration TYPE_PARAMETERS_PROPERTY

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.dom TypeDeclaration TYPE_PARAMETERS_PROPERTY.

Prototype

ChildListPropertyDescriptor TYPE_PARAMETERS_PROPERTY

To view the source code for org.eclipse.jdt.core.dom TypeDeclaration TYPE_PARAMETERS_PROPERTY.

Click Source Link

Document

The "typeParameters" structural property of this node type (element type: TypeParameter ) (added in JLS3 API).

Usage

From source file:de.ovgu.cide.language.jdt.SimplePrintVisitor.java

License:Open Source License

public boolean visit(IASTNode node) {
    if (node instanceof ASTStringNode) {
        printToken(((ASTStringNode) node).getValue());
        return false;
    }//from w w  w. ja v  a2 s .c o m
    if (node instanceof ASTTextNode) {
        printToken(((ASTTextNode) node).getValue());
        return false;
    }
    if (node instanceof UnifiedASTNode) {
        UnifiedASTNode unode = (UnifiedASTNode) node;

        if (unode.getEclipseASTNodeClass().equals("AnnotationTypeDeclaration")) {

            accept(node, AnnotationTypeDeclaration.JAVADOC_PROPERTY.getId());

        }

        if (unode.getEclipseASTNodeClass().equals(CompilationUnit.class.getSimpleName())) {
            accept(unode, CompilationUnit.PACKAGE_PROPERTY.getId());
            accept(unode, CompilationUnit.IMPORTS_PROPERTY.getId());
            accept(unode, CompilationUnit.TYPES_PROPERTY.getId());
        }

        if (unode.getEclipseASTNodeClass().equals(TypeDeclaration.class.getSimpleName())) {

            accept(node, TypeDeclaration.JAVADOC_PROPERTY.getId());
            accept(node, TypeDeclaration.MODIFIERS2_PROPERTY.getId());
            accept(node, TypeDeclaration.INTERFACE_PROPERTY.getId());
            accept(node, TypeDeclaration.NAME_PROPERTY.getId());
            accept(node, TypeDeclaration.TYPE_PARAMETERS_PROPERTY.getId(), "<", ",", ">", true);
            //            this.buffer.append(" ");//$NON-NLS-1$

            accept(node, TypeDeclaration.SUPERCLASS_TYPE_PROPERTY.getId(), "extends", "", "", false);
            accept(node, TypeDeclaration.SUPER_INTERFACE_TYPES_PROPERTY.getId(), "implements", ",", "", false);
            printToken("{");
            hintNewLine();
            hintIncIndent();

            accept(node, TypeDeclaration.BODY_DECLARATIONS_PROPERTY.getId());

            hintDecIndent();
            printToken("}");
            hintNewLine();
        }

        printToken(unode.getEclipseASTNodeClass());
    }
    return false;
}

From source file:org.eclipse.emf.codegen.merge.java.facade.ast.ASTJType.java

License:Open Source License

public void setTypeParameters(String[] typeParameters) {
    this.typeParameters = typeParameters;
    setListNodeProperty(getASTNode(), typeParameters, TypeDeclaration.TYPE_PARAMETERS_PROPERTY,
            ASTNode.SIMPLE_TYPE);//from w  w  w. j a v a 2s. c  om
}

From source file:org.moe.natjgen.ClassEditor.java

License:Apache License

@SuppressWarnings("unchecked")
public void setTemplates(ArrayList<ObjCGenericParamType> genericParamTypes) throws GeneratorException {
    editLock();/*from w  w  w.  j a v a2  s. c  om*/

    ListRewrite params = getRewrite().getListRewrite(classDecl, TypeDeclaration.TYPE_PARAMETERS_PROPERTY);
    for (ASTNode object : (List<ASTNode>) params.getRewrittenList()) {
        params.remove(object, getEditGroup());
    }

    for (ObjCGenericParamType genericParamType : genericParamTypes) {
        TypeParameter typeParameter = getAST().newTypeParameter();
        params.insertLast(typeParameter, getEditGroup());
        getRewrite().set(typeParameter, TypeParameter.NAME_PROPERTY,
                getAST().newSimpleName(genericParamType.getName()), getEditGroup());
    }
}