Examples of PythonNature


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

     *
     * @return the children (an array of IWrappedResources)
     */
    private Object[] getChildrenForIWrappedResource(IWrappedResource wrappedResourceParent) {
        //------------------------------------------------------------------- get python nature
        PythonNature nature = null;
        Object[] childrenToReturn = null;
        Object obj = wrappedResourceParent.getActualObject();
        IProject project = null;
        if (obj instanceof IResource) {
            IResource resource = (IResource) obj;
            project = resource.getProject();
            if (project != null && project.isOpen()) {
                nature = PythonNature.getPythonNature(project);
            }
        }

        //------------------------------------------------------------------- treat python nodes
        if (wrappedResourceParent instanceof PythonNode) {
            PythonNode node = (PythonNode) wrappedResourceParent;
            childrenToReturn = getChildrenFromParsedItem(wrappedResourceParent, node.entry, node.pythonFile);

            //------------------------------------- treat python files (add the classes/methods,etc)
        } else if (wrappedResourceParent instanceof PythonFile) {
            // if it's a file, we want to show the classes and methods
            PythonFile file = (PythonFile) wrappedResourceParent;
            if (PythonPathHelper.isValidSourceFile(file.getActualObject())) {

                if (nature != null) {
                    ICodeCompletionASTManager astManager = nature.getAstManager();
                    //the nature may still not be completely restored...
                    if (astManager != null) {
                        IModulesManager modulesManager = astManager.getModulesManager();

                        if (modulesManager instanceof IProjectModulesManager) {
View Full Code Here

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

                                }
                            }
                        }

                        for (IProject project : notifyRebuilt) {
                            PythonNature nature = PythonNature.getPythonNature(project);
                            if (nature != null) {
                                notifyPythonPathRebuilt(project, nature);
                            }
                        }
                    } finally {
View Full Code Here

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

     * @throws MisconfigurationException
     */
    public static String getPythonpathFromConfiguration(ILaunchConfiguration conf, IInterpreterManager manager)
            throws CoreException, InvalidRunException, MisconfigurationException {
        IProject p = getProjectFromConfiguration(conf);
        PythonNature pythonNature = PythonNature.getPythonNature(p);
        if (pythonNature == null) {
            throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Project should have a python nature: "
                    + p.getName(), null));
        }
        IInterpreterInfo l = getInterpreterLocation(conf, pythonNature, manager);
View Full Code Here

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

                if (checkIfShouldBeSet(variableSubstitution, newVariableSubstitution)) {
                    pythonPathNature.setVariableSubstitution(newVariableSubstitution);
                    changed = true;
                }

                PythonNature pythonNature = PythonNature.getPythonNature(project);
                if (pythonNature != null && (changed || force || pythonNature.getAstManager() == null)) {
                    pythonNature.rebuildPath();
                }

            } catch (Exception e) {
                Log.log(IStatus.ERROR, "Unexpected error setting project properties", e);
            }
View Full Code Here

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

        setSelected();
        return contents;
    }

    private void setSelected() {
        PythonNature pythonNature = PythonNature.getPythonNature(getProject());
        try {
            //Set whether it's Python/Jython
            String version = pythonNature.getVersion();
            if (IPythonNature.Versions.ALL_PYTHON_VERSIONS.contains(version)) {
                projectConfig.radioPy.setSelection(true);

            } else if (IPythonNature.Versions.ALL_IRONPYTHON_VERSIONS.contains(version)) {
                projectConfig.radioIron.setSelection(true);

            } else if (IPythonNature.Versions.ALL_JYTHON_VERSIONS.contains(version)) {
                projectConfig.radioJy.setSelection(true);
            }

            //We must set the grammar version too (that's from a string in the format "Python 2.4" and we only want
            //the version).
            String v = StringUtils.split(version, ' ').get(1);
            projectConfig.comboGrammarVersion.setText(v);

            //Update interpreter
            projectConfig.selectionListener.widgetSelected(null);
            String configuredInterpreter = pythonNature.getProjectInterpreterName();
            if (configuredInterpreter != null) {
                projectConfig.interpretersChoice.setText(configuredInterpreter);
            }

        } catch (CoreException e) {
View Full Code Here

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

    private boolean doIt() {
        IProject project = getProject();

        if (project != null) {
            PythonNature pythonNature = PythonNature.getPythonNature(project);

            try {
                String projectInterpreter = projectConfig.getProjectInterpreter();
                if (projectInterpreter == null) {
                    return false;
                }
                pythonNature.setVersion(projectConfig.getSelectedPythonOrJythonAndGrammarVersion(), projectInterpreter);
            } catch (CoreException e) {
                Log.log(e);
            }
        }
        return true;
View Full Code Here

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

            if (this.fWorkingCopyForCommandLineGeneration != null) {
                try {
                    //could throw core exception if project does not exist.
                    IProject project = PythonRunnerConfig
                            .getProjectFromConfiguration(this.fWorkingCopyForCommandLineGeneration);
                    PythonNature nature = PythonNature.getPythonNature(project);
                    if (nature != null) {
                        return PydevPlugin.getInterpreterManager(nature);
                    }
                } catch (Exception e) {
                    Log.log(e);
View Full Code Here

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

     * Given a Path from the 1st child of the project, will try to create that path in the python model.
     * @param project the project
     * @param found a stack so that the last element added is the leaf of the path we want to discover
     */
    private void tryCreateModelFromProject(IProject project, FastStack<Object> found) {
        PythonNature nature = PythonNature.getPythonNature(project);
        if (nature == null) {
            return;//if the python nature is not available, we won't have any python elements here
        }
        Set<String> sourcePathSet = new HashSet<String>();
        try {
            sourcePathSet = nature.getPythonPathNature().getProjectSourcePathSet(true);
        } catch (CoreException e) {
            Log.log(e);
        }

        Object currentParent = project;
View Full Code Here

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

            if (!(container instanceof IProject)) {
                project = ((IContainer) parent).getProject();
            } else {
                project = (IProject) container;
            }
            PythonNature nature = PythonNature.getPythonNature(project);
            if (nature != null) {
                //check for source folder
                Set<String> sourcePathSet = nature.getPythonPathNature().getProjectSourcePathSet(true);
                PythonSourceFolder newSourceFolder = tryWrapSourceFolder(parent, container, sourcePathSet);
                if (newSourceFolder != null) {
                    return newSourceFolder;
                }
            }
View Full Code Here

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

                        IFolder folder = (IFolder) res;
                        IProject project = folder.getProject();
                        if (project == null) {
                            continue;
                        }
                        PythonNature nature = PythonNature.getPythonNature(project);
                        if (nature == null) {
                            continue;
                        }
                        Set<String> sourcePathSet = new HashSet<String>();
                        try {
                            sourcePathSet = nature.getPythonPathNature().getProjectSourcePathSet(true);
                        } catch (CoreException e) {
                            Log.log(e);
                        }
                        PythonSourceFolder wrapped = tryWrapSourceFolder(p, folder, sourcePathSet);
                        if (wrapped != null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.