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.
[dev-200510111800, JDK 1.5.0-05] Javadoc added from Navigator for a method by action 'Create Javadoc' cannot be undone by Undo action. Steps to reproduce: 1) Have some class with method members without javadoc 2) Invoke action Create Javadoc from context menu of those methods in Navigator Javadoc comment is added to class but it cannot be undone by Undo action. P2 because Undo action is esential editing action and not being able to undo edits done by IDE action is really bad.
Milo, is there any chance to hook into Undo action from java/navigation or is it not implementable? I never touched any Undo code... thanks.
AFAIK the navigator's effect IS undoable you just need to focus the editor, right? The navigator generates text insertion which gets added to the editor's undo manager so it's normally undoable through getting the particular top component and calling tc.getUndoRedo().undo(). The only problem is how to know whether you are undoing the right edit because the UndoRedo won't give you the next edit to be undone. IMHO you could possibly limit the undoing to the state when the user does not change the focus out from the navigator and 'blindly' attempt to undo the last edit by the call that I have described above.
I'm hesitating if I should try Mila's approach (tricky to find editor anyway) but I thing I'll waive this bug completely. In any case it won't work 100% until UndoRedo mechanism will support some "marking" of the changes. I guess impact of this bug is very low compared to the huge effort that right fix would take.
After offline discussion with mkubec, I devided to downgrade to P3. While Undo functionality is important in editor, navigator's "add javadoc" is rarely used and Undo works OK after jump to editor. I'm even thinking about removing this functionality from navigator, as code modifications should be done through editor primarily. Sadly no similar action is available in our editor now AFAIK.
Java navigation part was reimplemented and this bug is obsolete, as new implementation doesn't and won't contain javadoc creating AFAIK.