Package org.jboss.aesh.console.command

Examples of org.jboss.aesh.console.command.CommandOperation


            shell.out().print(Config.getLineSeparator());
    }

    private void readFromStdin(CommandInvocation commandInvocation) {
        try {
            CommandOperation input = commandInvocation.getInput();
            StringBuilder builder = new StringBuilder();
            while(input.getInputKey() != Key.CTRL_C) {
                if(input.getInputKey() == Key.ENTER) {
                    commandInvocation.getShell().out().println();
                    displayLine(builder.toString(), commandInvocation.getShell());
                    builder = new StringBuilder();
                }
                else {
                    builder.append(input.getInputKey().getAsChar());
                    commandInvocation.getShell().out().print(input.getInputKey().getAsChar());
                }

                input = commandInvocation.getInput();
            }
View Full Code Here


    }

    public void processOperation() throws IOException, InterruptedException {
        try {
            while (true) {
                CommandOperation commandOperation = commandInvocation.getInput();
                if (commandOperation.getInputKey().isNumber()) {
                    if (runner != null)
                        runner.speed(Integer.parseInt(String.valueOf((char) commandOperation.getInput()[0])));
                }
                if (commandOperation.getInputKey() == Key.a) {
                    if (runner != null)
                        runner.asynch();
                }
                else if (commandOperation.getInputKey() == Key.q) {
                    stop();
                    return;
                }
            }
        }
View Full Code Here

                    catch(InterruptedException ie) {
                        ie.printStackTrace();
                    }
                }
                else {
                    inputQueue.put(new CommandOperation(inc, input, position));
                }
            }
            return true;
        }
        catch (IOException ioe) {
View Full Code Here

    public CommandOperation getInput(int pid) throws InterruptedException {
        if(foregroundProcess == pid)
            return console.getInput();
        else
            return new CommandOperation(Key.UNKNOWN, new int[]{});
    }
View Full Code Here

        @Override
        public CommandResult execute(CommandInvocation commandInvocation) throws IOException, InterruptedException {
            this.shell = commandInvocation.getShell();
            if(bar) {
                shell.out().print("are you sure you want bar? (y/n) ");
                CommandOperation operation = null;
                try {
                    operation = commandInvocation.getInput();
                }
                catch (InterruptedException e) {
                    return CommandResult.FAILURE;
View Full Code Here

    public void processOperation() throws IOException {

        try {
            while(true) {
                CommandOperation commandOperation = commandInvocation.getInput();
                if(commandOperation.getInputKey().isNumber()) {
                    if(runner != null)
                        runner.speed(Integer.parseInt(String.valueOf((char) commandOperation.getInput()[0])));
                }
                if(commandOperation.getInputKey() == Key.a) {
                    if(runner != null)
                        runner.asynch();
                }
                else if(commandOperation.getInputKey() == Key.q) {
                    stop();
                    return;
                }
            }
        }
View Full Code Here

    public void processOperation() throws IOException {
        boolean attach = true;
        try {
            while(attach) {
                CommandOperation operation = commandInvocation.getInput();
                if(operation.getInputKey() == Key.q) {
                    attach = false;
                }
                else if( operation.getInputKey() == Key.ENTER) {
                    topVisibleRow = topVisibleRow + getNumber();
                    if(topVisibleRow > (page.size()-rows)) {
                        topVisibleRow = page.size()-rows;
                        if(topVisibleRow < 0)
                            topVisibleRow = 0;
                        display(Background.INVERSE);
                        attach = false;
                    }
                    else
                        display(Background.INVERSE);
                    clearNumber();
                }
                // ctrl-f ||  space
                else if(operation.getInputKey() == Key.CTRL_F ||
                        operation.getInputKey() == Key.SPACE) {
                    topVisibleRow = topVisibleRow + rows*getNumber();
                    if(topVisibleRow > (page.size()-rows)) {
                        topVisibleRow = page.size()-rows;
                        if(topVisibleRow < 0)
                            topVisibleRow = 0;
                        display(Background.INVERSE);
                        attach = false;
                    }
                    else
                        display(Background.INVERSE);
                    clearNumber();
                }
                else if(operation.getInputKey() == Key.CTRL_B) { // ctrl-b
                    topVisibleRow = topVisibleRow - rows*getNumber();
                    if(topVisibleRow < 0)
                        topVisibleRow = 0;
                    display(Background.INVERSE);
                    clearNumber();
                }
                else if(Character.isDigit(operation.getInput()[0])) {
                    number.append(Character.getNumericValue(operation.getInput()[0]));
                }
            }
        }
        catch (InterruptedException ie) {
        }
View Full Code Here

            shell.out().print(Config.getLineSeparator());
    }

    private void readFromStdin(CommandInvocation commandInvocation) {
        try {
            CommandOperation input = commandInvocation.getInput();
            StringBuilder builder = new StringBuilder();
            while(input.getInputKey() != Key.CTRL_C) {
                if(input.getInputKey() == Key.ENTER) {
                    commandInvocation.getShell().out().println();
                    displayLine(builder.toString(), commandInvocation.getShell());
                    builder = new StringBuilder();
                }
                else {
                    builder.append(input.getInputKey().getAsChar());
                    commandInvocation.getShell().out().print(input.getInputKey().getAsChar());
                }

                input = commandInvocation.getInput();
            }
View Full Code Here

            shell.out().print(Config.getLineSeparator());
    }

    private void readFromStdin(CommandInvocation commandInvocation) {
        try {
            CommandOperation input = commandInvocation.getInput();
            StringBuilder builder = new StringBuilder();
            while(input.getInputKey() != Key.CTRL_C) {
                if(input.getInputKey() == Key.ENTER) {
                    commandInvocation.getShell().out().println();
                    displayLine(builder.toString(), commandInvocation.getShell());
                    builder = new StringBuilder();
                }
                else {
                    builder.append(input.getInputKey().getAsChar());
                    commandInvocation.getShell().out().print(input.getInputKey().getAsChar());
                }

                input = commandInvocation.getInput();
            }
View Full Code Here

    public void processOperation() throws IOException {
        boolean attach = true;
        try {
            while(attach) {
                CommandOperation operation = commandInvocation.getInput();
                if(operation.getInputKey() == Key.q) {
                    attach = false;
                }
                else if( operation.getInputKey() == Key.ENTER) {
                    topVisibleRow = topVisibleRow + getNumber();
                    if(topVisibleRow > (page.size()-rows)) {
                        topVisibleRow = page.size()-rows;
                        if(topVisibleRow < 0)
                            topVisibleRow = 0;
                        display(Background.INVERSE);
                        attach = false;
                    }
                    else
                        display(Background.INVERSE);
                    clearNumber();
                }
                // ctrl-f ||  space
                else if(operation.getInputKey() == Key.CTRL_F ||
                        operation.getInputKey() == Key.SPACE) {
                    topVisibleRow = topVisibleRow + rows*getNumber();
                    if(topVisibleRow > (page.size()-rows)) {
                        topVisibleRow = page.size()-rows;
                        if(topVisibleRow < 0)
                            topVisibleRow = 0;
                        display(Background.INVERSE);
                        attach = false;
                    }
                    else
                        display(Background.INVERSE);
                    clearNumber();
                }
                else if(operation.getInputKey() == Key.CTRL_B) { // ctrl-b
                    topVisibleRow = topVisibleRow - rows*getNumber();
                    if(topVisibleRow < 0)
                        topVisibleRow = 0;
                    display(Background.INVERSE);
                    clearNumber();
                }
                else if(Character.isDigit(operation.getInput()[0])) {
                    number.append(Character.getNumericValue(operation.getInput()[0]));
                }
            }
        }
        catch (InterruptedException ie) {
        }
View Full Code Here

TOP

Related Classes of org.jboss.aesh.console.command.CommandOperation

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.