Class CodeAreaUndoHandler

  • All Implemented Interfaces:
    org.exbin.bined.operation.undo.BinaryDataUndoHandler

    @ParametersAreNonnullByDefault
    public class CodeAreaUndoHandler
    extends java.lang.Object
    implements org.exbin.bined.operation.undo.BinaryDataUndoHandler
    Undo handler for binary editor.
    • Constructor Detail

      • CodeAreaUndoHandler

        public CodeAreaUndoHandler​(org.exbin.bined.swing.CodeAreaCore codeArea)
        Creates a new instance.
        Parameters:
        codeArea - code area component
    • Method Detail

      • execute

        public void execute​(org.exbin.bined.operation.BinaryDataCommand command)
                     throws org.exbin.bined.operation.BinaryDataOperationException
        Adds new step into revert list.
        Specified by:
        execute in interface org.exbin.bined.operation.undo.BinaryDataUndoHandler
        Parameters:
        command - command
        Throws:
        org.exbin.bined.operation.BinaryDataOperationException - if commands throws it
      • addCommand

        public void addCommand​(org.exbin.bined.operation.BinaryDataCommand command)
        Specified by:
        addCommand in interface org.exbin.bined.operation.undo.BinaryDataUndoHandler
      • performUndo

        public void performUndo()
                         throws org.exbin.bined.operation.BinaryDataOperationException
        Performs single undo step.
        Specified by:
        performUndo in interface org.exbin.bined.operation.undo.BinaryDataUndoHandler
        Throws:
        org.exbin.bined.operation.BinaryDataOperationException - if commands throws it
      • performRedo

        public void performRedo()
                         throws org.exbin.bined.operation.BinaryDataOperationException
        Performs single redo step.
        Specified by:
        performRedo in interface org.exbin.bined.operation.undo.BinaryDataUndoHandler
        Throws:
        org.exbin.bined.operation.BinaryDataOperationException - if commands throws it
      • performUndo

        public void performUndo​(int count)
                         throws org.exbin.bined.operation.BinaryDataOperationException
        Performs multiple undo step.
        Specified by:
        performUndo in interface org.exbin.bined.operation.undo.BinaryDataUndoHandler
        Parameters:
        count - count of steps
        Throws:
        org.exbin.bined.operation.BinaryDataOperationException - if commands throws it
      • performRedo

        public void performRedo​(int count)
                         throws org.exbin.bined.operation.BinaryDataOperationException
        Performs multiple redo step.
        Specified by:
        performRedo in interface org.exbin.bined.operation.undo.BinaryDataUndoHandler
        Parameters:
        count - count of steps
        Throws:
        org.exbin.bined.operation.BinaryDataOperationException - if commands throws it
      • clear

        public void clear()
        Specified by:
        clear in interface org.exbin.bined.operation.undo.BinaryDataUndoHandler
      • canUndo

        public boolean canUndo()
        Specified by:
        canUndo in interface org.exbin.bined.operation.undo.BinaryDataUndoHandler
      • canRedo

        public boolean canRedo()
        Specified by:
        canRedo in interface org.exbin.bined.operation.undo.BinaryDataUndoHandler
      • getMaximumUndo

        public long getMaximumUndo()
        Specified by:
        getMaximumUndo in interface org.exbin.bined.operation.undo.BinaryDataUndoHandler
      • getCommandPosition

        public long getCommandPosition()
        Specified by:
        getCommandPosition in interface org.exbin.bined.operation.undo.BinaryDataUndoHandler
      • doSync

        public void doSync()
                    throws org.exbin.bined.operation.BinaryDataOperationException
        Performs revert to sync point.
        Specified by:
        doSync in interface org.exbin.bined.operation.undo.BinaryDataUndoHandler
        Throws:
        org.exbin.bined.operation.BinaryDataOperationException - for operation handling issues
      • setUndoMaxCount

        public void setUndoMaxCount​(long maxUndo)
      • getUndoMaximumSize

        public long getUndoMaximumSize()
        Specified by:
        getUndoMaximumSize in interface org.exbin.bined.operation.undo.BinaryDataUndoHandler
      • setUndoMaximumSize

        public void setUndoMaximumSize​(long maxSize)
      • getUsedSize

        public long getUsedSize()
        Specified by:
        getUsedSize in interface org.exbin.bined.operation.undo.BinaryDataUndoHandler
      • getSyncPoint

        public long getSyncPoint()
        Specified by:
        getSyncPoint in interface org.exbin.bined.operation.undo.BinaryDataUndoHandler
      • setSyncPoint

        public void setSyncPoint​(long syncPoint)
        Specified by:
        setSyncPoint in interface org.exbin.bined.operation.undo.BinaryDataUndoHandler
      • setSyncPoint

        public void setSyncPoint()
        Specified by:
        setSyncPoint in interface org.exbin.bined.operation.undo.BinaryDataUndoHandler
      • getCommandList

        @Nonnull
        public java.util.List<org.exbin.bined.operation.BinaryDataCommand> getCommandList()
        Specified by:
        getCommandList in interface org.exbin.bined.operation.undo.BinaryDataUndoHandler
      • setCommandPosition

        public void setCommandPosition​(long targetPosition)
                                throws org.exbin.bined.operation.BinaryDataOperationException
        Performs undo or redo operation to reach given position.
        Specified by:
        setCommandPosition in interface org.exbin.bined.operation.undo.BinaryDataUndoHandler
        Parameters:
        targetPosition - desired position
        Throws:
        org.exbin.bined.operation.BinaryDataOperationException - for operation handling issues
      • addUndoUpdateListener

        public void addUndoUpdateListener​(org.exbin.bined.operation.undo.BinaryDataUndoUpdateListener listener)
        Specified by:
        addUndoUpdateListener in interface org.exbin.bined.operation.undo.BinaryDataUndoHandler
      • removeUndoUpdateListener

        public void removeUndoUpdateListener​(org.exbin.bined.operation.undo.BinaryDataUndoUpdateListener listener)
        Specified by:
        removeUndoUpdateListener in interface org.exbin.bined.operation.undo.BinaryDataUndoHandler