Re: Undo/redo implementation & JMI compliance
Svata Dedic <[email protected]>
| Newsgroups | gmane.comp.java.netbeans.modules.mdr.devel |
|---|---|
| Message-ID | <[email protected]> |
Holger Krug wrote: > On Wed, Jun 26, 2002 at 02:44:17PM +0200, Svata Dedic wrote: > > >>There are two kinds of Listeners. So called pre-change and >>post-change ones. You can store away object's properties when you >>get plannedChange() describing object deletion. > > a generic UndoManager. But is seems quite a heavy overhead for every > e.g. EVENT_ATTRIBUTE_SET to store away all necessary data to be > prepared for the case that the source object is deleted later on in > the same transaction. BTW I was not talking about copy-on-write on every operation. For "polite" operations, like attribute value change, your undo history can easily store the diff - or the <mofid, featureName, oldvalue, newvalue> tuple as an undoable operation base purely on the post-change event. Or for an association link being broken you can store <mofid1, assocEndName, mofid2>, again purely from the post-change event on the association object. I was suggesting copy-before-delete, since after delete you cannot access the object's features reliably through JMI. And please note that after you will be informed about object's deletion you will have to access all its attributes and association links in their state at the moment of the deletion for undo purposes. I don't quite understand, how getByMofId() could help you here: you could get the RefObject, but what it will be useful for, when it won't yield any attribute after someone called refDelete() on it ? Is there any way how to avoid copy-on-delete ? > Any JMI implementation which wants to use the Undo/Redo manager must > provide an implementation of this interface and must allow to call > RefBaseObject.refMofId() in the after deletion event handlers. This Can you please explain why lookup by MofID is so critical that it must be implemented by JMI service ? I couldn't follow the path from UndoManager functional requirements to this one. -Svata -- Svatopluk Dedic <mailto:[email protected]> NetBeans, Java/Repository <http://java.netbeans.org>