UndoRedo on Nodes (Part 2)

Posted by Geertjan on Oracle Blogs See other posts from Oracle Blogs or by Geertjan
Published on Thu, 24 Nov 2011 15:42:47 -0600 Indexed on 2011/11/25 2:09 UTC
Read the original article Hit count: 174

Filed under:

After the recording of the latest API Design Tip for the upcoming NetBeans Podcast, Jaroslav Tulach helped me with the problem I blogged about yesterday. First he expressed surprise at seeing Undo/Redo work on Nodes, which was never the intention, i.e., that feature was always intended for documents, e.g., the Java editor.

However, he then showed me where to find the Properties window in the NetBeans sources, where it is org.netbeans.core.windows.view.ui.NbSheet. It turns out that the Properties window does not have an activated node and hence the Node that implements UndoRedo.Manager is never put in the Lookup. Once we added, on line 303, "this.setActivatedNodes(nodes);", everything worked as expected, i.e., the Undo/Redo actions are now enabled, even when the Properties window is selected:

Maybe it means I should file an issue to get that line added to NbSheet?

© Oracle Blogs or respective owner