Examples of PyAutoIndentStrategy


Examples of org.python.pydev.editor.autoedit.PyAutoIndentStrategy

            int dif = offset - fReplacementOffset;
            if (fReplacementString.equals("elif")) {
                doc.replace(offset, 0, fReplacementString.substring(dif));

                //check if we should dedent
                PyAutoIndentStrategy strategy = new PyAutoIndentStrategy();
                DocCmd cmd = new DocCmd(offset + fReplacementString.length() - dif, 0, " ");
                Tuple<String, Integer> dedented = PyAutoIndentStrategy.autoDedentElif(doc, cmd,
                        strategy.getIndentPrefs());
                doc.replace(cmd.offset, 0, " :");
                //make up for the ' :' (right before ':')
                if (dedented != null) {
                    changeInCursorPos = -dedented.o2 + 1;
                }
                return;

            } else if (fReplacementString.endsWith(":")) { //else:, finally:, except: ...
                //make the replacement for the 'else'
                String replacementString = fReplacementString.substring(0, fReplacementString.length() - 1);
                doc.replace(offset, 0, replacementString.substring(dif));

                //dedent if needed
                PyAutoIndentStrategy strategy = new PyAutoIndentStrategy();
                DocCmd cmd = new DocCmd(offset + replacementString.length() - dif, 0, ":");
                Tuple<String, Integer> dedented = PyAutoIndentStrategy.autoDedentAfterColon(doc, cmd,
                        strategy.getIndentPrefs());
                doc.replace(cmd.offset, 0, ":");
                //make up for the ':'
                if (dedented != null) {
                    changeInCursorPos = -dedented.o2;
                }
View Full Code Here

Examples of org.python.pydev.editor.autoedit.PyAutoIndentStrategy

     *
     * @return PyAutoIndentStrategy which deals with spaces/tabs
     */
    public PyAutoIndentStrategy getPyAutoIndentStrategy() {
        if (autoIndentStrategy == null) {
            autoIndentStrategy = new PyAutoIndentStrategy();
        }
        return autoIndentStrategy;
    }
View Full Code Here

Examples of org.python.pydev.editor.autoedit.PyAutoIndentStrategy

                    length = skipped.length();
                    int pos = skippedPs.getAbsoluteCursorOffset() - (movingArea.getLength() + delim.length());
                    skippedPs.setSelection(pos, pos);
                }

                PyAutoIndentStrategy indentStrategy = null;
                if (pyEdit != null) {
                    indentStrategy = pyEdit.getAutoEditStrategy();
                }
                if (indentStrategy == null) {
                    indentStrategy = new PyAutoIndentStrategy();
                }

                if (!isStringPartition) {
                    if (indentStrategy.getIndentPrefs().getSmartLineMove()) {
                        String prevExpectedIndent = calculateNewIndentationString(document, skippedPs, indentStrategy);
                        if (prevExpectedIndent != null) {
                            moving = StringUtils.removeWhitespaceColumnsToLeftAndApplyIndent(moving,
                                    prevExpectedIndent, false);
                        }
View Full Code Here

Examples of org.python.pydev.editor.autoedit.PyAutoIndentStrategy

                        onResponseReceived.call(new InterpreterResponse("", "", false, false));
                    }
                },

                prompt, new ScriptConsoleHistory(), new ArrayList<IConsoleLineTracker>(), "",
                new PyAutoIndentStrategy());

        PyAutoIndentStrategy strategy = (PyAutoIndentStrategy) listener.getIndentStrategy();
        strategy.setIndentPrefs(new TestIndentPrefs(true, 4));
        listener.setDocument(doc);

        doc.replace(0, 0, ">>> class A:");
        doc.replace(doc.getLength(), 0, "\n");
        //Things happen in a thread now, so, we have to wait for it to happen...
View Full Code Here

Examples of org.python.pydev.editor.autoedit.PyAutoIndentStrategy

        }
    }

    @Override
    public IHandleScriptAutoEditStrategy getAutoEditStrategy() {
        return new PyAutoIndentStrategy();
    }
View Full Code Here

Examples of org.python.pydev.editor.autoedit.PyAutoIndentStrategy

     * Constructor for PyAutoIndentStrategyTest.
     * @param arg0
     */
    public PyAutoIndentStrategyTest(String arg0) {
        super(arg0);
        strategy = new PyAutoIndentStrategy();
    }
View Full Code Here

Examples of org.python.pydev.editor.autoedit.PyAutoIndentStrategy

    }

    @Override
    public IHandleScriptAutoEditStrategy getAutoEditStrategy() {
        return new PyAutoIndentStrategy();
    }
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.