Package org.python.pydev.parser.jython.ast

Examples of org.python.pydev.parser.jython.ast.ClassDef


    /* (non-Javadoc)
     * @see org.python.pydev.refactoring.ast.adapters.IClassDefAdapter#getNodeBodyIndent()
     */
    public String getNodeBodyIndent() {
        ClassDef classNode = getASTNode();
        if (classNode.body == null || classNode.body.length == 0) {
            PySelection pySelection = new PySelection(getModule().getDoc());
            String indentationFromLine = PySelection.getIndentationFromLine(pySelection
                    .getLine(classNode.beginLine - 1));
            return indentationFromLine + DefaultIndentPrefs.get().getIndentationString();
View Full Code Here


    }

    protected int getLine() {
        SimpleNode node = adapter.getASTNode();
        if (nodeHelper.isClassDef(node)) {
            ClassDef classNode = (ClassDef) node;
            Str strNode = NodeUtils.getNodeDocStringNode(node);

            if (strNode != null) {
                return NodeUtils.getLineEnd(strNode);
            }
View Full Code Here

    @Override
    protected int getLine() {
        SimpleNode node = adapter.getASTNode();
        if (nodeHelper.isClassDef(node)) {

            ClassDef classNode = (ClassDef) node;
            for (stmtType statement : classNode.body) {
                if (nodeHelper.isInit(statement)) {
                    FunctionDef func = (FunctionDef) statement;
                    stmtType lastStmt = func.body[func.body.length - 1];
                    LastLineVisitor visitor = VisitorFactory.createVisitor(LastLineVisitor.class, lastStmt);
View Full Code Here

            tempFileAt.delete();
        }
    }

    private ClassDef createClassDef(String name) {
        return new ClassDef(new NameTok(name, NameTok.FunctionName), null, null, null, null, null, null);
    }
View Full Code Here

            if (p == null) {
                return null;
            }
            SimpleNode node = p.node;
            if (node instanceof ClassDef) {
                ClassDef def = (ClassDef) node;
                node = def.name;

            } else if (node instanceof Attribute) {
                Attribute attribute = (Attribute) node;
                node = attribute.attr;
View Full Code Here

                if (tok instanceof SourceToken) {
                    SourceToken token = (SourceToken) tok;
                    SimpleNode ast = token.getAst();
                    if (ast instanceof ClassDef || ast instanceof FunctionDef) {
                        if (ast.parent instanceof ClassDef) {
                            ClassDef classDefAst = (ClassDef) ast.parent;
                            if (!alreadyTreated.contains(classDefAst)) {
                                classDefAsts.add(classDefAst);
                                alreadyTreated.add(classDefAst);
                            }
                        }
View Full Code Here

                            treeMembers.removeAll();
                        }
                        if (model == null) {
                            return;
                        }
                        ClassDef ast = model.ast;
                        if (ast != null && treeMembers != null) {
                            DefinitionsASTIteratorVisitor visitor = DefinitionsASTIteratorVisitor.create(ast);
                            Iterator<ASTEntry> outline = visitor.getOutline();

                            HashMap<SimpleNode, TreeItem> c = new HashMap<SimpleNode, TreeItem>();
View Full Code Here

            Iterator<ASTEntry> entries = EasyASTIteratorVisitor.createClassIterator(m.getAst());

            while (entries.hasNext()) {
                ASTEntry entry = entries.next();
                //we're checking for those that have model.name as a parent
                ClassDef def = (ClassDef) entry.node;
                List<String> parentNames = NodeUtils.getParentNames(def, true);
                if (parentNames.contains(toFindOnRound.name)) {
                    HierarchyNodeModel newNode = new HierarchyNodeModel(module, def);
                    if (allFound.containsKey(newNode) == false) {
                        toFindOnRound.children.add(newNode);
View Full Code Here

                }
                body = f.body;
            }

            else if (element instanceof ClassDef && !iter.hasNext()) {
                ClassDef classDef = (ClassDef) element;
                body = classDef.body;
            }

            if (body != null) {
                try {
View Full Code Here

                        Definition definition = (Definition) definitions2[0];
                        if (definition.ast instanceof FunctionDef) {
                            return true;

                        } else if (definition.ast instanceof ClassDef) {
                            ClassDef def = (ClassDef) definition.ast;
                            if (isDynamicClass(def)) {
                                return true;
                            }
                        }
                    }
                }
            } else if (foundDefinition instanceof Definition) { //not Assign definition
                Definition definition = (Definition) foundDefinition;
                if (definition.ast instanceof ClassDef) {
                    //direct class access
                    ClassDef classDef = (ClassDef) definition.ast;
                    if (isDynamicClass(classDef)) {
                        return true;
                    }
                }
View Full Code Here

TOP

Related Classes of org.python.pydev.parser.jython.ast.ClassDef

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.