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.
From build 20041019-1432 it happens that some actions are disabled when a subnode of java node is selected. It is also problem when you are in method in source editor and try to invoke run or debug action. To reproduce: - create a java project with main class - select node Main.java|Main and try to run or debug class but menu items are disabled ("Run|Run Other|Run File") - or place cursor in Main() constructor and actions are disabled as well P1 because it breaks the commit validation suite.
It is caused by org.apache.tools.ant.module.api.support.ActionUtils.findSelectedFiles implementation. It does not expect that the context lookup might contain the same data object multiple times. So in that case it returns array of two same file objects and J2SEActionProvider.isActionEnabled evaluates it as false.
So, fix your node to not include the DataObject twice in its lookup! Just confirmed that the node for e.g. a ClassElement does in fact include two copies of the JavaDataObject. Why, I don't know. I will try to change ActionUtils to discard duplicate files as well, but this should not be necessary in normal cases such as for the commit validation; would help e.g. if the user selected the .java node and the class node at once (for some reason).
Additionally I wonder why compile-single action works and run-single doesn't. Shouldn't it be the same algorithm?
OK, I'll fix the nodes as soon as I will able to build the netbeans. For now it is broken on win platform. 2compile-single: Jesse should know more.
fixed in /cvs/java/src/org/netbeans/modules/java/ui/nodes/JavaSourceNodeFactory.java new revision: 1.15; previous revision: 1.14
Verified in build 20041021-0443.