Package com.aptana.shared_core.utils

Examples of com.aptana.shared_core.utils.TextSelectionUtils


        }
        if (style != null) {
            appendText(style.o2);
        }

        TextSelectionUtils ps = new TextSelectionUtils(doc, start);
        int cursorLine = ps.getCursorLine();
        int numberOfLines = doc.getNumberOfLines();

        //right after appending the text, let's notify line trackers
        for (int i = cursorLine; i < numberOfLines; i++) {
            try {
                int offset = ps.getLineOffset(i);
                int endOffset = ps.getEndLineOffset(i);

                Region region = new Region(offset, endOffset - offset);

                for (IConsoleLineTracker lineTracker : this.consoleLineTrackers) {
                    lineTracker.lineAppended(region);
View Full Code Here


     *
     * @return true if it was done and false otherwise.
     */
    public boolean execute(IDocument doc, int caretOffset, int commandLineOffset, IScriptConsoleViewer viewer) {
        try {
            TextSelectionUtils ps = new TextSelectionUtils(doc, caretOffset);
            int lineOffset = ps.getLineOffset();

            int promptEndOffset = lineOffset;
            ScriptConsolePartitioner partitioner = (ScriptConsolePartitioner) doc.getDocumentPartitioner();
            int docLen = doc.getLength();

            for (; promptEndOffset < docLen; promptEndOffset++) {
                ScriptStyleRange[] range = partitioner.getStyleRanges(promptEndOffset, 1);
                if (range.length >= 1) {
                    if (range[0].scriptType != ScriptStyleRange.PROMPT) {
                        break;
                    }
                }
            }

            int absoluteCursorOffset = ps.getAbsoluteCursorOffset();

            IRegion lineInformation = doc.getLineInformationOfOffset(absoluteCursorOffset);
            String contentsFromPrompt = doc.get(promptEndOffset,
                    lineInformation.getOffset() + lineInformation.getLength() - promptEndOffset);
            int firstCharPosition = TextSelectionUtils.getFirstCharPosition(contentsFromPrompt);
View Full Code Here

TOP

Related Classes of com.aptana.shared_core.utils.TextSelectionUtils

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.