Search in sources :

Example 1 with BinaryDataCommand

use of org.exbin.deltahex.operation.BinaryDataCommand in project deltahex-java by exbin.

the class CodeAreaUndoHandler method commandAdded.

private void commandAdded(@Nonnull BinaryDataCommand addedCommand) {
    // TODO: Check for undoOperationsMaximumCount & size
    while (commands.size() > commandPosition) {
        BinaryDataCommand command = commands.get((int) commandPosition);
        try {
            command.dispose();
        } catch (BinaryDataOperationException ex) {
            Logger.getLogger(CodeAreaUndoHandler.class.getName()).log(Level.SEVERE, null, ex);
        }
        commands.remove(command);
    }
    commands.add(addedCommand);
    commandPosition++;
    undoUpdated();
    for (BinaryDataUndoUpdateListener listener : listeners) {
        listener.undoCommandAdded(addedCommand);
    }
}
Also used : BinaryDataCommand(org.exbin.deltahex.operation.BinaryDataCommand) BinaryDataOperationException(org.exbin.deltahex.operation.BinaryDataOperationException) BinaryDataUndoUpdateListener(org.exbin.deltahex.operation.undo.BinaryDataUndoUpdateListener)

Example 2 with BinaryDataCommand

use of org.exbin.deltahex.operation.BinaryDataCommand in project deltahex-java by exbin.

the class CodeAreaUndoHandler method performUndoInt.

private void performUndoInt() throws BinaryDataOperationException {
    commandPosition--;
    BinaryDataCommand command = commands.get((int) commandPosition);
    command.undo();
}
Also used : BinaryDataCommand(org.exbin.deltahex.operation.BinaryDataCommand)

Example 3 with BinaryDataCommand

use of org.exbin.deltahex.operation.BinaryDataCommand in project deltahex-java by exbin.

the class HexCompoundCommand method undo.

@Override
public void undo() throws BinaryDataOperationException {
    for (int i = commands.size() - 1; i >= 0; i--) {
        BinaryDataCommand command = commands.get(i);
        command.undo();
    }
}
Also used : BinaryDataCommand(org.exbin.deltahex.operation.BinaryDataCommand)

Example 4 with BinaryDataCommand

use of org.exbin.deltahex.operation.BinaryDataCommand in project deltahex-java by exbin.

the class CodeAreaUndoHandler method clear.

@Override
public void clear() {
    for (BinaryDataCommand command : commands) {
        try {
            command.dispose();
        } catch (BinaryDataOperationException ex) {
            Logger.getLogger(CodeAreaUndoHandler.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    commands.clear();
    init();
    undoUpdated();
}
Also used : BinaryDataCommand(org.exbin.deltahex.operation.BinaryDataCommand) BinaryDataOperationException(org.exbin.deltahex.operation.BinaryDataOperationException)

Example 5 with BinaryDataCommand

use of org.exbin.deltahex.operation.BinaryDataCommand in project deltahex-java by exbin.

the class CodeAreaUndoHandler method performRedoInt.

private void performRedoInt() throws BinaryDataOperationException {
    BinaryDataCommand command = commands.get((int) commandPosition);
    command.redo();
    commandPosition++;
}
Also used : BinaryDataCommand(org.exbin.deltahex.operation.BinaryDataCommand)

Aggregations

BinaryDataCommand (org.exbin.deltahex.operation.BinaryDataCommand)6 BinaryDataOperationException (org.exbin.deltahex.operation.BinaryDataOperationException)2 BinaryDataUndoUpdateListener (org.exbin.deltahex.operation.undo.BinaryDataUndoUpdateListener)2 Clipboard (java.awt.datatransfer.Clipboard)1 FlavorEvent (java.awt.datatransfer.FlavorEvent)1 FlavorListener (java.awt.datatransfer.FlavorListener)1 CaretMovedListener (org.exbin.deltahex.CaretMovedListener)1 CaretPosition (org.exbin.deltahex.CaretPosition)1 EditationMode (org.exbin.deltahex.EditationMode)1 EditationModeChangedListener (org.exbin.deltahex.EditationModeChangedListener)1 SelectionChangedListener (org.exbin.deltahex.SelectionChangedListener)1 SelectionRange (org.exbin.deltahex.SelectionRange)1 CaretCapable (org.exbin.deltahex.capability.CaretCapable)1 EditationModeCapable (org.exbin.deltahex.capability.EditationModeCapable)1 SelectionCapable (org.exbin.deltahex.capability.SelectionCapable)1