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.
Unable to select nodes on the Runtime tab. Am using stripped version of the prj40_prototype. In the UI, the Runtime tab looks like this: Runtime - Server Registry - ServerA - ServerInstance - ServerTarget - Processes - (No processes running) TopComponent.getRegistry().getActivated() returns class org.netbeans.core.NbMainExplorer$MainTab This explorer objects implements ExplorerManager.Provider so I use it to find the ExplorerManager. ExplorerManager getRootContext() returns org.openide.nodes.AbstractNode@3d246[Name=, displayName=] The root node has no children. If I use the explorer object directly, I can get the currently active node which is FilterNode. Activated Node: org.openide.nodes.FilterNode@470f32[Name=, displayName=Sample JSR88 plugin] This node has several children: Child of Activated Node: org.openide.nodes.FilterNode@411557[Name=, displayName=Sample JSR88 plugin(123)] Child of Activated Node: org.openide.nodes.FilterNode@6023f7[Name=, displayName=Sample JSR88 plugin(FooServerUrl)] Child of Activated Node: org.openide.nodes.FilterNode@595033[Name=, displayName=Sample JSR88 plugin(qwerty)] Child of Activated Node: org.openide.nodes.FilterNode@20463e[Name=, displayName=Sample JSR88 plugin(url6)] Child of Activated Node: org.openide.nodes.FilterNode@63a921[Name=, displayName=Sample JSR88 plugin(BarServerUrl)] Child of Activated Node: org.openide.nodes.FilterNode@74c144[Name=, displayName=Sample JSR88 plugin(url1)] Child of Activated Node: org.openide.nodes.FilterNode@3c765e[Name=, displayName=Sample JSR88 plugin(fixedurl)] Child of Activated Node: org.openide.nodes.FilterNode@7f2036[Name=, displayName=Sample JSR88 plugin(xyz)] Child of Activated Node: org.openide.nodes.FilterNode@1bd427[Name=, displayName=Sample JSR88 plugin(Url4)] Child of Activated Node: org.openide.nodes.FilterNode@54f93[Name=, displayName=Sample JSR88 plugin(Url3)] Child of Activated Node: org.openide.nodes.FilterNode@2b4292[Name=, displayName=Sample JSR88 plugin(Url2)] Child of Activated Node: org.openide.nodes.FilterNode@1fac35[Name=, displayName=Sample JSR88 plugin(url7)] But if I try to select them using TopComponent setActivatedNodes(Node[]), nothing happens. If I try to select them using ExplorerManager setSelectedNodes(Node[]) I get an IllegalArgumentException "A node selection cannot contain nodes not underneath the root"
Jeri, I tried reproduce this issue and it worked for me. I attach a me test code, could you run it? The test assume by run internally of course and the Explorer/Runtime is activated. Send me please, how it works for you. Thanks.
Created attachment 7947 [details] source for test
Created attachment 7950 [details] test code put into an action class
This is the output from the test run: [exec] COMP: org.netbeans.core.NbMainExplorer$MainTab[Runtime,2,2,369x431,layout=java.awt.BorderLayout,alignmentX=null,alignmentY=null,border=,fl ags=1,maximumSize=,minimumSize=,preferredSize=] [exec] 0. activated node: org.openide.nodes.FilterNode@6d06b0[Name=, displayName=Server Registry (tools jsr version) (No default server)] [exec] root: org.openide.nodes.AbstractNode@4ce5eb[Name=, displayName=] I had to make some changes to your code because my module cannot have a dependency on org.netbeans.core.NbMainExplorer. I also put the code into an action class for an action on one of the nodes on the runtime tab. (See second attachment dated 2002-11-14) As you can see from the output, the ExplorerManager seems to be wrong, it doesn't seem to match the TopComponent. The root node returned by the ExplorerManager is an AbstractNode with no name or display name, and it has no children. This was built and run on the projects (prj40_prototype) branch. Please disregard the first attachment, its not the correct file. The second one sent 2002-11-14 is correct.
Created attachment 7951 [details] modified test code (correct file)
Hi Jeri, I have some like as hot fix. Replace expMgr = ExplorerManager.find(tc) with this code: ExplorerPanel expPanel = null; if (tc instanceof ExplorerPanel) { expPanel = (ExplorerPanel)tc; } ExplorerManager expMgr = expPanel.getExplorerManager (); It should work for you :) Is it accpetable? -jiri
Hi Jiri, The workaround that you suggested didn't work. I still get the IllegalArgumentException. I'll send you an attachment with the test code that I used. Have you tried this on the projects branch (prj40_prototype)? --Jeri [exec] java.lang.IllegalArgumentException: A node selection cannot contain nodes (Sample JSR88 plugin(server3)) not underneath the root (Runtime) [exec] at org.openide.explorer.ExplorerManager.setSelectedNodes(ExplorerManager.java:150) [exec] at org.netbeans.modules.j2ee.deployment.impl.ui.actions.FindDeploymentManagerAction$1.run(FindDeploymentManagerAction.java:98) [exec] at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:149) [exec] at java.awt.EventQueue.dispatchEvent(EventQueue.java:332) [exec] [catch] at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:126) [exec] at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:93) [exec] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:88) [exec] at java.awt.EventDispatchThread.run(EventDispatchThread.java:80)
Created attachment 7993 [details] ExplorerPanel workaround
I not tried it on projects branch but it should work on it because it based on nb34. There wasn't any changes on this code. Make sure that found node is from the root subtree. No other can be selected. If node isn't from the root subtree, you should add it and then select it.
You'll need to run the test on the projects branch to duplicate the problem. It is not working on this branch for some reason. I am working in the stripped version. The ExplorerManager returns an Abstract Node for its root. This node has no name or display name and no children. The TopComponent returns the proper root and children. So, for some reason, the ExplorerManager doesn't know about the nodes that are in the TopComponent. Here is some additional information: TopComponent.setActivatedNodes() does nothing when passed an array of children of the root of the TopComponent. The nodes that I am trying to activate do exist in the TopComponent.
This issue was reported on the prj40_prototype branch, so I set back version 4.0 and mark with PROJECTS keyword.
Jeri, I assured the attached test worked on prj40_prototype branch. Project's codeline was changes a lot, now it works for me. Ad your FindDeploymentManagerAction.java: Make sure, that a root node given to method findInstanceNode(root) comes from hierarchy of ExplorerPanel.getExplorerManager().getRootContext(). Hope it works for you too. Feel free to contact me (directly via mail or via this issue) if any problem appears. Regards, Jiri
verifying.