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.
See issue #27769, the part talking about ToolsAction. There is a problem when creating popup menu, ToolsAction menu item asks all its subActions whether there is at least one enabled. In that case the menu item is visible otherwise the menu item is not visible, but is there (JInlineMenu). This takes a longer time when no sub actio is enabled (all of actions has to be examined->). I guess there should be measured how much takes the sub action enablement check and then act accordingly.
Well it seems the problem doesn't lie in the checking of enablement status. I examined inovking popup on filesystem node (where currently all tools sub actions are disabled, i.e. all of them has to be examined. I measured ToolsAction.G.isPopupEnabled method, which does the job. When the popup invoked first time, the time spend in that method was 600, 700 or 300 ms. But all subsequent calls (next invocations of popup on the same or other nodes) took just about 20 ms. I found out that the time isn't spent in action.isEnabled method, like it was expected but it took some time when contextAwareAction was created first time. I guess some initialization in that modules is done, or some classes of those modules are loaded, and therefore it is slow. The most slow actions were in my attempt: org.netbeans.modules.web.dd.ConvertTo13SpecAction, 98ms org.netbeans.modules.java.imptool.ImpToolAction, 79ms org.netbeans.modules.javadoc.GenerateDocAction, 80ms but also all others had some small amount which in sum gives the bigger number. Be aware then when you invoke it second time, it takes 0ms, and context aware actions aren't cached, each time is a new instance created.! Tomas please continue the investigation.
Adding to plan for milestone 3, as this is important to solve somehow.
Fixed in [trunk] core/ui/../ContextMenuWarmUpTask.java 1.2 Note: Actually the problem seems to be that there is done something when first time the popup is created, i.e. when context aware instances of tools sub actions are first time created (used in popup). I guess it isn't a class loading problem (like I thought before), but that there is some init done either in those context sensitive instances or in lookup (template/result) which is used by those actions. I didn't go further, but created warm up task which solves the problem of first invocation (it simulates the first invocation). On my machine it saves from 300-500ms (sometime even more!) upon the first popup invocation. You can measure it the way that you measure how long takes method ToolAction.G.isPopupEnabled() processing.
Congratulations. I have this issue when I right click ant tree item for first time during session. Takes about 1.5 seconds on my XP1800+.