Examples of PythonNature


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

                    IResource resource = workspace.getRoot().findMember(fProjectName);

                    boolean enabled = false;
                    if ((resource != null) && (resource instanceof IProject)) {
                        IProject project = (IProject) resource;
                        PythonNature nature = PythonNature.getPythonNature(project);
                        enabled = (nature != null);
                    }

                    fMainModuleBrowseButton.setEnabled(enabled);
View Full Code Here

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

                PySourceLocatorBase locator = new PySourceLocatorBase();
                IFile workspaceFile = locator.getWorkspaceFile(file);
                if (workspaceFile != null && workspaceFile.exists()) {
                    IProject project = workspaceFile.getProject();
                    if (project != null && project.exists()) {
                        PythonNature nature = PythonNature.getPythonNature(project);
                        String moduleName = nature.resolveModule(file);
                        if (moduleName != null) {
                            IModule mod = nature.getAstManager().getModule(moduleName, nature, true);
                            if (mod != null) {
                                ICompletionCache completionCache = new CompletionCache();
                                IDefinition[] definitions = mod.findDefinition(CompletionStateFactory
                                        .getEmptyCompletionState(testPath, nature, completionCache), -1, -1, nature);
View Full Code Here

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

    public void visitChangedResource(final IResource resource, final ICallback0<IDocument> document,
            final IProgressMonitor monitor, boolean forceAnalysis) {
        //we may need to 'force' the analysis when a module is renamed, because the first message we receive is
        //a 'delete' and after that an 'add' -- which is later mapped to this method, so, if we don't have info
        //on the module we should analyze it because it is 'probably' a rename.
        final PythonNature nature = getPythonNature(resource);
        if (nature == null) {
            return;
        }

        //Put things from the memo to final variables as we might need them later on and we cannot get them from
View Full Code Here

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

        }
    }

    @Override
    public void visitRemovedResource(IResource resource, ICallback0<IDocument> document, IProgressMonitor monitor) {
        PythonNature nature = getPythonNature(resource);
        if (nature == null) {
            return;
        }
        if (resource.getType() == IResource.FOLDER) {
            //We don't need to explicitly treat any folder (just its children -- such as __init__ and submodules)
View Full Code Here

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

            ILaunch launch = process.getLaunch();
            IDebugTarget debugTarget = launch.getDebugTarget();
            IInterpreterInfo projectInterpreter = null;
            if (debugTarget instanceof PyDebugTarget) {
                PyDebugTarget pyDebugTarget = (PyDebugTarget) debugTarget;
                PythonNature nature = PythonNature.getPythonNature(pyDebugTarget.project);
                if (nature != null) {
                    try {
                        projectInterpreter = nature.getProjectInterpreter();
                    } catch (Throwable e1) {
                        Log.log(e1);
                    }
                }
View Full Code Here

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

                IModulesManager modulesManager = null;
                try {
                    if (additionalInfo instanceof AdditionalProjectInterpreterInfo) {
                        AdditionalProjectInterpreterInfo projectInterpreterInfo = (AdditionalProjectInterpreterInfo) additionalInfo;
                        IProject project = projectInterpreterInfo.getProject();
                        PythonNature nature = PythonNature.getPythonNature(project);
                        if (nature != null) {
                            ICodeCompletionASTManager astManager = nature.getAstManager();
                            if (astManager != null) {
                                modulesManager = astManager.getModulesManager();
                            }

                        }
View Full Code Here

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

                } else if (resource.additionalInfo instanceof AdditionalProjectInterpreterInfo) {
                    AdditionalProjectInterpreterInfo projectInterpreterInfo = (AdditionalProjectInterpreterInfo) resource.additionalInfo;
                    IProject project = projectInterpreterInfo.getProject();
                    if (project != null) {
                        List<IPythonNature> natures = new ArrayList<IPythonNature>();
                        PythonNature n = PythonNature.getPythonNature(project);
                        if (n != null) {
                            natures.add(n);
                            try {
                                List<Tuple<AbstractAdditionalTokensInfo, IPythonNature>> additionalInfoAndNature = AdditionalProjectInterpreterInfo
                                        .getAdditionalInfoAndNature(n, true, false);
View Full Code Here

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

            }
        } else if (next instanceof IFile) {
            filesToVisit.add((IFile) next);
        }

        PythonNature nature = PythonNature.getPythonNature(next);
        AnalysisBuilderVisitor visitor = new AnalysisBuilderVisitor();
        visitor.visitingWillStart(new NullProgressMonitor(), false, null);
        FastStringBuffer buf = new FastStringBuffer();
        for (IFile f : filesToVisit) {
            if (monitor.isCanceled()) {
                break;
            }
            if (filesVisited.contains(f)) {
                continue;
            }
            filesVisited.add(f);
            monitor.setTaskName(buf.clear().append("Scheduling: ").append(f.getName()).toString());
            IDocument doc = FileUtilsFileBuffer.getDocFromResource(f);
            visitor.memo = new HashMap<String, Object>();
            visitor.memo.put(PyDevBuilderVisitor.IS_FULL_BUILD, false);
            long documentTime = f.getModificationStamp();
            visitor.memo.put(PyDevBuilderVisitor.DOCUMENT_TIME, documentTime);
            String moduleName;
            try {
                moduleName = nature.resolveModule(f);
            } catch (MisconfigurationException e) {
                Log.log(e);
                continue;
            }
            if (moduleName == null) {
                continue;
            }
            AnalysisBuilderVisitor.setModuleNameInCache(visitor.memo, f, moduleName);
            IModule module = nature.getAstManager().getModule(moduleName, nature, true);
            if (module == null) {
                Log.log(IStatus.WARNING, "Unable to get module: " + moduleName + " for resource: " + f, null);
                continue;
            }
            visitor.doVisitChangedResource(nature, f, doc, null, module, new NullProgressMonitor(), true,
View Full Code Here

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

    public void onInputChanged(PyEdit edit, IEditorInput oldInput, IEditorInput input, IProgressMonitor monitor) {
        if (input != null) {
            IResource adapter = (IResource) input.getAdapter(IResource.class);
            if (adapter != null) {
                IProject project = adapter.getProject();
                final PythonNature nature = PythonNature.getPythonNature(project);
                if (nature != null) {
                    Job job = new Job("Preload additional info") {

                        @Override
                        protected IStatus run(IProgressMonitor monitor) {
View Full Code Here

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

                } else {
                    cache.addFolder(f, f.getParentFile());
                }
            }

            PythonNature nature = PythonNature.getPythonNature(container);
            if (nature == null) {
                throw new RuntimeException("The directory passed: " + container
                        + " does not have an associated nature.");
            }
            AbstractRunner runner = UniversalRunner.getRunner(nature);
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.