001/**
002 * 
003 */
004package icy.sequence.edit;
005
006import icy.roi.ROI;
007import icy.sequence.Sequence;
008
009import javax.swing.undo.CannotRedoException;
010import javax.swing.undo.CannotUndoException;
011
012/**
013 * ROI add Sequence edit event
014 * 
015 * @author Stephane
016 */
017public class ROIAddSequenceEdit extends AbstractROISequenceEdit
018{
019    public ROIAddSequenceEdit(Sequence sequence, ROI source, String name)
020    {
021        super(sequence, source, name);
022    }
023
024    public ROIAddSequenceEdit(Sequence sequence, ROI source)
025    {
026        this(sequence, source, "ROI added");
027    }
028
029    @Override
030    public void undo() throws CannotUndoException
031    {
032        super.undo();
033
034        getSequence().removeROI(getROI(), false);
035    }
036
037    @Override
038    public void redo() throws CannotRedoException
039    {
040        super.redo();
041
042        getSequence().addROI(getROI(), false);
043    }
044}