Package org.python.pydev.core

Examples of org.python.pydev.core.ModulesKey


            modulesStartingWith = modulesManager.getAllModulesStartingWith(moduleToGetTokensFrom);
        }

        Iterator<ModulesKey> itModules = modulesStartingWith.keySet().iterator();
        while (itModules.hasNext()) {
            ModulesKey key = itModules.next();

            String element = key.name;
            //            if (element.startsWith(moduleToGetTokensFrom)) { we don't check that anymore because we get all the modules starting with it already
            if (onlyFilesOnSameLevel && key.file != null && key.file.isDirectory()) {
                continue; // we only want those that are in the same directory, and not in other directories...
View Full Code Here


    public CompleteIndexKey(ModulesKey key) {
        this.key = key;
    }

    public CompleteIndexKey(String name) {
        this(new ModulesKey(name, null));
    }
View Full Code Here

        try {
            additionalInfo = AdditionalProjectInterpreterInfo.getAdditionalInfoForProject(natureToAdd);
        } catch (MisconfigurationException e) {
            throw new RuntimeException(e);
        }
        additionalInfo.addAstInfo(ast, new ModulesKey(modName, f), false);
        ModulesManager modulesManager = (ModulesManager) natureToAdd.getAstManager().getModulesManager();
        SourceModule mod = (SourceModule) AbstractModule.createModule(ast, f, modName);
        modulesManager.doAddSingleModule(new ModulesKey(modName, f), mod);
    }
View Full Code Here

        File tempFileAt = FileUtils.getTempFileAt(baseDir, "data_temporary_file_on_additional_interpreter_info_test", ".py");
        FileUtils.writeStrToFile(doc, tempFileAt);
        try {
            SourceModule module = (SourceModule) AbstractModule.createModuleFromDoc("test", tempFileAt, new Document(
                    doc), nature, true);
            info.addAstInfo(module.getAst(), new ModulesKey("test", tempFileAt), false);

            List<ModulesKey> modulesWithTokensStartingWith = null;

            modulesWithTokensStartingWith = info.getModulesWithToken("mmm", null);
            assertEquals(1, modulesWithTokensStartingWith.size());
View Full Code Here

        FileUtils.writeStrToFile("", f);
        addFooModule(new Module(new stmtType[0]), f);
        info = AdditionalInfoIntegrityChecker.checkIntegrity(nature, monitor, false);
        assertFalse(info.allOk);
        assertEquals(1, info.modulesNotInDisk.size());
        assertEquals(info.modulesNotInDisk.get(0), new ModulesKey("foo", null));

        fixAndCheckAllOk(info);
    }
View Full Code Here

                    notInMemo.append(key);
                    notInMemo.append("\n");
                }
                fail(notInMemo.toString());
            }
            assertEquals(info.modulesNotInMemory.get(0), new ModulesKey(MOD_NAME, file));

            fixAndCheckAllOk(info);
        } finally {
            file.delete();
        }

        IntegrityInfo info = AdditionalInfoIntegrityChecker.checkIntegrity(nature, monitor, false);
        assertFalse(info.allOk);
        assertEquals(1, info.modulesNotInDisk.size());
        assertEquals(info.modulesNotInDisk.get(0), new ModulesKey(MOD_NAME, null));

        fixAndCheckAllOk(info);

    }
View Full Code Here

        assertEquals(2 + 1, modulesManager2.getRefencingManagersInvolved(true).length);
    }

    public void testLoad() throws Exception {
        SystemModulesManager manager = new SystemModulesManager(null);
        manager.addModule(new ModulesKey("bar", new File("bar.py")));
        manager.addModule(new ModulesKey("foo", new File("foo.py")));
        manager.addModule(new ModulesKey("empty", null));
        manager.addModule(new ModulesKeyForZip("zip", new File("zip.zip"), "path", true));

        PythonPathHelper pythonPathHelper = manager.getPythonPathHelper();
        pythonPathHelper.setPythonPath("rara|boo");
        assertEquals(Arrays.asList("rara", "boo"), manager.getPythonPathHelper().getPythonpath());
View Full Code Here

        intToString.put(0, "W.py");
        ModulesManager.handleFileContents(manager, contents, intToString);

        assertEquals(3, manager.modulesKeys.size());

        ModulesKey key = manager.modulesKeys.get(new ModulesKey("A", null));
        assertEquals(key, new ModulesKey("A", null));
        assertEquals(key.file, new File("A.py"));
        assertTrue(!(key instanceof ModulesKeyForZip));

        key = manager.modulesKeys.get(new ModulesKey("B", null));
        assertEquals(key, new ModulesKey("B", null));
        assertNull(key.file);
        assertTrue(!(key instanceof ModulesKeyForZip));

        key = manager.modulesKeys.get(new ModulesKey("D", null));
        assertEquals(key, new ModulesKey("D", null));
        assertEquals(key.file, new File("W.py"));
        assertTrue(key instanceof ModulesKeyForZip);
        ModulesKeyForZip kz = (ModulesKeyForZip) key;
        assertTrue(kz.isFile);
        assertEquals(kz.zipModulePath, "E");
View Full Code Here

        intToString.put(0, "W.py");
        ModulesManager.handleFileContents(manager, contents, intToString);

        assertEquals(3, manager.modulesKeys.size());

        ModulesKey key = manager.modulesKeys.get(new ModulesKey("A", null));
        assertEquals(key, new ModulesKey("A", null));
        assertEquals(key.file, new File("A.py"));
        assertTrue(!(key instanceof ModulesKeyForZip));

        key = manager.modulesKeys.get(new ModulesKey("B", null));
        assertEquals(key, new ModulesKey("B", null));
        assertNull(key.file);
        assertTrue(!(key instanceof ModulesKeyForZip));

        key = manager.modulesKeys.get(new ModulesKey("D", null));
        assertEquals(key, new ModulesKey("D", null));
        assertEquals(key.file, new File("W.py"));
        assertTrue(key instanceof ModulesKeyForZip);
        ModulesKeyForZip kz = (ModulesKeyForZip) key;
        assertTrue(kz.isFile);
        assertEquals(kz.zipModulePath, "E");
View Full Code Here

                new ICallback<Boolean, Object>() {
                    public Boolean call(Object arg) {
                        SortedMap<ModulesKey, ModulesKey> allDirectModulesStartingWith = modulesManager.getAllDirectModulesStartingWith("pack1");
                        Set<ModulesKey> keySet = allDirectModulesStartingWith.keySet();
                        HashSet<ModulesKey> expected = new HashSet<ModulesKey>();
                        expected.add(new ModulesKey("pack1.__init__", null));
                        expected.add(new ModulesKey("pack1.pack2.__init__", null));
                        expected.add(new ModulesKey("pack1.pack2.mod1", null));
                        return expected.equals(keySet);
                    }
                },

                new ICallback<String, Object>() {
View Full Code Here

TOP

Related Classes of org.python.pydev.core.ModulesKey

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.