@Override
    protected void perform(final Wave wave) throws CommandException {

        // Get the undo/redo flag to know which action to perform
        if (wave.contains(UndoRedoWaves.UNDO_REDO)) {

            // The flag is true perform undo action
            if (wave.get(UndoRedoWaves.UNDO_REDO)) {
                undo();
            } else {
                // The flag is false perform redo action
                redo();
            }

        } else {

            // If the flag is not set we must initialize the command
            init(wave);
            // Get existing wave data
            final List<WaveData<?>> data = wave.waveDatas();
            // and add the undoable command
            data.add(WBuilder.waveData(UndoRedoWaves.UNDOABLE_COMMAND, this));
            // in order to register it into the right command stack
            callCommand(StackUpCommand.class, data.toArray(new WaveDataBase[data.size()]));
        }

    }
@ Override protected void perform ( final Wave wave ) throws CommandException { if ( wave . contains ( UndoRedoWaves . UNDO_REDO ) ) { if ( wave . get ( UndoRedoWaves . UNDO_REDO ) ) { undo ( ) ; } else { redo ( ) ; } } else { init ( wave ) ; final List < WaveData < ? > > data = wave . waveDatas ( ) ; data . add ( WBuilder . waveData ( UndoRedoWaves . UNDOABLE_COMMAND , this ) ) ; callCommand ( StackUpCommand . class , data . toArray ( new WaveDataBase [ data . size ( ) ] ) ) ; } }
{@inheritDoc}