Search in sources :

Example 1 with Refactorer

use of com.python.pydev.analysis.refactoring.refactorer.Refactorer in project Pydev by fabioz.

the class TddCodeGenerationQuickFixParticipantTest method setUp.

/*
     * @see TestCase#setUp()
     */
@Override
public void setUp() throws Exception {
    super.setUp();
    AbstractPyRefactoring.setPyRefactoring(new Refactorer());
    CompiledModule.COMPILED_MODULES_ENABLED = false;
    this.restorePythonPath(TestDependent.getCompletePythonLib(true, isPython3Test()) + "|" + TestDependent.PYTHON2_PIL_PACKAGES + "|" + TestDependent.TEST_PYSRC_TESTING_LOC + "configobj-4.6.0-py2.6.egg", false);
    this.restorePythonPath(false);
    codeCompletion = new PyCodeCompletion();
    TddCodeGenerationQuickFixParticipant.onGetTddPropsError = new ICallback<Boolean, Exception>() {

        @Override
        public Boolean call(Exception e) {
            throw new RuntimeException("Error:" + org.python.pydev.shared_core.log.Log.getExceptionStr(e));
        }
    };
    PyCodeCompletion.onCompletionRecursionException = new ICallback<Object, CompletionRecursionException>() {

        @Override
        public Object call(CompletionRecursionException e) {
            throw new RuntimeException("Recursion error:" + org.python.pydev.shared_core.log.Log.getExceptionStr(e));
        }
    };
}
Also used : CompletionRecursionException(org.python.pydev.core.structure.CompletionRecursionException) PyCodeCompletion(org.python.pydev.ast.codecompletion.PyCodeCompletion) CompletionRecursionException(org.python.pydev.core.structure.CompletionRecursionException) Refactorer(com.python.pydev.analysis.refactoring.refactorer.Refactorer)

Example 2 with Refactorer

use of com.python.pydev.analysis.refactoring.refactorer.Refactorer in project Pydev by fabioz.

the class FindActualDefinitionTest method testOccurrencesForDefinition.

public void testOccurrencesForDefinition() throws Exception {
    int usedGrammar = GRAMMAR_TO_USE_FOR_PARSING;
    GRAMMAR_TO_USE_FOR_PARSING = PythonNature.LATEST_GRAMMAR_PY3_VERSION;
    try {
        File file = new File(TestDependent.TEST_PYSRC_TESTING_LOC + "occurrencesForDefinition/foo.py");
        PySelection selection = new PySelection(new Document(FileUtils.getFileContents(file)), 0, 19, 4);
        Refactorer.setPyRefactoring(new Refactorer());
        RefactoringRequest req = new RefactoringRequest(file, selection, nature);
        req.fillActivationTokenAndQualifier();
        req.setAdditionalInfo(RefactoringRequest.FIND_DEFINITION_IN_ADDITIONAL_INFO, false);
        req.setAdditionalInfo(RefactoringRequest.FIND_REFERENCES_ONLY_IN_LOCAL_SCOPE, true);
        PyReferenceSearcher pyReferenceSearcher = new PyReferenceSearcher(req);
        pyReferenceSearcher.prepareSearch(req);
        pyReferenceSearcher.search(req);
        HashSet<ASTEntry> ref = pyReferenceSearcher.getLocalReferences(req);
        assertEquals(4, ref.size());
    } finally {
        GRAMMAR_TO_USE_FOR_PARSING = usedGrammar;
    }
}
Also used : RefactoringRequest(org.python.pydev.ast.refactoring.RefactoringRequest) PyReferenceSearcher(com.python.pydev.analysis.refactoring.wizards.rename.PyReferenceSearcher) ASTEntry(org.python.pydev.parser.visitors.scope.ASTEntry) PySelection(org.python.pydev.core.docutils.PySelection) Document(org.eclipse.jface.text.Document) File(java.io.File) Refactorer(com.python.pydev.analysis.refactoring.refactorer.Refactorer)

Example 3 with Refactorer

use of com.python.pydev.analysis.refactoring.refactorer.Refactorer in project Pydev by fabioz.

the class ClassHierarchySearchTest method setUp.

@Override
public void setUp() throws Exception {
    CompiledModule.COMPILED_MODULES_ENABLED = true;
    SourceModule.TESTING = true;
    refactorer = new Refactorer();
    if (baseDir != null && !baseDir.exists()) {
        baseDir.mkdirs();
    }
    if (baseDir2 != null && !baseDir2.exists()) {
        baseDir2.mkdirs();
    }
    super.setUp();
}
Also used : Refactorer(com.python.pydev.analysis.refactoring.refactorer.Refactorer)

Example 4 with Refactorer

use of com.python.pydev.analysis.refactoring.refactorer.Refactorer in project Pydev by fabioz.

the class SearchTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    CompiledModule.COMPILED_MODULES_ENABLED = true;
    this.restorePythonPath(false);
    refactorer = new Refactorer();
}
Also used : Refactorer(com.python.pydev.analysis.refactoring.refactorer.Refactorer)

Example 5 with Refactorer

use of com.python.pydev.analysis.refactoring.refactorer.Refactorer in project Pydev by fabioz.

the class RefactoringLocalTestBase method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    CompiledModule.COMPILED_MODULES_ENABLED = getCompiledModulesEnabled();
    this.restorePythonPath(getForceRestorePythonPath());
    AbstractPyRefactoring.setPyRefactoring(new Refactorer());
}
Also used : Refactorer(com.python.pydev.analysis.refactoring.refactorer.Refactorer)

Aggregations

Refactorer (com.python.pydev.analysis.refactoring.refactorer.Refactorer)5 PyReferenceSearcher (com.python.pydev.analysis.refactoring.wizards.rename.PyReferenceSearcher)1 File (java.io.File)1 Document (org.eclipse.jface.text.Document)1 PyCodeCompletion (org.python.pydev.ast.codecompletion.PyCodeCompletion)1 RefactoringRequest (org.python.pydev.ast.refactoring.RefactoringRequest)1 PySelection (org.python.pydev.core.docutils.PySelection)1 CompletionRecursionException (org.python.pydev.core.structure.CompletionRecursionException)1 ASTEntry (org.python.pydev.parser.visitors.scope.ASTEntry)1