Package com.aptana.interactive_console.console.ui

Examples of com.aptana.interactive_console.console.ui.ScriptStyleRange


        super.tearDown();
    }

    public void testJoinPartitions() throws Exception {
        ScriptConsolePartitioner partitioner = new ScriptConsolePartitioner();
        partitioner.addRange(new ScriptStyleRange(0, 1, null, null, ScriptStyleRange.STDIN));
        assertEquals(1, partitioner.getStyleRanges(0, 1).length);

        partitioner.addRange(new ScriptStyleRange(1, 1, null, null, ScriptStyleRange.STDIN));
        assertEquals(1, partitioner.getStyleRanges(0, 2).length);

        partitioner.addRange(new ScriptStyleRange(1, 1, null, null, ScriptStyleRange.STDOUT));
        assertEquals(2, partitioner.getStyleRanges(0, 2).length);

        partitioner.addRange(new ScriptStyleRange(1, 1, null, null, ScriptStyleRange.STDIN));
        assertEquals(1, partitioner.getStyleRanges(0, 2).length);

    }
View Full Code Here


    }

    public void testPartitioning() throws Exception {
        ScriptConsolePartitioner partitioner = new ScriptConsolePartitioner();
        partitioner.addRange(new ScriptStyleRange(0, 1, null, null, ScriptStyleRange.STDIN));
        assertEquals(1, partitioner.getStyleRanges(0, 1).length);

        partitioner.addRange(new ScriptStyleRange(0, 1, null, null, ScriptStyleRange.STDERR));
        assertEquals(1, partitioner.getStyleRanges(0, 1).length);

        partitioner.addRange(new ScriptStyleRange(0, 3, null, null, ScriptStyleRange.STDOUT));
        assertEquals(1, partitioner.getStyleRanges(0, 1).length);

        partitioner.addRange(new ScriptStyleRange(2, 1, null, null, ScriptStyleRange.PROMPT));
        assertEquals(1, partitioner.getStyleRanges(0, 1).length);

        StyleRange[] styleRanges = partitioner.getStyleRanges(0, 3);
        assertEquals(2, styleRanges.length);
        assertEquals(0, styleRanges[0].start);
View Full Code Here

    private final AnsiState err = new AnsiState();
    private final AnsiState out = new AnsiState();

    private ScriptStyleRange getIt(String content, int offset, TextAttribute attr, int scriptStyle) {
        //background is the default (already set)
        return new ScriptStyleRange(offset, content.length(), attr.getForeground(), null, scriptStyle, attr.getStyle());
    }
View Full Code Here

                char c = doc.getChar(i);
                if (c == '\r' || c == '\n') {
                    //new lines should be added for any style.
                    plainText.append(c);
                } else {
                    ScriptStyleRange current = null;
                    while (true) {
                        if (currentRange >= ranges.length) {
                            break;
                        }
                        current = ranges[currentRange];
View Full Code Here

     * @param offset2
     */
    private void applyStyleToUserAddedText(String cmd, int offset2) {
        IConsoleStyleProvider styleProvider = viewer.getStyleProvider();
        if (styleProvider != null) {
            ScriptStyleRange style = styleProvider.createUserInputStyle(cmd, offset2);
            if (style != null) {
                addToPartitioner(style);
            }
        }
    }
View Full Code Here

    protected void appendInvitation(boolean async) {
        int start = doc.getLength();
        String promptStr = prompt.toString();
        IConsoleStyleProvider styleProvider = viewer.getStyleProvider();
        if (styleProvider != null) {
            ScriptStyleRange style = styleProvider.createPromptStyle(promptStr, start);
            if (style != null) {
                addToPartitioner(style);
            }
        }
        appendText(promptStr); //caret already updated
View Full Code Here

    private final AnsiState err = new AnsiState();
    private final AnsiState out = new AnsiState();

    private ScriptStyleRange getIt(String content, int offset, TextAttribute attr, int scriptStyle) {
        //background is the default (already set)
        return new ScriptStyleRange(offset, content.length(), attr.getForeground(), null, scriptStyle, attr.getStyle());
    }
View Full Code Here

TOP

Related Classes of com.aptana.interactive_console.console.ui.ScriptStyleRange

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.