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.

Bug 50644 - Element nodes doesn't enable actions
Summary: Element nodes doesn't enable actions
Status: CLOSED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 4.x
Hardware: All All
: P1 blocker (vote)
Assignee: Jan Pokorsky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-10-20 10:26 UTC by Jiri Skrivanek
Modified: 2007-09-26 09:14 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Skrivanek 2004-10-20 10:26:14 UTC
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.
Comment 1 Jan Pokorsky 2004-10-20 13:50:15 UTC
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.
Comment 2 Jesse Glick 2004-10-20 16:24:53 UTC
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).
Comment 3 Jiri Skrivanek 2004-10-20 16:31:19 UTC
Additionally I wonder why compile-single action works and run-single
doesn't. Shouldn't it be the same algorithm?
Comment 4 Jan Pokorsky 2004-10-20 16:37:39 UTC
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.
Comment 5 Jan Pokorsky 2004-10-20 17:16:16 UTC
fixed in

/cvs/java/src/org/netbeans/modules/java/ui/nodes/JavaSourceNodeFactory.java
new revision: 1.15; previous revision: 1.14
Comment 6 Jiri Skrivanek 2004-10-21 08:33:41 UTC
Verified in build 20041021-0443.