# AbstractNavTreeNode subclass usage?

**URL:** <https://forum.inductiveautomation.com/t/abstractnavtreenode-subclass-usage/74923>\
**Category:** Module Development\
**Tags:** ignition81\
**Created:** [June 12, 2023, 7:19pm UTC](https://forum.inductiveautomation.com/t/abstractnavtreenode-subclass-usage/74923 "2023-06-12T19:19:14Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robert\_McIlvenna](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/robert_mcilvenna/32/80238_2.png) [@Robert\_McIlvenna](https://forum.inductiveautomation.com/u/Robert_McIlvenna)\
**Post date:** [June 12, 2023, 7:19pm UTC](https://forum.inductiveautomation.com/t/abstractnavtreenode-subclass-usage/74923/1 "2023-06-12T19:19:15Z")

</div>

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.

Thanks

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [June 12, 2023, 7:27pm UTC](https://forum.inductiveautomation.com/t/abstractnavtreenode-subclass-usage/74923/2 "2023-06-12T19:27:12Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![Robert\_McIlvenna](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/robert_mcilvenna/32/80238_2.png) [@Robert\_McIlvenna](https://forum.inductiveautomation.com/u/Robert_McIlvenna)\
**Post date:** [June 12, 2023, 7:35pm UTC](https://forum.inductiveautomation.com/t/abstractnavtreenode-subclass-usage/74923/3 "2023-06-12T19:35:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [June 12, 2023, 7:37pm UTC](https://forum.inductiveautomation.com/t/abstractnavtreenode-subclass-usage/74923/4 "2023-06-12T19:37:50Z")

</div>

> [@Robert\_McIlvenna](#):
>
> custom designer menu

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

---

<div class="post-metadata">

**Author:** ![Robert\_McIlvenna](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/robert_mcilvenna/32/80238_2.png) [@Robert\_McIlvenna](https://forum.inductiveautomation.com/u/Robert_McIlvenna)\
**Post date:** [June 12, 2023, 7:42pm UTC](https://forum.inductiveautomation.com/t/abstractnavtreenode-subclass-usage/74923/5 "2023-06-12T19:42:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 12, 2023, 8:05pm UTC](https://forum.inductiveautomation.com/t/abstractnavtreenode-subclass-usage/74923/6 "2023-06-12T20:05:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Robert\_McIlvenna](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/robert_mcilvenna/32/80238_2.png) [@Robert\_McIlvenna](https://forum.inductiveautomation.com/u/Robert_McIlvenna)\
**Post date:** [June 12, 2023, 9:31pm UTC](https://forum.inductiveautomation.com/t/abstractnavtreenode-subclass-usage/74923/7 "2023-06-12T21:31:59Z")

</div>

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.
