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

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


                MarkOccurrencesJob.getRefactorAction(pyEdit), ps);
        if (monitor.isCanceled()) {
            return false;
        }

        PyRenameEntryPoint processor = new PyRenameEntryPoint(req);

        //process it to get what we need
        processor.checkInitialConditions(monitor);
        processor.checkFinalConditions(monitor, null);
        HashSet<ASTEntry> occurrences = processor.getOccurrences();

        if (monitor.isCanceled()) {
            return false;
        }
View Full Code Here


        if (req == null || !req.nature.getRelatedInterpreterManager().isConfigured()) { //we check if it's configured because it may still be a stub...
            return new Tuple3<RefactoringRequest, PyRenameEntryPoint, Boolean>(null, null, false);
        }

        PyRenameEntryPoint processor = new PyRenameEntryPoint(req);
        //to see if a new request was not created in the meantime (in which case this one will be cancelled)
        if (currRequestTime != lastRequestTime || monitor.isCanceled()) {
            return new Tuple3<RefactoringRequest, PyRenameEntryPoint, Boolean>(null, null, false);
        }

        try {
            processor.checkInitialConditions(monitor);
            if (currRequestTime != lastRequestTime || monitor.isCanceled()) {
                return new Tuple3<RefactoringRequest, PyRenameEntryPoint, Boolean>(null, null, false);
            }

            processor.checkFinalConditions(monitor, null);
            if (currRequestTime != lastRequestTime || monitor.isCanceled()) {
                return new Tuple3<RefactoringRequest, PyRenameEntryPoint, Boolean>(null, null, false);
            }

            //ok, pre-conditions suceeded
View Full Code Here

     *
     * @see org.python.pydev.editor.refactoring.IPyRefactoring#rename(org.python.pydev.editor.refactoring.RefactoringRequest)
     */
    public String rename(RefactoringRequest request) {
        try {
            RenameRefactoring renameRefactoring = new RenameRefactoring(new PyRenameEntryPoint(request));
            request.fillInitialNameAndOffset();
            final PyRenameRefactoringWizard wizard = new PyRenameRefactoringWizard(renameRefactoring, "Rename",
                    "inputPageDescription", request, request.initialName);
            try {
                RefactoringWizardOpenOperation op = new RefactoringWizardOpenOperation(wizard);
View Full Code Here

        return new RefactorerFinds(this).findClassHierarchy(request, findOnlyParents);
    }

    public Map<Tuple<String, File>, HashSet<ASTEntry>> findAllOccurrences(RefactoringRequest req)
            throws OperationCanceledException, CoreException {
        PyRenameEntryPoint processor = new PyRenameEntryPoint(req);
        //to see if a new request was not created in the meantime (in which case this one will be cancelled)
        req.checkCancelled();

        IProgressMonitor monitor = req.getMonitor();

        Map<Tuple<String, File>, HashSet<ASTEntry>> occurrencesInOtherFiles;

        try {
            monitor.beginTask("Find all occurrences", 100);
            monitor.setTaskName("Find all occurrences");
            RefactoringStatus status;
            try {
                req.pushMonitor(new SubProgressMonitor(monitor, 10));
                status = processor.checkInitialConditions(req.getMonitor());
                if (status.getSeverity() == RefactoringStatus.FATAL) {
                    return null;
                }
            } finally {
                req.popMonitor().done();
            }
            req.checkCancelled();
            try {
                req.pushMonitor(new SubProgressMonitor(monitor, 85));
                status = processor.checkFinalConditions(req.getMonitor(), null, false);
                if (status.getSeverity() == RefactoringStatus.FATAL) {
                    return null;
                }
            } finally {
                req.popMonitor().done();
            }
            req.checkCancelled();
            occurrencesInOtherFiles = processor.getOccurrencesInOtherFiles();
            HashSet<ASTEntry> occurrences = processor.getOccurrences();
            occurrencesInOtherFiles.put(new Tuple<String, File>(req.moduleName, req.pyEdit.getEditorFile()),
                    occurrences);

            req.getMonitor().worked(5);
        } finally {
View Full Code Here

    }

    /** Applies a rename refactoring
     */
    protected void applyRenameRefactoring(RefactoringRequest request, boolean expectError) throws CoreException {
        PyRenameEntryPoint processor = new PyRenameEntryPoint(request);
        NullProgressMonitor nullProgressMonitor = new NullProgressMonitor();
        checkStatus(processor.checkInitialConditions(nullProgressMonitor), expectError);
        checkStatus(processor.checkFinalConditions(nullProgressMonitor, null), expectError);
        Change change = processor.createChange(nullProgressMonitor);
        if (!expectError) {
            //otherwise, if there is an error, the change may be null
            change.perform(nullProgressMonitor);
        }
    }
View Full Code Here

            RefactoringRequest request = new RefactoringRequest(null, ps, natureRefactoring);
            request.setAdditionalInfo(AstEntryRefactorerRequestConstants.FIND_REFERENCES_ONLY_IN_LOCAL_SCOPE, false);
            request.moduleName = moduleName;
            request.fillInitialNameAndOffset();

            PyRenameEntryPoint processor = new PyRenameEntryPoint(request);
            NullProgressMonitor nullProgressMonitor = new NullProgressMonitor();
            checkStatus(processor.checkInitialConditions(nullProgressMonitor), expectError);
            lastProcessorUsed = processor;
            checkProcessors();

            checkStatus(processor.checkFinalConditions(nullProgressMonitor, null, false), expectError);
            occurrencesToReturn = processor.getOccurrencesInOtherFiles();
            occurrencesToReturn.put(new Tuple<String, File>(CURRENT_MODULE_IN_REFERENCES, null),
                    processor.getOccurrences());
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

        return occurrencesToReturn;
View Full Code Here

TOP

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

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.