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

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


                ret = checkEarlyReturn(monitor, builder);
                if (ret != null) {
                    continue;
                }

                SystemModulesManager modulesManager = (SystemModulesManager) builder.info.getModulesManager();
                PyPublicTreeMap<ModulesKey, ModulesKey> keysFound = modulesManager.buildKeysFromModulesFound(monitor,
                        modulesFound);

                if (DebugSettings.DEBUG_INTERPRETER_AUTO_UPDATE) {
                    Log.toLogFile(this, com.aptana.shared_core.string.StringUtils.format("Found: %s modules", keysFound.size()));
                }
                ret = checkEarlyReturn(monitor, builder);
                if (ret != null) {
                    continue;
                }
                Tuple<List<ModulesKey>, List<ModulesKey>> diffModules = modulesManager.diffModules(keysFound);
                if (diffModules.o1.size() > 0 || diffModules.o2.size() > 0) {
                    if (DebugSettings.DEBUG_INTERPRETER_AUTO_UPDATE) {
                        Log.toLogFile(this, com.aptana.shared_core.string.StringUtils.format("Diff modules. Added: %s Removed: %s", diffModules.o1,
                                diffModules.o2));
                    }

                    //Update the modules manager itself (just pass all the keys as that should be fast)
                    modulesManager.updateKeysAndSave(keysFound);

                    //Now, the additional info can be slower, so, let's work only on the deltas...
                    IInterpreterManager manager = builder.info.getModulesManager().getInterpreterManager();
                    try {
                        AbstractAdditionalDependencyInfo additionalSystemInfo = AdditionalSystemInterpreterInfo
View Full Code Here


        return true;
    }

    @Override
    protected void calculateChildren() throws MisconfigurationException {
        SystemModulesManager m = (SystemModulesManager) this.interpreterInfo.getModulesManager();
        AbstractModule builtinModule = m.getBuiltinModule(forcedLib, true);
        IToken[] globalTokens = builtinModule.getGlobalTokens();

        ArrayList<LeafElement> lst = new ArrayList<LeafElement>();

        for (IToken iToken : globalTokens) {
View Full Code Here

    }

    public InterpreterInfo(String version, String exe, Collection<String> libs0) {
        this.executableOrJar = exe;
        this.version = version;
        ISystemModulesManager modulesManager = new SystemModulesManager(this);

        this.modulesManager = modulesManager;
        libs.addAll(libs0);
    }
View Full Code Here

        codeCompletionTestsBase.restorePythonPath(FileUtils.getFileAbsolutePath(data.file.getParentFile()), true);
        PythonModuleManager pythonModuleManager = new PythonModuleManager(CodeCompletionTestsBase.nature);
        if (version != null) {
            //As the files will be found in the system, we need to set the system modules manager info.
            IModulesManager modulesManager = pythonModuleManager.getIModuleManager();
            SystemModulesManager systemModulesManager = (SystemModulesManager) modulesManager.getSystemModulesManager();
            systemModulesManager.setInfo(new InterpreterInfo(version, "", new ArrayList<String>()));

            CodeCompletionTestsBase.nature.setVersion(version, null);
        }
        ModuleAdapter module = VisitorFactory.createModuleAdapter(pythonModuleManager, data.file, new Document(
                data.source), CodeCompletionTestsBase.nature, CodeCompletionTestsBase.nature);
View Full Code Here

        assertEquals(1 + 1, modulesManager2.getRefencingManagersInvolved(false).length);
        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());

        File f = new File("modules_manager_testing.temporary_dir");
        try {
            FileUtils.deleteDirectoryTree(f);
        } catch (Exception e1) {
            //ignore
        }
        try {
            manager.saveToFile(f);

            SystemModulesManager loaded = new SystemModulesManager(null);
            SystemModulesManager.loadFromFile(loaded, f);
            ModulesKey[] onlyDirectModules = loaded.getOnlyDirectModules();
            boolean found = false;
            for (ModulesKey modulesKey : onlyDirectModules) {
                if (modulesKey.name.equals("zip")) {
                    ModulesKeyForZip z = (ModulesKeyForZip) modulesKey;
                    assertEquals(z.zipModulePath, "path");
                    assertEquals(z.file, new File("zip.zip"));
                    assertEquals(z.isFile, true);
                    found = true;
                }
            }
            if (!found) {
                fail("Did not find ModulesKeyForZip.");
            }
            Set<String> set = new HashSet<String>();
            set.add("bar");
            set.add("foo");
            set.add("empty");
            set.add("zip");
            assertEquals(set, loaded.getAllModuleNames(true, ""));
            assertEquals(Arrays.asList("rara", "boo"), loaded.getPythonPathHelper().getPythonpath());
        } finally {
            FileUtils.deleteDirectoryTree(f);
        }

    }
View Full Code Here

TOP

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

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.