Changeset 6413 in josm for trunk/src/org


Ignore:
Timestamp:
2013-11-25T02:19:43+01:00 (11 years ago)
Author:
Don-vip
Message:

undo/redo: param check + javadoc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/UndoRedoHandler.java

    r6380 r6413  
    1212import org.openstreetmap.josm.gui.layer.Layer;
    1313import org.openstreetmap.josm.gui.layer.OsmDataLayer.CommandQueueListener;
     14import org.openstreetmap.josm.tools.CheckParameterUtil;
    1415
    1516public class UndoRedoHandler implements MapView.LayerChangeListener {
     
    2627    private final LinkedList<CommandQueueListener> listenerCommands = new LinkedList<CommandQueueListener>();
    2728
     29    /**
     30     * Constructs a new {@code UndoRedoHandler}.
     31     */
    2832    public UndoRedoHandler() {
    2933        MapView.addLayerChangeListener(this);
     
    3135
    3236    /**
    33      * Execute the command and add it to the intern command queue.
     37     * Executes the command and add it to the intern command queue.
     38     * @param c The command to execute. Must not be {@code null}.
    3439     */
    3540    public void addNoRedraw(final Command c) {
     41        CheckParameterUtil.ensureParameterNotNull(c, "c");
    3642        c.executeCommand();
    3743        commands.add(c);
     
    5359
    5460    /**
    55      * Execute the command and add it to the intern command queue.
     61     * Executes the command and add it to the intern command queue.
     62     * @param c The command to execute. Must not be {@code null}.
    5663     */
    5764    synchronized public void add(final Command c) {
     
    6976    /**
    7077     * Undoes multiple commands.
     78     * @param num The number of commands to undo
    7179     */
    7280    synchronized public void undo(int num) {
     
    104112    /**
    105113     * Redoes multiple commands.
     114     * @param num The number of commands to redo
    106115     */
    107116    public void redo(int num) {
     
    167176    public void activeLayerChange(Layer oldLayer, Layer newLayer) {}
    168177
     178    /**
     179     * Removes a command queue listener.
     180     * @param l The command queue listener to remove
     181     */
    169182    public void removeCommandQueueListener(CommandQueueListener l) {
    170183        listenerCommands.remove(l);
    171184    }
    172185
     186    /**
     187     * Adds a command queue listener.
     188     * @param l The commands queue listener to add
     189     * @return {@code true} if the listener has been added, {@code false} otherwise
     190     */
    173191    public boolean addCommandQueueListener(CommandQueueListener l) {
    174192        return listenerCommands.add(l);
Note: See TracChangeset for help on using the changeset viewer.