Package org.python.pydev.editor.codecompletion.revisited

Examples of org.python.pydev.editor.codecompletion.revisited.CompletionCache


                "print swing.JFrame()";

        Document doc = new Document(d);
        IModule module = AbstractModule.createModuleFromDoc("", null, doc, nature, true);
        Definition[] defs = (Definition[]) module.findDefinition(
                CompletionStateFactory.getEmptyCompletionState("swing.JFrame", nature, new CompletionCache()), 2, 7,
                nature);

        assertEquals(1, defs.length);
        assertEquals("", defs[0].value);
        assertTrue(defs[0].module instanceof JavaZipModule);
View Full Code Here


                "import java.lang.Class";

        Document doc = new Document(d);
        IModule module = AbstractModule.createModuleFromDoc("", null, doc, nature, true);
        Definition[] defs = (Definition[]) module.findDefinition(
                CompletionStateFactory.getEmptyCompletionState("java.lang.Class", nature, new CompletionCache()), 1,
                20, nature);

        assertEquals(1, defs.length);
        assertEquals("", defs[0].value);
        assertTrue(defs[0].module instanceof JavaZipModule);
View Full Code Here

                "java.lang.Class.asSubclass";

        Document doc = new Document(d);
        IModule module = AbstractModule.createModuleFromDoc("", null, doc, nature, true);
        Definition[] defs = (Definition[]) module.findDefinition(CompletionStateFactory.getEmptyCompletionState(
                "java.lang.Class.asSubclass", nature, new CompletionCache()), 2, 20, nature);

        assertEquals(1, defs.length);
        assertEquals("asSubclass", defs[0].value);
        assertTrue(defs[0].module instanceof JavaZipModule);
        IJavaElement javaElement = ((JavaDefinition) defs[0]).javaElement;
View Full Code Here

        String file = TestDependent.TEST_PYSRC_LOC +
                "testrec3/rec.py";
        String strDoc = "RuntimeError.";
        File f = new File(file);
        ICompletionState state = CompletionStateFactory.getEmptyCompletionState("RuntimeError", nature,
                new CompletionCache());
        IModule module = AbstractASTManager.createModule(f, new Document(FileUtils.getFileContents(f)), nature);
        try {
            nature.getAstManager().getCompletionsForModule(module, state, true, true);
        } catch (CompletionRecursionException e) {
            //that's ok... we're asking for it here...
View Full Code Here

    public void testFindDefinition() throws Exception {
        isInTestFindDefinition = true;
        try {
            CompiledModule mod = new CompiledModule("os", nature.getAstManager().getModulesManager());
            Definition[] findDefinition = mod.findDefinition(
                    CompletionStateFactory.getEmptyCompletionState("walk", nature, new CompletionCache()), -1, -1,
                    nature);
            assertEquals(1, findDefinition.length);
            assertEquals("os", findDefinition[0].module.getName());
        } finally {
            isInTestFindDefinition = false;
View Full Code Here

     * @param module the module we're analyzing right now
     * @return a list with the references that point to the definition we're renaming.
     */
    protected List<ASTEntry> getOccurrencesInOtherModule(RefactoringStatus status, String initialName,
            SourceModule module, PythonNature nature) {
        CompletionCache completionCache = new CompletionCache();
        List<ASTEntry> entryOccurrences = findReferencesOnOtherModule(status, initialName, module);

        //Removed this check: it made subclasses work badly, also, in Python because of duck-typing, many of those
        //matches are actually wanted.
        //
View Full Code Here

        int col = definition.call.beginColumn;

        IDefinition[] definitions;
        try {
            definitions = definition.module.findDefinition(CompletionStateFactory.getEmptyCompletionState(tok, nature,
                    line - 1, col - 1, new CompletionCache()), line, col, nature);

        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        if (definitions != null && definitions.length > 0) {
View Full Code Here

            if (found.importInfo == null) {
                throw new RuntimeException("Expecting import info from the found entry.");
            }
            if (found.importInfo.wasResolved) {
                Definition d = found.importInfo
                        .getModuleDefinitionFromImportInfo(request.nature, new CompletionCache());
                if (d == null || d.module == null) {
                    status.addFatalError(com.aptana.shared_core.string.StringUtils.format("Unable to find the definition for the module."));
                    return;
                }
                if (!(d.module instanceof SourceModule)) {
View Full Code Here

TOP

Related Classes of org.python.pydev.editor.codecompletion.revisited.CompletionCache

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.