Creating a sub root node for root node in the tree viewer

Is there any way to add a root node from another root node in the tree viewer .I have a requirement of adding a root node under another root node
I have root node called 'package' and I want to add set of root nodes ('Class') under the package from the Tree Viewer.
For example if I right click on Model ,I can add a new root node 'Package' and by right clicking on the 'Package' ,I can add number of 'Class' root nodes under the  Package Node .
1 comment
First setting the terminology right - once you hook a node underneath another node, you can no longer call it a root node, despite the node being of a rootable concept.

For scenarios like the one you describe with packages grouping classes, MPS provides virtual packages. Maybe they could help you resolve your issue?

In order to handle right-clicking on a node, you'll need to create your own Action and ActionGroup and hook it into the NodeActions action group. As an example for inspiration, you may take the "TextPreviewGroup".
The documentation is to be found at

Additionally, you perhaps need to change the settings of the Project View panel by enabling "Show node structure" in order to see the child nodes in the tree viewer.

Please sign in to leave a comment.