Search in sources :

Example 1 with UndoRedo

use of org.openide.awt.UndoRedo in project netbeans-rcp-lite by outersky.

the class UndoRedoAction method run.

@Override
public void run() {
    if (!EventQueue.isDispatchThread()) {
        EventQueue.invokeLater(this);
        return;
    }
    UndoRedo ur = getUndoRedo();
    last.removeChangeListener(weakCL);
    if (doUndo) {
        setEnabled(ur.canUndo());
    } else {
        setEnabled(ur.canRedo());
    }
    putValue(NAME, getName());
    last = ur;
    last.addChangeListener(weakCL);
}
Also used : UndoRedo(org.openide.awt.UndoRedo)

Example 2 with UndoRedo

use of org.openide.awt.UndoRedo in project netbeans-rcp-lite by outersky.

the class MultiViewCloneableTopComponent method getUndoRedo.

/**
 * Get the undo/redo support for this component.
 * The default implementation returns a dummy support that cannot
 * undo anything.
 *
 * @return undoable edit for this component
 */
public UndoRedo getUndoRedo() {
    UndoRedo retValue;
    retValue = peer.peerGetUndoRedo();
    if (retValue == null) {
        retValue = super.getUndoRedo();
    }
    return retValue;
}
Also used : UndoRedo(org.openide.awt.UndoRedo)

Example 3 with UndoRedo

use of org.openide.awt.UndoRedo in project netbeans-rcp-lite by outersky.

the class MultiViewTopComponent method getUndoRedo.

/**
 * Get the undo/redo support for this component.
 * The default implementation returns a dummy support that cannot
 * undo anything.
 *
 * @return undoable edit for this component
 */
@Override
public UndoRedo getUndoRedo() {
    UndoRedo retValue;
    retValue = peer.peerGetUndoRedo();
    if (retValue == null) {
        retValue = super.getUndoRedo();
    }
    return retValue;
}
Also used : UndoRedo(org.openide.awt.UndoRedo)

Example 4 with UndoRedo

use of org.openide.awt.UndoRedo in project JJazzLab-X by jjazzboss.

the class SongMemoEditor method getUndoManager.

/**
 * Use a local UndoManager per song.
 *
 * @return
 */
public UndoRedo getUndoManager() {
    UndoRedo res = songModel == null ? null : mapSongUndoer.get(songModel).getUndoManager();
    // NOI18N
    LOGGER.fine("getUndoManager() songModel=" + songModel + " UndoRedo=" + res);
    return res;
}
Also used : UndoRedo(org.openide.awt.UndoRedo)

Example 5 with UndoRedo

use of org.openide.awt.UndoRedo in project netbeans-rcp-lite by outersky.

the class UndoRedoAction method actionPerformed.

@Override
public void actionPerformed(ActionEvent ev) {
    UndoRedo undoRedo = getUndoRedo();
    if (doUndo)
        try {
            if (undoRedo.canUndo()) {
                undoRedo.undo();
            }
        } catch (CannotUndoException ex) {
            cannotUndoRedo(ex);
        }
    else
        try {
            if (undoRedo.canRedo()) {
                undoRedo.redo();
            }
        } catch (CannotRedoException ex) {
            cannotUndoRedo(ex);
        }
    run();
}
Also used : UndoRedo(org.openide.awt.UndoRedo)

Aggregations

UndoRedo (org.openide.awt.UndoRedo)6 List (java.util.List)1 UndoableEdit (javax.swing.undo.UndoableEdit)1