KnownPluginList::addToMenu addition

I would like to modify the addToMenu function thats possible to create a ValueTree, that has the same structure like the generated Menu.
I need that to create a Pluginselector TreeView or for various other menus other then PopupMenus.
My Plan is first to create a:

and the use this inside the addToMenu(…) function (to avoid duplication of code).

Jules, if i write this createSortedPluginValueTree()-method would you insert it into the KnownPluginList class? or do you have better suggestions?

Isn’t it possible to do that without having to modify the existing classes? Can’t you just write a recursive function to map between the two things?

not sure would you mean with recursive function? I need the same functionality as in addToMenu, do you mean create the structure from the generated popup-menu, i think that’s not really elegant.

A really inelegant thing to do would be to introduce an unnecessary dependency between the KnownPluginList and ValueTree classes.

Doesn’t the class provide enough accessor methods to do what you need without modifying it?

i will try that, the only think i sorrow is the duplication of code… but i can live with that.
Anyway there a thousand ways to over-engineer the class to allow such kind of application, i thought using a value-tree (which is i think a very elementary object to handle tree-like sturctures and not very specific) is one of the best solutions.

I thing its more elegant and versatile as a dependency between PopupMenu and KnownPluginList or XML(already used in KnownPluginList)