Search in sources :

Example 1 with InterfaceDeclaration

use of org.whole.lang.java.model.InterfaceDeclaration in project whole by wholeplatform.

the class InterfaceDeclarationPart method getModelSpecificChildren.

protected List<IEntity> getModelSpecificChildren() {
    InterfaceDeclaration interfaceDeclaration = getModelEntity();
    ((InterfaceDeclarationFigure) getFigure()).hideTypeParameters(EntityUtils.isResolver(interfaceDeclaration.getTypeParameters()));
    ((InterfaceDeclarationFigure) getFigure()).hideSuperInterfaceTypes(EntityUtils.isResolver(interfaceDeclaration.getSuperInterfaceTypes()));
    List<IEntity> list = new ArrayList<IEntity>(6);
    list.add(interfaceDeclaration.getJavadoc());
    list.add(interfaceDeclaration.getModifiers());
    list.add(interfaceDeclaration.getName());
    list.add(interfaceDeclaration.getTypeParameters());
    list.add(interfaceDeclaration.getSuperInterfaceTypes());
    list.add(interfaceDeclaration.getBodyDeclarations());
    return list;
}
Also used : InterfaceDeclarationFigure(org.whole.lang.java.ui.figures.InterfaceDeclarationFigure) IEntity(org.whole.lang.model.IEntity) ArrayList(java.util.ArrayList) InterfaceDeclaration(org.whole.lang.java.model.InterfaceDeclaration)

Example 2 with InterfaceDeclaration

use of org.whole.lang.java.model.InterfaceDeclaration in project whole by wholeplatform.

the class JDTTransformerVisitor method visit.

public boolean visit(TypeDeclaration node) {
    // FIXME workaround for type nesting
    org.whole.lang.java.model.Type type = this.type;
    org.whole.lang.java.model.Name name = this.name;
    org.whole.lang.java.model.TypeParameter typeParameter = this.typeParameter;
    org.whole.lang.java.model.Parameters params = this.params;
    org.whole.lang.java.model.Types thrownExceptions = this.thrownExceptions;
    org.whole.lang.java.model.SingleVariableDeclaration varDecl = this.varDecl;
    org.whole.lang.java.model.Block block = this.block;
    org.whole.lang.java.model.Statement stm = this.stm;
    org.whole.lang.java.model.Expression exp = this.exp;
    org.whole.lang.java.model.VariableDeclarationFragment varFrag = this.varFrag;
    org.whole.lang.java.model.CatchClauses catchClauses = this.catchClauses;
    org.whole.lang.java.model.AnonymousClassDeclaration anonymousClassDeclaration = this.anonymousClassDeclaration;
    env().wEnterScope();
    if (node.isInterface()) {
        InterfaceDeclaration interfaceDecl;
        appendBodyDeclaration(interfaceDecl = lf.create(JavaEntityDescriptorEnum.InterfaceDeclaration));
        if (acceptChild(node.getJavadoc()))
            interfaceDecl.setJavadoc(this.javadoc);
        Iterator<?> j = node.typeParameters().iterator();
        while (j.hasNext()) {
            ((ASTNode) j.next()).accept(this);
            interfaceDecl.getTypeParameters().wAdd(this.typeParameter);
        }
        List<?> modifiers = node.modifiers();
        if (!modifiers.isEmpty()) {
            interfaceDecl.setModifiers(lf.create(JavaEntityDescriptorEnum.ExtendedModifiers));
            setExtendedModifiers(interfaceDecl.getModifiers(), modifiers);
        }
        if (acceptChild(node.getName()))
            interfaceDecl.setName((org.whole.lang.java.model.SimpleName) this.name);
        Iterator<?> i = node.superInterfaceTypes().iterator();
        while (i.hasNext()) {
            ((ASTNode) i.next()).accept(this);
            interfaceDecl.getSuperInterfaceTypes().wAdd(this.type);
        }
        org.whole.lang.java.model.BodyDeclarations bodyDecl = lf.createBodyDeclarations();
        interfaceDecl.setBodyDeclarations(bodyDecl);
        env().wDef("typeDeclarationsContainer", bodyDecl);
        acceptChildren(node.bodyDeclarations());
    } else {
        ClassDeclaration classDecl;
        appendBodyDeclaration(classDecl = lf.create(JavaEntityDescriptorEnum.ClassDeclaration));
        if (acceptChild(node.getJavadoc()))
            classDecl.setJavadoc(this.javadoc);
        Iterator<?> j = node.typeParameters().iterator();
        while (j.hasNext()) {
            ((ASTNode) j.next()).accept(this);
            classDecl.getTypeParameters().wAdd(this.typeParameter);
        }
        List<?> modifiers = node.modifiers();
        if (!modifiers.isEmpty()) {
            classDecl.setModifiers(lf.create(JavaEntityDescriptorEnum.ExtendedModifiers));
            setExtendedModifiers(classDecl.getModifiers(), modifiers);
        }
        if (acceptChild(node.getName()))
            classDecl.setName((org.whole.lang.java.model.SimpleName) this.name);
        if (acceptChild(node.getSuperclassType()))
            classDecl.setSuperclassType(this.type);
        Iterator<?> i = node.superInterfaceTypes().iterator();
        while (i.hasNext()) {
            ((ASTNode) i.next()).accept(this);
            classDecl.getSuperInterfaceTypes().wAdd(this.type);
        }
        org.whole.lang.java.model.BodyDeclarations bodyDecl = lf.createBodyDeclarations();
        classDecl.setBodyDeclarations(bodyDecl);
        env().wDef("typeDeclarationsContainer", bodyDecl);
        acceptChildren(node.bodyDeclarations());
    }
    env().wExitScope();
    // FIXME workaround for type nesting
    this.anonymousClassDeclaration = anonymousClassDeclaration;
    this.type = type;
    this.name = name;
    this.typeParameter = typeParameter;
    this.params = params;
    this.thrownExceptions = thrownExceptions;
    this.varDecl = varDecl;
    this.block = block;
    this.stm = stm;
    this.exp = exp;
    this.varFrag = varFrag;
    this.catchClauses = catchClauses;
    return false;
}
Also used : SimpleName(org.eclipse.jdt.core.dom.SimpleName) InterfaceDeclaration(org.whole.lang.java.model.InterfaceDeclaration) AnonymousClassDeclaration(org.eclipse.jdt.core.dom.AnonymousClassDeclaration) ClassDeclaration(org.whole.lang.java.model.ClassDeclaration) ASTNode(org.eclipse.jdt.core.dom.ASTNode) Type(org.whole.lang.java.model.Type)

Aggregations

InterfaceDeclaration (org.whole.lang.java.model.InterfaceDeclaration)2 ArrayList (java.util.ArrayList)1 ASTNode (org.eclipse.jdt.core.dom.ASTNode)1 AnonymousClassDeclaration (org.eclipse.jdt.core.dom.AnonymousClassDeclaration)1 SimpleName (org.eclipse.jdt.core.dom.SimpleName)1 ClassDeclaration (org.whole.lang.java.model.ClassDeclaration)1 Type (org.whole.lang.java.model.Type)1 InterfaceDeclarationFigure (org.whole.lang.java.ui.figures.InterfaceDeclarationFigure)1 IEntity (org.whole.lang.model.IEntity)1