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.
When creating Explorer using BeanTreeView: Rather annoying. I tried with the ActionMapPopupAction = (PA)SystemAction.get(PA.class);map.put(a.getActionMapKey(), a);but this just caused a StackOverflowError when I tried to press S-F10! Anyway it is not supposed to be necessary to do anything, since the BeanTreeView already has PA's key in its ActionMap It works with Jardas workaround: See: http://nbbuild.netbeans.org/source/browse/projects/projectui/src/org/netbeans/modules/project/ui/Attic/ProjectTab.java.diff?r1=1.1.2.7&r2=1.1.2.8&showattic=1
Note that such a trick is not necessary for e.g. PhadhailViews.ExpPanel in threaddemo - S-F10 works automatically. Shouldn't TopComponent's processKeyBinding override take care of this automatically?
What exactly makes it work in PhadhailViews.ExpPanel? Who is handling the Shift-F10 shortcut? I have identified the problem with ProjectTab.java that the ActionMap in globalActionContext is not org.openide.windows.DelegateActionMap, but just the actual getActionMap returned from TopComponent. The solution might be to always return DelegateActionMap from TopComponent.getActionMap.
In PhadhailViews, there is only Object key = "org.openide.actions.PopupAction"; KeyStroke ks = KeyStroke.getKeyStroke("shift F10"); tree.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks, key); where tree is a BeanTreeView. Otherwise there is no binding for S-F10, of course. In the case of ProjectTab, S-F10 is not bound in the input map as such, but the window system's ShortcutAndMenuKeyEventProcessor interprets it anyway. However for whatever reason, in this case the ActionMap for the BeanTreeView is not searched. I don't really understand why that is, but I presume whatever the reason, it is the justification for DelegateActionMap. Which would mean that ProjectTab does in fact need to return a delegating ActionMap from its Lookup.
Created attachment 12820 [details] Addition of TopComponent.associateLookup
Seems that the only way how to fix this problem is to allow to associate lookup to TopComponent after the super constructor is finished and also by default use DelegatingActionMap as the map for all top components. I've added protected final TopComponent.associateLookup method that can be called once. Is this acceptable solution? Is this the right name for the method? Can it be final, or should I make it non-final?
Thanks for review, will be implemented tomorrow.
Checking in openide-spec-vers.properties; /cvs/openide/openide-spec-vers.properties,v <-- openide-spec-vers.properties new revision: 1.131; previous revision: 1.130 done Processing log script arguments... More commits to come... Checking in api/doc/changes/apichanges.xml; /cvs/openide/api/doc/changes/apichanges.xml,v <-- apichanges.xml new revision: 1.184; previous revision: 1.183 done Processing log script arguments... More commits to come... Checking in src/org/openide/explorer/ExplorerUtils.java; /cvs/openide/src/org/openide/explorer/ExplorerUtils.java,v <-- ExplorerUtils.java new revision: 1.4; previous revision: 1.3 done Processing log script arguments... More commits to come... Checking in src/org/openide/windows/DelegateActionMap.java; /cvs/openide/src/org/openide/windows/DelegateActionMap.java,v <-- DelegateActionMap.java new revision: 1.5; previous revision: 1.4 done Checking in src/org/openide/windows/TopComponent.java; /cvs/openide/src/org/openide/windows/TopComponent.java,v <-- TopComponent.java new revision: 1.116; previous revision: 1.115 done Processing log script arguments... More commits to come... RCS file: /cvs/openide/test/unit/src/org/openide/windows/TopComponentGetLookupOverridenTest.java,v done Checking in test/unit/src/org/openide/windows/TopComponentGetLookupOverridenTest.java; /cvs/openide/test/unit/src/org/openide/windows/TopComponentGetLookupOverridenTest.java,v <-- TopComponentGetLookupOverridenTest.java initial revision: 1.1 done Checking in test/unit/src/org/openide/windows/TopComponentGetLookupTest.java; /cvs/openide/test/unit/src/org/openide/windows/TopComponentGetLookupTest.java,v <-- TopComponentGetLookupTest.java new revision: 1.18; previous revision: 1.17 done
I've tested the fix and it works for me => Verified.