Package org.python.pydev.editor.refactoring

Examples of org.python.pydev.editor.refactoring.IPyRefactoring


            req = getRefactoringRequest();
        } catch (MisconfigurationException e2) {
            Log.log(e2);
            return;
        }
        IPyRefactoring pyRefactoring = AbstractPyRefactoring.getPyRefactoring();
        if (areRefactorPreconditionsOK(req, pyRefactoring) == false) {
            return;
        }

        UIJob job = new UIJob("Performing: " + this.getClass().getName()) {
View Full Code Here


                callsToCheck.put(callString, call);
            }

            CONTINUE_FOR: for (Map.Entry<String, TddPossibleMatches> entry : callsToCheck.entrySet()) {
                //we have at least something as SomeClass(a=2,c=3) or self.bar or self.foo.bar() or just foo.bar, etc.
                IPyRefactoring pyRefactoring = AbstractPyRefactoring.getPyRefactoring();
                try {
                    TddPossibleMatches possibleMatch = entry.getValue();
                    String callWithoutParens = entry.getKey();

                    ItemPointer[] pointers = null;
                    PySelection callPs = null;
                    TddPossibleMatches lastPossibleMatchNotFound = possibleMatch;
                    String lastCallWithoutParensNotFound = callWithoutParens;

                    for (int i = 0; i < 10; i++) { //more than 10 attribute accesses in a line? No way!

                        lastPossibleMatchNotFound = possibleMatch;
                        lastCallWithoutParensNotFound = callWithoutParens;
                        if (i > 0) {
                            //We have to take 1 level out of the match... i.e.: if it was self.foo.get(), search now for self.foo.
                            String line = FullRepIterable.getWithoutLastPart(possibleMatch.full);
                            List<TddPossibleMatches> tddPossibleMatchesAtLine = ps.getTddPossibleMatchesAtLine(line);
                            if (tddPossibleMatchesAtLine.size() > 0) {
                                possibleMatch = tddPossibleMatchesAtLine.get(0);
                                callWithoutParens = possibleMatch.initialPart + possibleMatch.secondPart;
                            } else {
                                continue CONTINUE_FOR;
                            }
                        }
                        String full = possibleMatch.full;
                        int indexOf = lineContents.indexOf(full);
                        if (indexOf < 0) {
                            Log.log("Did not expect index < 0.");
                            continue CONTINUE_FOR;
                        }
                        callPs = new PySelection(ps.getDoc(), ps.getLineOffset() + indexOf + callWithoutParens.length());

                        RefactoringRequest request = new RefactoringRequest(f, callPs, null, nature, edit);
                        //Don't look in additional info.
                        request.setAdditionalInfo(
                                AstEntryRefactorerRequestConstants.FIND_DEFINITION_IN_ADDITIONAL_INFO, false);
                        pointers = pyRefactoring.findDefinition(request);

                        if (((pointers != null && pointers.length > 0) || StringUtils.count(possibleMatch.full, '.') <= 1)) {
                            break;
                        }
                    }
View Full Code Here

     * @return an array of ItemPointer with the definitions found
     * @throws MisconfigurationException
     * @throws TooManyMatchesException
     */
    public ItemPointer[] findDefinition(PyEdit pyEdit) throws TooManyMatchesException, MisconfigurationException {
        IPyRefactoring pyRefactoring = AbstractPyRefactoring.getPyRefactoring();
        return pyRefactoring.findDefinition(getRefactoringRequest());
    }
View Full Code Here

        }
      }

    // find declaration
    }else{
      IPyRefactoring pyRefactoring = AbstractPyRefactoring.getPyRefactoring();
      ItemPointer[] defs = pyRefactoring.findDefinition(request);

      for (ItemPointer item : defs){
        if (item.file == null || item.file.toString().endsWith(".so")){
          continue;
        }
View Full Code Here

            SimpleNode ast = request.getAST();
            if (ast == null) {
                status.addFatalError("AST not generated (syntax error).");
                return status;
            }
            IPyRefactoring pyRefactoring = AbstractPyRefactoring.getPyRefactoring();
            request.communicateWork("Finding definition");
            ItemPointer[] pointers = pyRefactoring.findDefinition(request);

            process = new ArrayList<IRefactorRenameProcess>();

            if (pointers.length == 0) {
                // no definition found
View Full Code Here

                            InterruptedException {
                        try {
                            final HierarchyNodeModel model;

                            //set whatever is needed for the hierarchy
                            IPyRefactoring pyRefactoring = AbstractPyRefactoring.getPyRefactoring();
                            if (pyRefactoring instanceof IPyRefactoring2) {
                                RefactoringRequest refactoringRequest = getRefactoringRequest(monitor);
                                IPyRefactoring2 r2 = (IPyRefactoring2) pyRefactoring;
                                model = r2.findClassHierarchy(refactoringRequest, false);
View Full Code Here

TOP

Related Classes of org.python.pydev.editor.refactoring.IPyRefactoring

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.