Class UndoTools


  • public class UndoTools
    extends java.lang.Object
    • Constructor Detail

      • UndoTools

        public UndoTools()
    • Method Detail

      • redo

        public static void redo​(UndoManager undoManager,
                                UndoableOperation operation)
                         throws CannotRedoException
        Performs re-do of all operation from the top of the stack to the given one.
        Parameters:
        undoManager - the undo manager
        operation - the operation
        Throws:
        CannotRedoException - when one of the operations throws it
      • addUndoOperationAndEvent

        public static void addUndoOperationAndEvent​(UndoManager undoManager,
                                                    UndoableOperation operation,
                                                    java.lang.Object eventSource)
        Adds the given operation to the undo stack and sends global undo event.
        Parameters:
        undoManager - the undo manager
        operation - the operation to be added
        eventSource - the object to be used as source of the undo event
      • stopUndoGrouping

        public static void stopUndoGrouping​(UndoManager undoManager,
                                            java.lang.Object eventSource)
        Stops the grouping of undo-able operations. The group sill be added to the undo manager stack as one bulk operation. See startUndoGrouping() for more details about operation grouping and how to start it. Note: the grouping is per thread.
        Parameters:
        undoManager - the undo manager
        eventSource - the object to be used as source of undo event
        See Also:
        startUndoGrouping()
      • getGroupedOperations

        public static java.util.List<UndoableOperation> getGroupedOperations()
        Returns list of currently grouped operations (See startUndoGrouping()).
        Returns:
        list of currently grouped operations
      • addOperationAndEventInternal

        public static void addOperationAndEventInternal​(UndoManager undoManager,
                                                        UndoableOperation operation,
                                                        java.lang.Object eventSource)
      • isItemValid

        public static boolean isItemValid​(TypedObject typedObject)