Package org.python.pydev.core

Examples of org.python.pydev.core.IModulesManager


     * End a request for an ast manager (end caching things)
     */
    public void endRequests() {
        synchronized (modulesManagerStackLock) {
            try {
                IModulesManager modulesManager = modulesManagerStack.pop();
                modulesManager.endCompletionCache();
            } catch (EmptyStackException e) {
                Log.log(e);
            }
        }
    }
View Full Code Here


        //add itself 1st
        list.add(this);

        //get the projects 1st
        if (project != null) {
            IModulesManager javaModulesManagerForProject = JavaProjectModulesManagerCreator
                    .createJavaProjectModulesManagerIfPossible(project);

            if (javaModulesManagerForProject != null) {
                list.add(javaModulesManagerForProject);
            }
View Full Code Here

        for (IProject project : projects) {
            PythonNature nature = PythonNature.getPythonNature(project);
            if (nature != null) {
                ICodeCompletionASTManager otherProjectAstManager = nature.getAstManager();
                if (otherProjectAstManager != null) {
                    IModulesManager projectModulesManager = otherProjectAstManager.getModulesManager();
                    if (projectModulesManager != null) {
                        list.add((IModulesManager) projectModulesManager);
                    }
                } else {
                    String msg = "No ast manager configured for :" + project.getName();
                    Log.log(IStatus.WARNING, msg, new RuntimeException(msg));
                }
            }
            IModulesManager javaModulesManagerForProject = JavaProjectModulesManagerCreator
                    .createJavaProjectModulesManagerIfPossible(project);
            if (javaModulesManagerForProject != null) {
                list.add(javaModulesManagerForProject);
            }
        }
View Full Code Here

     * This function creates a module and resolves the module name (use this function if only the file is available).
     * @throws MisconfigurationException
     */
    public static IModule createModuleFromDoc(File file, IDocument doc, IPythonNature pythonNature)
            throws MisconfigurationException {
        IModulesManager projModulesManager = pythonNature.getAstManager().getModulesManager();
        String moduleName = null;
        if (file != null) {
            moduleName = projModulesManager.resolveModule(FileUtils.getFileAbsolutePath(file));
        }
        if (moduleName == null) {
            moduleName = MODULE_NAME_WHEN_FILE_IS_UNDEFINED;
        }
        IModule module = createModuleFromDoc(moduleName, file, doc, pythonNature, false);
View Full Code Here

            return;
        }

        Image img = PyCodeCompletionImages.getImageForType(IToken.TYPE_PACKAGE);

        IModulesManager modulesManager = astManager.getModulesManager();
        try {
            if (modulesManager == null) {
                nature.getProjectInterpreter(); //Just getting it here is likely to raise an error if it's not well configured.
            }

            if (getSystem) {
                modulesManager = modulesManager.getSystemModulesManager();
                if (modulesManager == null) {
                    nature.getProjectInterpreter(); //Just getting it here is likely to raise an error if it's not well configured.
                }
            }
        } catch (PythonNatureWithoutProjectException e) {
            throw new RuntimeException(e);
        } catch (MisconfigurationException e) {
            throw new RuntimeException(e);
        }

        String lowerQual = qual.toLowerCase();
        Set<String> allModuleNames = modulesManager.getAllModuleNames(false, lowerQual);

        FastStringBuffer realImportRep = new FastStringBuffer();
        FastStringBuffer displayString = new FastStringBuffer();
        HashSet<String> alreadyFound = new HashSet<String>();
View Full Code Here

            }
            String initialModule = request.resolveModule();

            Image img = PyCodeCompletionImages.getImageForType(IToken.TYPE_PACKAGE);

            IModulesManager projectModulesManager = astManager.getModulesManager();

            String lowerQual = request.qualifier.toLowerCase();
            Set<String> allModuleNames = projectModulesManager.getAllModuleNames(true, lowerQual);

            FastStringBuffer realImportRep = new FastStringBuffer();
            FastStringBuffer displayString = new FastStringBuffer();
            HashSet<String> importedNames = getImportedNames(state);
View Full Code Here

        IProject project = resource.getProject();
        PythonNature nature = PythonNature.getPythonNature(project);
        if (project != null && nature != null) {
            ICodeCompletionASTManager astManager = nature.getAstManager();
            if (astManager != null) {
                IModulesManager modulesManager = astManager.getModulesManager();
                return modulesManager.isInPythonPath(resource, project);
            }
        }

        return false;
    }
View Full Code Here

                        return IPythonNature.GRAMMAR_PYTHON_VERSION_CYTHON;
                    }
                };
            }
            if (pythonModuleManager != null) {
                IModulesManager modulesManager = pythonModuleManager.getIModuleManager();
                if (modulesManager != null) {
                    String modName = modulesManager.resolveModule(FileUtils.getFileAbsolutePath(file));
                    if (modName != null) {
                        IModule module = modulesManager.getModule(modName, nature, true);
                        if (module instanceof ISourceModule) {
                            SourceModule iSourceModule = (SourceModule) module;
                            if (iSourceModule.parseError != null) {
                                throw iSourceModule.parseError;
                            }
View Full Code Here

        assertTrue(nature != null);
        assertTrue(nature.getAstManager() != null);
    }

    protected void waitForModulesManagerSetup() {
        final IModulesManager modulesManager = PythonNature.getPythonNature(mod1).getAstManager().getModulesManager();
        goToIdleLoopUntilCondition(

                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>() {
                    public String call(Object arg) {
                        SortedMap<ModulesKey, ModulesKey> allDirectModulesStartingWith = modulesManager
                                .getAllDirectModulesStartingWith("pack1");
                        Set<ModulesKey> keySet = allDirectModulesStartingWith.keySet();
                        return "Found: " + keySet;
                    }
                });
View Full Code Here

TOP

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

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.