Example usage for javax.swing.undo CannotRedoException CannotRedoException

List of usage examples for javax.swing.undo CannotRedoException CannotRedoException

Introduction

In this page you can find the example usage for javax.swing.undo CannotRedoException CannotRedoException.

Prototype

CannotRedoException

Source Link

Usage

From source file:UndoDrawing.java

public void redo() throws CannotRedoException {
    super.redo();
    if (savedPolygon == null) {
        // Should never get here, as super() doesn't permit redoing
        throw new CannotRedoException();
    } else {/*from w  w w. ja  va2 s .  c  om*/
        panel.setPolygon(savedPolygon);
        savedPolygon = null;
    }
}

From source file:ca.sqlpower.object.undo.PropertyChangeEdit.java

/**
 * Sets the value of the property to be the new value
 *///from  w w w.j  a  v  a  2s.  c  o m
@Override
public void redo() throws CannotRedoException {
    logger.debug("Undoing Property change: Setting " + sourceEvent.getPropertyName() + " from "
            + sourceEvent.getOldValue() + " to " + sourceEvent.getNewValue());
    super.redo();
    try {
        Method setter = PropertyUtils.getWriteMethod(
                PropertyUtils.getPropertyDescriptor(sourceEvent.getSource(), sourceEvent.getPropertyName()));
        logger.info("Found setter: " + setter.getName());
        setter.invoke(sourceEvent.getSource(), sourceEvent.getNewValue());

    } catch (Exception ex) {
        CannotRedoException wrapper = new CannotRedoException();
        wrapper.initCause(ex);
        throw wrapper;
    }
}