AbstractNavTreeNode subclass usage?

I'm trying to use ProjectBrowserRoot root = designerContext.getProjectBrowserRoot(); and its children and childrens children to get project resources. I can get them as AbstractNavTreeNode, but whenever I try casting them (if thats the right thing to do here) to the more useful subtype of AbstractResourceNavTreeNode (or its subtypes) it breaks everything.

I'd like to use these so I can get selected project resources for use elsewhere.

I feel like I'm missing something here about how this works.


Not all nav tree nodes have a resource. I'd be surprised if the ones they manage are actually exposed in the nav tree, too. Is there any reason you cannot just query the project for the resources themselves? (Via DesignerContext => DesignableProject)

1 Like

Ah that might be why. I'm doing it this way because I'd like to get the currently selected resource for a custom designer menu (rather then selecting the resource separately through a ProjectResourceSelector). I did not see a way to tell if a resource is selected through the designable project but I may have missed something.

Ewww! Good luck with that. You're gonna need it, from what I recall from creating my own designer workspace.

lol thanks. That helped, I was able to 'solve' the problem with a surrounding try catch, so either that or hardcoding the names to what classes they will cast to should be an okay workaround

Can you elaborate on "custom designer menu"? As in, under your own resource node, or are you trying to bridge together multiple resources types?

not my own resource node, just a dockableFrame. Adding to this however i found there is a getSelectionModel on the browser root which should simplify finding the selected items.

1 Like