@Override public void execute() { if (!line.equals(bar.getLifeline())) return; if (afterBar != null) { newPos = line.getActivationBars().indexOf(afterBar); oldPos = line.getActivationBars().indexOf(bar); if (!(newPos < oldPos)) newPos -= 1; if (newPos == oldPos) return; line.moveActivationBar(newPos, bar); } else { newPos = line.getActivationBars().size() - 1; oldPos = line.getActivationBars().indexOf(bar); line.moveActivationBar(newPos, bar); } }
@Override public void undo() { line.moveActivationBar(oldPos, bar); }
@Override public void redo() { line.moveActivationBar(newPos, bar); }