Create package like node


We can group root nodes by using virtual package.

Is it possible to create a node as package and the package node can contain many other root nodes?



Hello, Palpandi.

No, the is no such feature for root node.
Of course you can define, that your root node contain other root nodes as children, but you must do it intentionally for some concrete concepts* and you can see them in project tree only if 'Show members' are enabled. And anyway files are generated under folders that correspond to model name.
* you can add [0..n] child of BaseConcept, so you can add any other concept here, but you will lost control of structure and generation.

Can you provide what exactly you want to achieve with this? Maybe we can provide you some other way to do it?

For example instead of virtual packages you can also group nodes in nested models:


Thanks Victor.

For example,

There is a file and set of functions. Both have their own root editor with different contents.

In this case, to visualize them in a hierarchy, the function node should be under file.


Why your function concepts need to be root?

If both has own roots, then file concept can have just references to this functions, what is not direct hierarchy, so they will be in references folder in 'Show members'  view.

In case you really want stay with such concepts structure, then you probably need to implement your own visualisation and try to add it to project pane or create your own tree tool to replace default one for language usage.

Less radical way - stay with virtual folders (they can be removed in future) or use separate models for functions and files and just use 'Show members' or 'Show Node in Explorer' action for files to see references.


Can you give some inputs to implement own visualisation and add it to project pane? Is it a part of logical view tree?




There is no easy way to add something to project pane. Probably it is a good idea for future feature.
For now it is only if you produce your own distribution and replace some MPS classes with your own...

Creating your own tool is much easier - you need to create plugin with tool window and implement your own tree. You can use jetbrains.mps.ide.ui.tree.MPSTree as base class or reuse some of its children (jetbrains.mps.ide.projectPane.logicalview.ProjectPaneTree is one of them).
You can reuse children of jetbrains.mps.ide.ui.tree.MPSTreeNode for existing types like module, model, node, reference etc.
And mostly will be interested in jetbrains.mps.ide.ui.tree.smodel.SNodeTreeNode.NodeChildrenProvider#populate method, which allows you to define, what nodes will be shown under your tree node.


@Victor, Is it possible to hide/ exclude nodes from Logical View tree?


Please sign in to leave a comment.