Package org.jboss.aesh.edit.actions

Examples of org.jboss.aesh.edit.actions.Operation


            //for(int i : in)
            //    System.out.println("got int:"+i);
            if (in[0] == -1) {
                return null;
            }
            Operation operation = editMode.parseInput(in);
            operation.setInput(in);

            String result = null;
            if(command != null)
                command.processOperation(operation);
            else
View Full Code Here


                return saveAction(Operation.REPLACE);
            }
        }


        Operation operation = currentOperation.getOperation();
        Action workingMode = currentOperation.getWorkingMode();

        //if ctrl-d is pressed on an empty line we update the eofCounter
        // if eofCounter > ignoreEof we send EXIT operation, else NO_ACTION
        //if buffer is not empty, we send a NEW_LINE
View Full Code Here

                    return Operation.SEARCH_INPUT;
                }
        } // end search mode
        else {
            // process if we have any hits...
            Operation operation = currentOperation.getOperation();
            if(operation == Operation.SEARCH_PREV ||
                    operation == Operation.SEARCH_NEXT_WORD)
                mode = Action.SEARCH;

            //if ctrl-d is pressed on an empty line we update the eofCounter
View Full Code Here

    }

    @Override
    public String parseOperation(CommandOperation commandOperation) throws IOException {

        Operation operation = consoleBuffer.getEditMode().parseInput(commandOperation.getInputKey(),
                consoleBuffer.getBuffer().getLine());
        if(commandOperation.getInputKey() != Key.UNKNOWN)
            operation.setInput(commandOperation.getInputKey().getKeyValues());
        else
            operation.setInput(new int[]{ commandOperation.getInput()[commandOperation.getPosition()]});

        Action action = operation.getAction();

        if (action == Action.EDIT) {
            consoleBuffer.writeChars(operation.getInput());
        }
        //make sure that every action except delete is ignored when masking is enabled
        else if(consoleBuffer.getBuffer().isMasking()) {
            if(action == Action.DELETE) {
                if(consoleBuffer.getBuffer().getPrompt().getMask() == 0)
                    deleteWithMaskEnabled();
                else
                    consoleBuffer.performAction(EditActionManager.parseAction(operation, consoleBuffer.getBuffer().getCursor(),
                            consoleBuffer.getBuffer().length(), consoleBuffer.getEditMode().getMode()));
            }
        }
        // For search movement is used a bit differently.
        // It only triggers what kind of search action thats performed
        else if(action == Action.SEARCH && !searchDisabled) {

            if(search == null)
                search = new Search(operation, operation.getInput()[0]);
            else {
                search.setOperation(operation);
                search.setInput(operation.getInput()[0]);
            }
            doSearch(search);
            if(search.isFinished())
                return search.getResult();
        }
        else if(action == Action.MOVE || action == Action.DELETE ||
                action == Action.CHANGE || action == Action.YANK) {
            consoleBuffer.performAction(EditActionManager.parseAction(operation, consoleBuffer.getBuffer().getCursor(),
                    consoleBuffer.getBuffer().length(), consoleBuffer.getEditMode().getMode()));
        }
        else if(action == Action.ABORT) {
        }
        else if(action == Action.CASE) {
            //capitalize word
            if(operation.getMovement() == Movement.BEGINNING) {
                consoleBuffer.capitalizeWord();
            }
            //upper case word
            else if(operation.getMovement() == Movement.NEXT) {
                consoleBuffer.upperCaseWord();
            }
            //lower case word
            else if(operation.getMovement() == Movement.PREV) {
                consoleBuffer.lowerCaseWord();
            }
            //change case of the current char
            else {
                consoleBuffer.addActionToUndoStack();
                consoleBuffer.changeCase();
            }
        }
        else if(action == Action.COMPLETE) {
            if(operation.getMovement() == Movement.NEXT)
                complete();
            else {
                if(completionHandler != null) {
                    completionHandler.setAskDisplayCompletion(false);
                    consoleBuffer.getUndoManager().clear();
                    consoleBuffer.out().print(Config.getLineSeparator());
                    clearBufferAndDisplayPrompt();
                }
            }
        }
        else if(action == Action.EXIT || action == Action.EOF ||
                action == Action.INTERRUPT || action == Action.IGNOREEOF) {
            if(interruptHook != null) {
                interruptHook.handleInterrupt(action);
            }
        }
        else if(action == Action.HISTORY && !historyDisabled) {
            if(operation.getMovement() == Movement.NEXT)
                getHistoryElement(true);
            else if(operation.getMovement() == Movement.PREV)
                getHistoryElement(false);
        }
        else if(action == Action.UNDO) {
            undo();
        }
        else if(action == Action.PASTE_FROM_CLIPBOARD) {
            consoleBuffer.addActionToUndoStack();
            //paste();
        }
        else if(action == Action.PASTE) {
            if(operation.getMovement() == Movement.NEXT)
                consoleBuffer.paste(0, true);
            else
                consoleBuffer.paste(0, false);
        }
        else if(action == Action.CHANGE_EDITMODE) {
            changeEditMode(operation.getMovement());
        }
        else if(action == Action.CLEAR) {
            consoleBuffer.clear(true);
        }
        else if(action == Action.REPLACE) {
            consoleBuffer.replace(operation.getInput()[0]);
        }
        else if(action == Action.NO_ACTION) {
            //atm do nothing
        }
View Full Code Here

                logger.info("GOT: "+ Arrays.toString(in));
            }
            if (in[0] == -1) {
                return null;
            }
            Operation operation = editMode.parseInput(in, buffer.getLine());
            operation.setInput(in);

            String result = null;
            if(command != null)
                command.processOperation(operation);
            else
View Full Code Here

            //for(int i : in)
            //    System.out.println("got int:"+i);
            if (in[0] == -1) {
                return null;
            }
            Operation operation = editMode.parseInput(in);
            operation.setInput(in);

            String result = null;
            if(command != null)
                command.processOperation(operation);
            else
View Full Code Here

            //for(int i : in)
            //    System.out.println("got int:"+i);
            if (in[0] == -1) {
                return null;
            }
            Operation operation = editMode.parseInput(in);
            operation.setInput(in);

            String result = null;
            if(command != null)
                command.processOperation(operation);
            else
View Full Code Here

            else
                return Operation.NO_ACTION;
        }

        else if(currentOperations.size() == 1) {
            Operation operation = currentOperations.get(0).getOperation();
            Action workingMode = currentOperations.get(0).getWorkingMode();
            operationLevel = 0;
            currentOperations.clear();

            if(operation == Operation.NEW_LINE) {
View Full Code Here

                    level = in.length;
                if(currentOperations.get(0).getKeyValues().length > level) {
                    operationLevel++;
                    return Operation.NO_ACTION;
                }
                Operation currentOperation = currentOperations.get(0).getOperation();
                if(currentOperation == Operation.SEARCH_PREV ||
                        currentOperation == Operation.SEARCH_NEXT_WORD)
                    mode = Action.SEARCH;

                operationLevel = 0;
View Full Code Here

                    return new ConsoleOutput(new ConsoleOperation(ControlOperator.NONE, buffer.getLineNoMask()));
                }
            }
            else {

                Operation operation = editMode.parseInput(in, buffer.getLine());
                operation.setInput(in);

                String result = null;
                if(command != null)
                    command.processOperation(operation);
                else
View Full Code Here

TOP

Related Classes of org.jboss.aesh.edit.actions.Operation

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.