3 ## Implements a single undo list for the Sup instance
5 ## The basic idea is to keep a list of lambdas to undo
6 ## things. When an action is called (such as 'archive'),
7 ## a lambda is registered with UndoManager that will
8 ## undo the archival action
15 self.class.i_am_the_instance self
18 def register desc, actions
19 actions = [actions] unless actions.is_a?Array
20 raise StandardError, "when would I need to undo 'nothing?'" unless actions.length > 0
21 Redwood::log "registering #{actions.length} actions: #{desc}"
22 @@actionlist.push({:desc => desc, :actions => actions})
26 unless @@actionlist.length == 0 then
27 actionset = @@actionlist.pop
28 Redwood::log "undoing #{actionset[:desc]}..."
29 actionset[:actions].each{|action|
32 BufferManager.flash "undid #{actionset[:desc]}"
34 BufferManager.flash "nothing more to undo"