public static TGUndoableTripletFeel startUndo(TGContext context, TGMeasureHeader header) { TGUndoableTripletFeel undoable = new TGUndoableTripletFeel(context); undoable.doAction = UNDO_ACTION; undoable.position = header.getStart(); undoable.undoableTripletFeel = header.getTripletFeel(); undoable.nextTripletFeelPositions = new ArrayList<Object>(); int prevTripletFeel = undoable.undoableTripletFeel; Iterator<TGMeasureHeader> it = getSong(context).getMeasureHeaders(); while (it.hasNext()) { TGMeasureHeader currHeader = it.next(); if (currHeader.getStart() > undoable.position) { int currTripletFeel = currHeader.getTripletFeel(); if (prevTripletFeel != currTripletFeel) { TripletFeelPosition tfp = undoable.new TripletFeelPosition(currHeader.getStart(), currTripletFeel); undoable.nextTripletFeelPositions.add(tfp); } prevTripletFeel = currTripletFeel; } } return undoable; }
public TGUndoableEdit startUndoable(TGContext context, TGActionContext actionContext) { return TGUndoableTripletFeel.startUndo( context, (TGMeasureHeader) actionContext.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_HEADER)); }