Examples of IPythonNature


Examples of org.python.pydev.core.IPythonNature

        assists.add(new AssistPercentToFormat());

        assists.addAll(ExtensionHelper.getParticipants(ExtensionHelper.PYDEV_CTRL_1));
        ImageCache imageCache = PydevPlugin.getImageCache();
        File editorFile = edit.getEditorFile();
        IPythonNature pythonNature = null;
        try {
            pythonNature = edit.getPythonNature();
        } catch (MisconfigurationException e1) {
            Log.log(e1);
        }
View Full Code Here

Examples of org.python.pydev.core.IPythonNature

        if (CodeCompletionPreferencesPage.forcePy3kPrintOnPy2()) {
            isPy3Syntax = true;

        } else {
            try {
                IPythonNature nature = edit.getPythonNature();
                if (nature != null) {
                    isPy3Syntax = nature.getGrammarVersion() >= IGrammarVersionProvider.GRAMMAR_PYTHON_VERSION_3_0;
                }
            } catch (MisconfigurationException e) {
            }
        }
        return innerComputeProposals(activationToken, qualifier, offset, false, isPy3Syntax);
View Full Code Here

Examples of org.python.pydev.core.IPythonNature

        }
        return projectModulesManager.getCompletePythonPath(interpreter, manager);
    }

    private IModulesManager getProjectModulesManager() {
        IPythonNature nature = fNature;
        if (nature == null) {
            return null;
        }

        ICodeCompletionASTManager astManager = nature.getAstManager();
        if (astManager == null) {
            // AST manager might not be yet available
            // Code completion job is scheduled to be run
            return null;
        }
View Full Code Here

Examples of org.python.pydev.core.IPythonNature

            PyPartitionScanner.checkPartitionScanner(document);

            // Also adds Python nature to the project.
            // The reason this is done here is because I want to assign python
            // nature automatically to any project that has active python files.
            final IPythonNature nature = PythonNature.addNature(input);

            //we also want to initialize our shells...
            //we use 2: one for refactoring and one for code completion.
            Thread thread2 = new Thread() {
                public void run() {
View Full Code Here

Examples of org.python.pydev.core.IPythonNature

        this.errorDescription = null; //the order is: parserChanged and only then parserError
        ast = (SimpleNode) root;
        astModificationTimeStamp = ((IDocumentExtension4) doc).getModificationStamp();

        try {
            IPythonNature pythonNature = this.getPythonNature();
            if (pythonNature != null) {
                ICodeCompletionASTManager astManager = pythonNature.getAstManager();
                if (astManager != null) {
                    IModulesManager modulesManager = astManager.getModulesManager();
                    if (modulesManager != null) {
                        File editorFile = this.getEditorFile();
                        if (editorFile != null) {
                            String moduleName = pythonNature.resolveModule(editorFile);
                            if (moduleName != null) {
                                synchronized (lockHandle) {
                                    releaseCurrentHandle();
                                    int modHandle = modulesManager.pushTemporaryModule(moduleName, new SourceModule(
                                            moduleName, editorFile, ast, null));
View Full Code Here

Examples of org.python.pydev.core.IPythonNature

            IFile file = project.getFile(path);
            if (file != null) {
                IEditorPart editor = PyOpenEditor.doOpenEditor(file);
                if (editor instanceof PyEdit) {
                    PyEdit pyEdit = (PyEdit) editor;
                    IPythonNature nature = pyEdit.getPythonNature();
                    AbstractModule mod = AbstractModule.createModuleFromDoc(nature.resolveModule(file), file
                            .getLocation().toFile(), pyEdit.getDocument(), nature, false);

                    StringBuffer tok = new StringBuffer(80);
                    for (String s : innerStructure) {
                        if (tok.length() > 0) {
View Full Code Here

Examples of org.python.pydev.core.IPythonNature

     */
    public int getGrammarVersion() throws MisconfigurationException {
        if (isCythonFile()) {
            return IPythonNature.GRAMMAR_PYTHON_VERSION_CYTHON;
        }
        IPythonNature nature;
        nature = getPythonNature();
        if (nature != null) {
            return nature.getGrammarVersion();
        }
        Tuple<IPythonNature, String> infoForFile = PydevPlugin.getInfoForFile(getEditorFile());
        return infoForFile.o1.getGrammarVersion();
    }
View Full Code Here

Examples of org.python.pydev.core.IPythonNature

    public IPythonNature getPythonNature() throws MisconfigurationException {
        IProject project = getProject();
        if (project == null || !project.isOpen()) {
            return null;
        }
        IPythonNature pythonNature = PythonNature.getPythonNature(project);
        if (pythonNature != null) {
            return pythonNature;
        }

        //if it's an external file, there's the possibility that it won't be added even here.
View Full Code Here

Examples of org.python.pydev.core.IPythonNature

                        m2 = (ProjectModulesManager) m;
                        //check at most once every 20 seconds (or every time if the pythonpath is empty... in which case
                        //it should be fast to get it too if it's consistent).
                        if (pythonpath.size() == 0 || currentTimeMillis - m2.checkedPythonpathConsistency > 20 * 1000) {
                            try {
                                IPythonNature n = m.getNature();
                                if (n != null) {
                                    IPythonPathNature pythonPathNature = n.getPythonPathNature();
                                    if (pythonPathNature != null) {
                                        onlyProjectPythonPathStr = pythonPathNature.getOnlyProjectPythonPathStr(true);
                                        m2.checkedPythonpathConsistency = currentTimeMillis;
                                        forceCheck = true;
                                    }
View Full Code Here

Examples of org.python.pydev.core.IPythonNature

    private void setTokens(String name, IModulesManager manager) throws IOException, Exception, CoreException {
        if (TRACE_COMPILED_MODULES) {
            Log.log(IStatus.INFO, ("Compiled modules: getting info for:" + name), null);
        }
        final IPythonNature nature = manager.getNature();
        AbstractShell shell = AbstractShell.getServerShell(nature, AbstractShell.COMPLETION_SHELL);
        synchronized (shell) {
            Tuple<String, List<String[]>> completions = shell.getImportCompletions(name, manager.getCompletePythonPath(
                    nature.getProjectInterpreter(), nature.getRelatedInterpreterManager())); //default

            if (TRACE_COMPILED_MODULES) {
                Log.log(IStatus.INFO, ("Compiled modules: " + name + " file: " + completions.o1 + " found: "
                        + completions.o2.size() + " completions."), 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.