Class UndoTools

java.lang.Object
de.hybris.platform.cockpit.util.UndoTools

public class UndoTools extends Object
  • Constructor Details

    • UndoTools

      public UndoTools()
  • Method Details

    • undo

      public static void undo(UndoManager undoManager, UndoableOperation operation) throws CannotUndoException
      Performs undo of all operation from the top of the stack to the given one.
      Parameters:
      undoManager - the undo manager
      operation - the operation
      Throws:
      CannotUndoException - when one of the operations throws it
    • 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, 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
    • startUndoGrouping

      public static void startUndoGrouping()
      Starts grouping of undo-able operations. All operations will be added to a group instead of adding to the undo manager stack. To stop grouping, call stopUndoGrouping(UndoManager um, Object eventSource). Calling it the group sill be added to the undo manager stack as one bulk operation. Note: the grouping is per thread.
      See Also:
    • stopUndoGrouping

      public static void stopUndoGrouping(UndoManager undoManager, 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:
    • stopUndoGrouping

      public static void stopUndoGrouping(UndoManager undoManager, Object eventSource, BulkUndoableOperation bulk)
    • getGroupedOperations

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

      public static void discardUndoGrouping()
      Discards undo grouping without adding any undo operations to undo manager.
      See Also:
    • addOperationAndEventInternal

      public static void addOperationAndEventInternal(UndoManager undoManager, UndoableOperation operation, Object eventSource)
    • isItemValid

      public static boolean isItemValid(TypedObject typedObject)