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.
If there is no project opened and the Find action is present on the toolbar, the state of the Find action is disabled when it should be enabled and vice versa. To reproduce: 1) Customize some of the toolbars - add action "Find in Projects..." to it. 2) Close all projects. 3) Open and activate window Favorites. 4) In the Favorites window, select and unselect the first node. The Find action's button in the toolbar will be enabled if there is no node selected and it will be disabled if there is a node selected. This is exactly opposite behaviour to the expected one.
This is caused by a trivial mistake in class SearchScopeNodeSelection. It listens on TopComponent.Registry for changes in the set of _selected_ nodes but then it asks for _activated_ nodes. This, combined with the order of property change events fired by TopComponent.Registry (see below) causes the bad behaviour. It seems that when a first node is selected in a TopComponent, the following happens: 1) TopComponent.Registry's value of _selectedNodes_ is updated. (such that it contains a one-element array containing the just selected node). Value if _activatedNodes_ is not updated yet. 2) TopComponent.Registry notifies all registered PropertyChangeListeners (propertyName is "PROP_SELECTED_NODES"). 3) TopComponent.Registry's value of _activatedNodes_ is updated. (such that it contains a one-element array containing the just selected node). 4) TopComponent.Registry notifies all registered PropertyChangeListeners (propertyName is "PROP_ACTIVATED_NODES"). SearchScopeNodeSelection asks for an array of _activatedNodes_ during step 2), i.e. just before the value is updated. The consequence is that it always gets the previous value. If the user just toggles between empty selection and one-node selection, the result is that state of SearchScopeNodeSelection is always quite opposite than it should be.
Fixed in the trunk. Modified file: utilities/src/org/netbeans/modules/search/SearchScopeNodeSelection.java (1.9) Diff: http://deadlock.netbeans.org/fisheye/browse/netbeans/utilities/src/org/netbeans/modules/search/SearchScopeNodeSelection.java?r1=1.8&r2=1.9
Target milestone set to the actual milestone (6.1).