Skip to end of metadata
Go to start of metadata


smodel query scopes improvments

SModel queries that are useful in migrations scripts and in console plugin now behave differently towards scope they operate on. Read-only models are no longer filtered out from scope specified as a query parameter. If scope is declared as a parameter for specific query, query is executed on the whole scope including read-only models. But if scope is not specified, default scope still contains only writeable models.


Show reflective editor for the subtree

The reflective editor could be shown for a whole subtree.

For that select the node and choose "Show reflective editors for subtree" or press Cmd/Ctrl+Shift+[



Showing the reflective editor just for the node is still available as from the context menu, as by Cmd/Ctrl+[ or from the context menu.

To show the normal, regular editor, select the node with the reflective editor an press Cmd/Ctrl+], Cmd/Ctrl+Shift+] or right-click the option “Show regular editor for the Subtree”.








Include transformation menu for the property/reference

The customization of the menu for the property/reference cells becomes simpler with the property/reference transformation menu parts.

Suppose you want to customize the completion menu of the reference/property cell. Currently, it can be done by defining the "inline menu" in the inspector.

The example for the ClassCreator concept:

Since the 2018.1 release, it could be done also via the Transformation Menu.

We introduce the property and the reference transformation menu parts.

The reference transformation menu part includes the actions which set the target node to the specific reference. The target nodes come from the scope for that reference.

The same does the property menu part: it takes the values of the property type and includes actions which set the value to the specific properties.

Let's take a look at the examples.

Suppose we want to build the completion menu for the reference cell with the reference actions and some other custom action, such as replace the whole node. That could be done by attaching the following transformation menu to the reference cell:

So we will receive all the reference actions and our custom action in the completion.

As you could mention reference menu part is the analog of the "primary choose referent menu" part in the "inline menu", but more customizable.

Also if no menu is attached to the cell, this reference menu will be used by default.

The other example. Suppose you want to see all the variants for the specific property in the context assistant of when the cursor is on the label cell.

Let's take a look at the piece of code on the Kaja language

We want to see all the variants of the looking direction when we put the caret to the looking cell.

So we attach the following menu to this cell

And get the result:

So the advantages of those menu parts over the "inline menu" are:

1) They could be attached to any cell, not only reference/property cell.

2) They could be used in any menu location (context assistant, context menu), not only the completion

3) Reference menu is more customizable (property menu also will be customizable soon)

SModel language enhancements

A couple of new types and operations introduced in smodel language.

In some cases, you have to deal with raw node pointers (aka SNodeReference). Working with it usually puzzles because unlike "node<>" type it has no sense about a concept of a node that it refers. To make working with node pointers easier we introduce new "node-ptr<>" type. Such pointers can be resolved to an actual node via "resolve" operation. Along with it, we introduce "node-ptr/ ... /" expression, a modern counterpart to old "nodePointer/ ... /" construction.

When setting a target to a reference link there is no need for accessing to a target node, having a pointer to target is enough. But smodel language has no approach to do it in a concise way. Since 2018.1 it becomes possible with "set ptr" operation that applicable on reference link access expressions. Similarly, to check that some node is a specific one, there is "is" operation available.

Also, several old constructions rebranded. For instance, "model-reference" type became "model-ptr" and got "resolve" operation like new "node-ptr<>" type. Furthermore, typing rules for smodel types became stricter. Now you can not invoke methods of SModelReference interface directly on "model-ptr" values. To do it consider to use downcast operator. "pointer" operation on node instances now returns "node-ptr" instead of regular SNodeReference. Same change happened with reference macro query in generator language. We introduce a migration script to eliminate some common scenarios where type error might occur.


New migration scripts

We have introduced a couple of migration scripts that might help you with migrating old SModel Language constructions like `node/.../` expressions, undesirable quotations or downcasts. To run them go to Tools -> Scripts -> Enhancements and choose "SModel Language Enhancements (node-ptr<> and model-ptr)". Also, there is "Use node pointers in reference macro queries" option available that handles old constructions in generator macros.

  • No labels