/** {@inheritDoc} */ @Override protected void perform(final Wave wave) throws CommandException { this.stackName = wave.get(UndoRedoWaves.STACK_NAME); final UndoRedoService service = getService(UndoRedoService.class, this.stackName); this.undoableCommand = wave.get(UndoRedoWaves.UNDOABLE_COMMAND); service.stackUp(this.undoableCommand); }
/** {@inheritDoc} */ @Override protected void perform(final Wave wave) { // Avoid to continue launching next command if cancellation has been requested if (!this.cancelRequested.get()) { if (isSequential()) { // Store the wave when we are running the first command synchronized (this) { if (this.commandRunIndex == 0) { this.waveSource = wave; fireConsumed(this.waveSource); } if (this.subCommandList.size() > this.commandRunIndex) { final Wave subCommandWave = Builders.callCommand(this.subCommandList.get(this.commandRunIndex).getClassField()) .waveBean(wave.waveBean()) // Recopy the WaveData from the previous wave .addDatas(wave.waveDatas().toArray(new WaveDataBase[0])) .addWaveListener(this); sendWave(subCommandWave); } } } else { // Store the original wave to be able to mark it as consumed when all of these sub comamnds // are achieved this.waveSource = wave; synchronized (this) { // Launch all sub command in parallel for (final UniqueKey<? extends Command> commandKey : this.subCommandList) { final Wave commandWave = getLocalFacade().retrieve(commandKey).run(); // register to Wave status of all command triggered commandWave.addWaveListener(this); // Store the pending command to know when all command are achieved this.pendingWaves.add(commandWave); } } } } }