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.
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.
Jardo, can you comment? You had some thoughts about this issue I believe.
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.
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.
The UndoRedo system has been designed prior Sun acquisition of NetBeans.com. 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: http://java.sun.com/javase/6/docs/api/javax/swing/undo/package-summary.html http://java.sun.com/docs/books/tutorial/uiswing/components/generaltext.html#undo But if you write an FAQ about your NetBeans experiences, I'll be happy to review them. Can I assign the issue to you?
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.