Package ptolemy.kernel.undo

Examples of ptolemy.kernel.undo.UndoAction


        if (!movedOne) {
            // Do not generate any undo action if no move happened.
            return;
        }

        UndoAction undoAction = new UndoAction() {
            public void execute() {
                try {
                    // Undo has to reverse the order of the do.
                    if ((type == TO_FIRST) || (type == UP)) {
                        // Traverse the list in forward order.
                        Iterator targetIterator = targets.iterator();

                        for (int i = 0; i < targets.size(); i++) {
                            NamedObj target = (NamedObj) targetIterator.next();
                            target.moveToIndex(priorIndexes[i]);
                        }
                    } else {
                        // Traverse the list in reverse order.
                        ListIterator targetIterator = targets
                                .listIterator(targets.size());

                        for (int i = targets.size() - 1; i >= 0; i--) {
                            NamedObj target = (NamedObj) targetIterator
                                    .previous();
                            target.moveToIndex(priorIndexes[i]);
                        }
                    }
                } catch (IllegalActionException e) {
                    // This should only be thrown if the target
                    // has no container, which in theory is not
                    // possible.
                    throw new InternalErrorException(e);
                }

                // Create redo action.
                UndoAction redoAction = new UndoAction() {
                    public void execute() {
                        move(targets, type, context);
                    }
                };
View Full Code Here

TOP

Related Classes of ptolemy.kernel.undo.UndoAction

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.