Bug 151062 - Support Undo/Redo Across TopComponents
Support Undo/Redo Across TopComponents
Status: NEW
Product: platform
Classification: Unclassified
Component: -- Other --
5.x
All All
: P3 (vote)
: TBD
Assigned To: tomwheeler
issues@platform
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-10-22 19:17 UTC by tomwheeler
Modified: 2008-12-22 10:25 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments

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 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?
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.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo