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.
[ BUILD # : 200408271257 ] [ JDK VERSION : J2SE 1.4.2_04 ] Try this generic case. 1. Open a project with two main classes call them A and B. 2. Open both in the editor. 3. Click on the tab for class A. 4. Click on the tab for class B (brings focus to edit B). 5. Now right click on the editor window for class B, the context menu says run "A.java". However if you select this, it actually runs B.java (which makes sense, you run the class you right click on). In any event someone could mistakenly run the wrong class, ouch!
NOTE: The first right-click is wrong. If you exit out of the context menu and then right click again the Run "X.java" appears correctly.
Yes, I can reproduce it.
fixed in [maintrunk] in editor module. /cvs/editor/src/org/netbeans/modules/editor/NbEditorKit.java,v <-- NbEditorKit.java new revision: 1.69; previous revision: 1.68 invoking action.isEnabled (which causes FileCommandAction refresh) before action.getValue(Action.NAME); Anyway, more appropriate solution would be to refresh displayName of the action just after the editor has receive the focus. The action itself is implemented in project module. Lowering priority to P4 and reassigning to project module for further considering...
Not sure what this is about. Petr can you evaluate?
I'll file another bug against me to improve the LookupSensitiveAction. Anyway, back to you, because the way you are building the popup menu is not correct. Notice that if the action being added into popup imlements ContextAwareAction you should use org.openide.util.Utilities.actionsToPopup().
Filled the bug against LookupSensitiveAction in projects: issue #48262
For ContextAwareAction-based actions we properly call createContextAwareInstance() in NbEditorKit.NbBuildPopupMenuAction if you've meant this.
fixed in [maintrunk] /cvs/editor/src/org/netbeans/modules/editor/NbEditorKit.java,v <-- NbEditorKit.java new revision: 1.70; previous revision: 1.69 Thanks Petr. You are right. In the case of FileCommandAction a ContextAwareAction instance was not created. I modified my previous fix. Now, it is not necessary to do mentioned workaround.