Package org.python.pydev.core

Examples of org.python.pydev.core.IIndentPrefs


                        }
                    }
                    // Jiawei Zhang Add End.

                    if (docstring != null && docstring.trim().length() > 0) {
                        IIndentPrefs indentPrefs = edit.getIndentPrefs();
                        temp.append(StringUtils.fixWhitespaceColumnsToLeftFromDocstring(docstring,
                                indentPrefs.getIndentationString()));
                    }
                }

                if (temp.length() > 0) {
                    if (buf.length() > 0) {
View Full Code Here


    }

    public static String printAst(PyEdit edit, SimpleNode astToPrint) {
        String str = null;
        if (astToPrint != null) {
            IIndentPrefs indentPrefs;
            if (edit != null) {
                indentPrefs = edit.getIndentPrefs();
            } else {
                indentPrefs = DefaultIndentPrefs.get();
            }

            Str docStr = NodeUtils.getNodeDocStringNode(astToPrint);
            if (docStr != null) {
                docStr.s = StringUtils.fixWhitespaceColumnsToLeftFromDocstring(docStr.s,
                        indentPrefs.getIndentationString());
            }

            PrettyPrinterPrefsV2 prefsV2 = PrettyPrinterV2.createDefaultPrefs(edit, indentPrefs,
                    PyInformationPresenter.LINE_DELIM);
View Full Code Here

    }

    public static String printAst(PyEdit edit, SimpleNode astToPrint, String lineDelimiter) {
        String str = null;
        if (astToPrint != null) {
            IIndentPrefs indentPrefs;
            if (edit != null) {
                indentPrefs = edit.getIndentPrefs();
            } else {
                indentPrefs = DefaultIndentPrefs.get();
            }
View Full Code Here

public class PyToggleForceTabs extends PyAction {

    public void run(IAction action) {
        if (targetEditor instanceof PyEdit) {
            PyEdit pyEdit = (PyEdit) targetEditor;
            IIndentPrefs indentPrefs = pyEdit.getIndentPrefs();
            indentPrefs.setForceTabs(!indentPrefs.getForceTabs());
            updateActionState(indentPrefs);
        }
    }
View Full Code Here

            if (!canModifyEditor()) {
                return;
            }

            PyEdit pyEdit = (PyEdit) getTextEditor();
            IIndentPrefs indentPrefs = pyEdit.getIndentPrefs();
            PySelection ps = new PySelection(pyEdit);
            perform(ps, indentPrefs);
        } catch (Exception e) {
            beep(e);
        }
View Full Code Here

     * Updates the text to the next tab position
     * @param command the command to be edited
     * @param lineContentsToCursorLen the current cursor position at the current line
     */
    private void applyDefaultForTab(DocumentCommand command, int lineContentsToCursorLen) {
        IIndentPrefs prefs = getIndentPrefs();
        if (prefs.getUseSpaces(true)) {
            int tabWidth = getIndentPrefs().getTabWidth();

            int mod = (lineContentsToCursorLen + tabWidth) % tabWidth;
            command.text = StringUtils.createSpaceString(tabWidth - mod);
        } else {
View Full Code Here

                    temp.append(str);

                } else {
                    String docstring = d.getDocstring(nature, completionCache);
                    if (docstring != null && docstring.trim().length() > 0) {
                        IIndentPrefs indentPrefs = edit.getIndentPrefs();
                        temp.append(StringUtils.fixWhitespaceColumnsToLeftFromDocstring(docstring,
                                indentPrefs.getIndentationString()));
                    }
                }

                if (temp.length() > 0) {
                    if (buf.length() > 0) {
View Full Code Here

    }

    public static String printAst(PyEdit edit, SimpleNode astToPrint) {
        String str = null;
        if (astToPrint != null) {
            IIndentPrefs indentPrefs;
            if (edit != null) {
                indentPrefs = edit.getIndentPrefs();
            } else {
                indentPrefs = DefaultIndentPrefs.get();
            }

            Str docStr = NodeUtils.getNodeDocStringNode(astToPrint);
            if (docStr != null) {
                docStr.s = StringUtils.fixWhitespaceColumnsToLeftFromDocstring(docStr.s,
                        indentPrefs.getIndentationString());
            }

            PrettyPrinterPrefsV2 prefsV2 = PrettyPrinterV2.createDefaultPrefs(edit, indentPrefs,
                    PyInformationPresenter.LINE_DELIM);
View Full Code Here

    protected void configureTextViewer(TextViewer textViewer) {
        if (!(textViewer instanceof SourceViewer))
            return;
        final SourceViewer sourceViewer = (SourceViewer) textViewer;

        final IIndentPrefs indentPrefs = new DefaultIndentPrefs();

        //Hack to provide the source viewer configuration that'll only be created later (there's a cycle there).
        final WeakReference<PyEditConfigurationWithoutEditor>[] sourceViewerConfigurationObj = new WeakReference[1];

        IPreferenceStore chainedPrefStore = PydevPrefs.getChainedPrefStore();
View Full Code Here

                                strbuf.append(newSub);
                                strbuf.append(line.substring(sub.length()));
                            }

                        } else {
                            IIndentPrefs indentPrefs;
                            if (targetEditor instanceof PyEdit) {
                                PyEdit pyEdit = (PyEdit) targetEditor;
                                indentPrefs = pyEdit.getIndentPrefs();
                            } else {
                                indentPrefs = DefaultIndentPrefs.get();
                            }

                            String indentationString = indentPrefs.getIndentationString();

                            int subLen = sub.length();
                            int indentLen = indentationString.length();
                            int mod = subLen % indentLen;
                            if (mod != 0) {
View Full Code Here

TOP

Related Classes of org.python.pydev.core.IIndentPrefs

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.