Package org.python.pydev.plugin.nature

Examples of org.python.pydev.plugin.nature.SystemPythonNature


            } catch (MisconfigurationException e) {
                throw e;
            } catch (PythonNatureWithoutProjectException e) {
                throw new RuntimeException(e);
            }
            ret.add(new Tuple<AbstractAdditionalTokensInfo, IPythonNature>(systemInfo, new SystemPythonNature(nature
                    .getRelatedInterpreterManager())));
        }

        //get for the current project
        if (project != null) {
View Full Code Here


                                pythonNatures.add(pythonNature);
                            }

                        } else if (additional.additionalInfo instanceof AdditionalSystemInterpreterInfo) {
                            AdditionalSystemInterpreterInfo systemInterpreterInfo = (AdditionalSystemInterpreterInfo) additional.additionalInfo;
                            SystemPythonNature pythonNature = new SystemPythonNature(systemInterpreterInfo.getManager());
                            pythonNatures = new ArrayList<IPythonNature>();
                            pythonNatures.add(pythonNature);
                        }
                    } catch (Throwable e) {
                        Log.log(e);
                    }
                    entry = additional.info;

                } else {
                    entry = (IInfo) obj;
                }
                List<ItemPointer> pointers = new ArrayList<ItemPointer>();

                CompletionCache completionCache = new CompletionCache();
                for (IPythonNature pythonNature : pythonNatures) {
                    //try to find in one of the natures...
                    ICodeCompletionASTManager astManager = pythonNature.getAstManager();
                    if (astManager == null) {
                        continue;
                    }
                    AnalysisPlugin.getDefinitionFromIInfo(pointers, astManager, pythonNature, entry, completionCache);
                    if (pointers.size() > 0) {
View Full Code Here

            }
        }

        if (pythonInterpreterManager2.isConfigured()) {
            try {
                return new Tuple<IPythonNature, String>(new SystemPythonNature(pythonInterpreterManager2),
                        getModNameFromFile(file));
            } catch (MisconfigurationException e) {
            }
        }

        if (jythonInterpreterManager2.isConfigured()) {
            try {
                return new Tuple<IPythonNature, String>(new SystemPythonNature(jythonInterpreterManager2),
                        getModNameFromFile(file));
            } catch (MisconfigurationException e) {
            }
        }

        if (ironpythonInterpreterManager2.isConfigured()) {
            try {
                return new Tuple<IPythonNature, String>(new SystemPythonNature(ironpythonInterpreterManager2),
                        getModNameFromFile(file));
            } catch (MisconfigurationException e) {
            }
        }
View Full Code Here

        if (pythonInterpreterManager != null) {
            if (pythonInterpreterManager.isConfigured()) {
                IInterpreterInfo[] interpreterInfos = pythonInterpreterManager.getInterpreterInfos();
                for (IInterpreterInfo iInterpreterInfo : interpreterInfos) {
                    try {
                        SystemPythonNature systemPythonNature = new SystemPythonNature(pythonInterpreterManager,
                                iInterpreterInfo);
                        String modName = systemPythonNature.resolveModule(file);
                        if (modName != null) {
                            return new Tuple<IPythonNature, String>(systemPythonNature, modName);
                        }
                    } catch (Exception e) {
                        // that's ok
View Full Code Here

            IPythonNature nature = edit.getPythonNature();

            if (nature == null) {
                IInterpreterManager manager = ChooseInterpreterManager.chooseInterpreterManager();
                if (manager != null) {
                    nature = new SystemPythonNature(manager);
                } else {
                    CompletionError completionError = new CompletionError(new RuntimeException(
                            "No interpreter configured."));
                    this.error = completionError.getErrorMessage();
                    return new ICompletionProposal[] { completionError };
View Full Code Here

    }

    public IPythonNature getNature() {
        if (nature == null) {
            IInterpreterManager manager = getInterpreterManager();
            nature = new SystemPythonNature(manager, this.info);
        }
        return nature;
    }
View Full Code Here

    }

    protected void discoverDefaultVersion(final String projectType, final String projectInterpreter) {
        defaultVersion = DJANGO_14; //It should be discovered below, but if not found for some reason, this will be the default.

        SystemPythonNature nature;
        try {
            final int interpreterType = PythonNature.getInterpreterTypeFromVersion(projectType);
            IInterpreterManager interpreterManagerFromType = PydevPlugin.getInterpreterManagerFromType(interpreterType);
            IInterpreterInfo interpreterInfo;
            if (IPythonNature.DEFAULT_INTERPRETER.equals(projectInterpreter)) {
                interpreterInfo = interpreterManagerFromType.getDefaultInterpreterInfo(false);

            } else {
                interpreterInfo = interpreterManagerFromType.getInterpreterInfo(projectInterpreter, null);

            }
            nature = new SystemPythonNature(interpreterManagerFromType, interpreterInfo);
            AbstractRunner runner = UniversalRunner.getRunner(nature);

            Tuple<String, String> output = runner.runCodeAndGetOutput(GET_DJANGO_VERSION, new String[] {}, null,
                    new NullProgressMonitor());
View Full Code Here

                "    m1 = B()\n" +
                "    def foo(self):\n" +
                "        self.m1." +
                "";

        SystemPythonNature nature = new SystemPythonNature(PyCodeCompletion2Test.nature.getRelatedInterpreterManager());
        PySelection ps = new PySelection(new Document(s), s.length() - 1);
        ICompletionState state = new CompletionState(ps.getStartLineIndex(), ps.getAbsoluteCursorOffset()
                - ps.getStartLine().getOffset(), null, nature, "");
        CompletionRequest request = new CompletionRequest(null, nature, ps.getDoc(), "self.m1",
                ps.getAbsoluteCursorOffset(), 0, new PyCodeCompletion(), "");
View Full Code Here

TOP

Related Classes of org.python.pydev.plugin.nature.SystemPythonNature

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.