This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 151062 - Support Undo/Redo Across TopComponents
Summary: Support Undo/Redo Across TopComponents
Status: NEW
Alias: None
Product: platform
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker (vote)
Assignee: tomwheeler
Depends on:
Reported: 2008-10-22 19:17 UTC by tomwheeler
Modified: 2008-12-22 10:25 UTC (History)
2 users (show)

See Also:
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description tomwheeler 2008-10-22 19:17:08 UTC
The current state of Undo/Redo support in the NetBeans Platform is that the UndoAction and RedoAction listen for changes
in the UndoRedoManager provided by the active TopComponent.  That's fine for simple cases in which a single TopComponent
is responsible for all edits to some particular data, but does not handle the more complex case where multiple
TopComponents (posssibly in a TopComponentGroup) are responsible.

It is therefore difficult to properly coordinate undo and redo operations that span TopComponents.  An example of this
might be when some data is removed from one TC through a drop operation and then added to another TC via a drop operation.
Comment 1 Antonin Nebuzelsky 2008-11-13 15:27:14 UTC
Jardo, can you comment? You had some thoughts about this issue I believe.
Comment 2 Jaroslav Tulach 2008-11-13 16:11:22 UTC
Tom, why can't you return the same instance of UndoRedo from all your components? This is how the "sharability" of 
undo/redo was supposed to be implemented.
Comment 3 tomwheeler 2008-11-13 17:22:47 UTC
That is effectively what we're doing now.  It has worked fine so far, but I must admit it didn't feel right, probably
because I could not find neither documentation or examples suggesting this as a valid approach.  

When you say "this is how the 'sharability' of undo/redo was supposed to be implemented," do you know of any public
material that discusses this?  I have read the documentation, sources and test cases for the UI Utilities and Window
System API modules, but did not find anything to indicate how to use it across TopComponents.  
Comment 4 Jaroslav Tulach 2008-11-14 21:24:34 UTC
The UndoRedo system has been designed prior Sun acquisition of I think I wrote a documentation about 
that, but it is lost for ten years, I guess.

On the other hand, it just enhances Swing Undo/Redu with listeners. Sharing one UndoManagers among multiple sources by 
adding more addUndoableEditListeners is definitely supported. 

The docs are at:
But if you write an FAQ about your NetBeans experiences, I'll be happy to review them. Can I assign the issue to you?
Comment 5 tomwheeler 2008-11-14 21:28:37 UTC
Sure, it might take me a few weeks to find the time, but I'd certainly volunteer to write an FAQ about this if you'll 
review it for accuracy.  I've assigned the issue to myself in anticipation of that.