Package com.python.pydev.refactoring.wizards.rename

Examples of com.python.pydev.refactoring.wizards.rename.PyRenameGlobalProcess


                                return new PyRenameLocalProcess(definition);
                            }
                        }
                    }
                }
                return new PyRenameGlobalProcess(definition);
            }
        }
        if (definition.ast != null) {
            if (definition.ast instanceof ClassDef) {
                return new PyRenameClassProcess(definition);
            }

            if (definition.ast instanceof Name) {
                Name n = (Name) definition.ast;
                if (n.ctx == Name.Param || n.ctx == Attribute.KwOnlyParam) {
                    return new PyRenameParameterProcess(definition);
                }
            }

            if (definition instanceof KeywordParameterDefinition) {
                return new PyRenameParameterProcess((KeywordParameterDefinition) definition, request.nature);
            }

            if (definition.ast instanceof FunctionDef) {
                return new PyRenameFunctionProcess(definition);
            }
            if (NodeUtils.isImport(definition.ast)) {
                //this means that we found an import and we cannot actually map that import to a definition
                //(so, it is an unresolved import)
                return new PyRenameImportProcess(definition);
            }
        } else {
            //the definition ast is null. This should mean that it was actually an import
            //and pointed to some module
            return new PyRenameImportProcess(definition);

        }
        if (definition.scope != null) {
            //classvar
            if (definition.scope.isLastClassDef()) {
                return new PyRenameAttributeProcess(definition, definition.value);
            }

            FastStack scopeStack = definition.scope.getScopeStack();
            if (request.moduleName.equals(definition.module.getName())) {
                if (!scopeStack.empty()) {
                    Object peek = scopeStack.peek();
                    if (peek instanceof FunctionDef) {
                        return new PyRenameLocalProcess(definition);
                    }
                }
            }

        }
        return new PyRenameGlobalProcess(definition);
    }
View Full Code Here

TOP

Related Classes of com.python.pydev.refactoring.wizards.rename.PyRenameGlobalProcess

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.