Package org.python.pydev.refactoring.coderefactoring.extractlocal

Examples of org.python.pydev.refactoring.coderefactoring.extractlocal.ExtractLocalRefactoring


public class ExtractLocalAction extends AbstractRefactoringAction {

    @Override
    protected AbstractPythonRefactoring createRefactoring(RefactoringInfo info) {
        return new ExtractLocalRefactoring(info);
    }
View Full Code Here


        IDocument document = new Document(data.source);
        ITextSelection selection = new TextSelection(document, data.sourceSelection.getOffset(),
                data.sourceSelection.getLength());
        IGrammarVersionProvider versionProvider = createVersionProvider();
        RefactoringInfo info = new RefactoringInfo(document, selection, versionProvider);
        ExtractLocalRefactoring refactoring = new ExtractLocalRefactoring(info);

        ExtractLocalRequestProcessor requestProcessor = refactoring.getRequestProcessor();
        requestProcessor.setVariableName("extracted_variable");
        requestProcessor.setReplaceDuplicates(true);

        NullProgressMonitor monitor = new NullProgressMonitor();
        RefactoringStatus result = refactoring.checkAllConditions(monitor);

        assertTrue("Refactoring is not ok: " + result.getMessageMatchingSeverity(RefactoringStatus.WARNING),
                result.isOK());

        Change change = refactoring.createChange(monitor);
        change.perform(monitor);

        assertContentsEqual(data.result, document.get());

        FileUtilsFileBuffer.IN_TESTS = false;
View Full Code Here

TOP

Related Classes of org.python.pydev.refactoring.coderefactoring.extractlocal.ExtractLocalRefactoring

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.