Examples of PythonNature


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

            Object parent) {
        if (parent == null || this.interpreterInfo == null) {
            return null;
        }

        PythonNature nature = PythonNature.getPythonNature(project);
        if (interpreterInfoTreeRoot != null) {
            if (interpreterInfoTreeRoot.getParent().equals(parent)
                    && interpreterInfoTreeRoot.interpreterInfo.equals(interpreterInfo)) {
                return interpreterInfoTreeRoot;
            }
View Full Code Here

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

    @SuppressWarnings("unchecked")
    private Tuple<List<ProjectConfigError>, IInterpreterInfo> getConfigErrorsAndInfo(IProject project) {
        if (project == null || !project.isOpen()) {
            return new Tuple<List<ProjectConfigError>, IInterpreterInfo>(new ArrayList(), null);
        }
        PythonNature nature = PythonNature.getPythonNature(project);
        if (nature == null) {
            return new Tuple<List<ProjectConfigError>, IInterpreterInfo>(new ArrayList(), null);
        }

        //If the info is not readily available, we try to get some more times... after that, if still not available,
        //we just return as if it's all OK.
        Tuple<List<ProjectConfigError>, IInterpreterInfo> configErrorsAndInfo = null;
        boolean goodToGo = false;
        for (int i = 0; i < 10 && !goodToGo; i++) {
            try {
                configErrorsAndInfo = nature.getConfigErrorsAndInfo(project);
                goodToGo = true;
            } catch (PythonNatureWithoutProjectException e1) {
                goodToGo = false;
                synchronized (this) {
                    try {
View Full Code Here

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

                return true;
            }

            //only analyze projects with the python nature...
            IProject project = resource.getProject();
            PythonNature nature = PythonNature.getPythonNature(project);

            if (project != null && nature != null) {
                //we just want to make the visit if it is a valid python file and it is in the pythonpath
                if (PythonPathHelper.isValidSourceFile("." + ext)) {
View Full Code Here

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

        if (PyLintPrefPage.usePyLint() == false) {
            return;
        }

        IProject project = resource.getProject();
        PythonNature pythonNature = PythonNature.getPythonNature(project);
        try {
            //pylint can only be used for jython projects
            if (pythonNature.getInterpreterType() != IInterpreterManager.INTERPRETER_TYPE_PYTHON) {
                return;
            }
            //must be in a source folder (not external)
            if (!isResourceInPythonpathProjectSources(resource, pythonNature, false)) {
                return;
View Full Code Here

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

            String scriptToExe = FileUtils.getFileAbsolutePath(script);
            String[] paramsToExe = list.toArray(new String[0]);
            write("PyLint: Executing command line:'", out, scriptToExe, paramsToExe, "'");

            PythonNature nature = PythonNature.getPythonNature(project);
            if (nature == null) {
                Throwable e = new RuntimeException("PyLint ERROR: Nature not configured for: " + project);
                Log.log(e);
                return;
            }

            Tuple<String, String> outTup = new SimplePythonRunner().runAndGetOutputFromPythonScript(nature
                    .getProjectInterpreter().getExecutableOrJar(), scriptToExe, paramsToExe, arg.getParentFile(),
                    project);

            write("PyLint: The stdout of the command line is: " + outTup.o1, out);
            write("PyLint: The stderr of the command line is: " + outTup.o2, out);
View Full Code Here

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

            this.workspaceRoot = (IWorkspaceRoot) parentElement;
            List<IProject> ret = new ArrayList<IProject>();

            IProject[] projects = workspaceRoot.getProjects();
            for (IProject project : projects) {
                PythonNature nature = PythonNature.getPythonNature(project);
                if (nature != null) {
                    ret.add(project);
                }
            }
            return ret.toArray(new IProject[0]);
        }

        //project
        if (parentElement instanceof IProject) {
            List<Object> ret = new ArrayList<Object>();
            IProject project = (IProject) parentElement;
            IPythonPathNature nature = PythonNature.getPythonPathNature(project);
            if (nature != null) {
                try {
                    String[] srcPaths = PythonNature.getStrAsStrItems(nature.getProjectSourcePath(true));
                    for (String str : srcPaths) {
                        IResource resource = this.workspaceRoot.findMember(new Path(str));
                        if (resource instanceof IFolder) {
                            IFolder folder = (IFolder) resource;
                            if (folder.exists()) {
View Full Code Here

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

     *
     * This visitor just passes one resource and updates the code completion cache for it.
     */
    @Override
    public void visitChangedResource(IResource resource, ICallback0<IDocument> document, IProgressMonitor monitor) {
        PythonNature pythonNature = getPythonNature(resource);
        if (pythonNature != null) {
            ICodeCompletionASTManager astManager = pythonNature.getAstManager();

            if (astManager != null) {
                IPath location = resource.getLocation();
                astManager.rebuildModule(new File(location.toOSString()), document, resource.getProject(),
                        new NullProgressMonitor(), pythonNature);
View Full Code Here

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

        }
    }

    @Override
    public void visitRemovedResource(IResource resource, ICallback0<IDocument> document, IProgressMonitor monitor) {
        PythonNature pythonNature = getPythonNature(resource);
        if (pythonNature != null) {

            ICodeCompletionASTManager astManager = pythonNature.getAstManager();
            if (astManager != null) {
                IPath location = resource.getLocation();

                astManager.removeModule(new File(location.toOSString()), resource.getProject(),
                        new NullProgressMonitor());
View Full Code Here

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

                    //There's a catch here: if the nature uses some variable defined in the string substitution
                    //from the interpreter info, we need to do a full build instead of only making a notification.
                    String complete = pythonPathNature.getProjectExternalSourcePath(false)
                            + pythonPathNature.getProjectSourcePath(false);

                    PythonNature n = (PythonNature) nature;
                    String projectInterpreterName = n.getProjectInterpreterName();
                    IInterpreterInfo info;
                    if (IPythonNature.DEFAULT_INTERPRETER.equals(projectInterpreterName)) {
                        //if it's the default, let's translate it to the outside world
                        info = defaultInterpreterInfo;
                    } else {
View Full Code Here

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

    List<String> parameters;
    List<IContainer> refresh;

    protected boolean confirmRun() {
        clearRunInput();
        PythonNature nature = null;
        for (IResource c : selectedResources) {
            PythonNature n2 = PythonNature.getPythonNature(c);
            if (n2 != null) {
                if (nature == null) {
                    nature = n2;

                } else {
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.