How I can extend existed editors in baseLanguage
I try to extend baseLanguage InstanceMethodDeclaration editor.
I want to create new language, that extends baseLanguage and has additional fields for each method.
I cannot find simple way to extend editor for extended concept without copying them.
Please, help.
I want to create new language, that extends baseLanguage and has additional fields for each method.
I cannot find simple way to extend editor for extended concept without copying them.
Please, help.
Please sign in to leave a comment.
It's possible to create reusable editor components (#_DeprecatedPart#, #HasAnnotation_AnnotationComponent#, .. in InstanceMethodDeclaration editor), but it's not possible to somehow extend already defined editor for a concept now.
The easiest way IMHO is to create an own concept that extends the existing concept.
There is also a way of using annotation links.
Hopefully some other guys can you tell you about that.
Did you already watch the tutorial by markus voelter: http://www.jetbrains.com/mps/documentation/index.html "Building The Language"
Attribute is a special concept instance of which can be a child of any concept. There are 3 type of attributes: NodeAttribute, LinkAttribute and PropertyAttribute. Link and Property attributes has a relation (connection) to the reference or property of the attributed node.
For these we have a special constructs in smodel language. You can derive you own attribute from NodeAttribute, LinkAttribute or PropertyAttribute concepts, give a name to the attribute (role) and specify if this 1-1 or 1-many attribute. Also you can specify applicable concept for the attribute and of course the attribute itself structure. After that you can refer to the defined attribute with the
node.@attributeRole1
node.@attributeRole2<link>
node.@attributeRole3<property>
If the node is applicable concept for the defined attribute. You can use these expressions as usual features (links or properies) in smodel langauge, e.g.:
node.@attr = new node<Classifier>; node.@attr.method; node.@linkattr<linkname>.add(xxx);
Thus you can add functionality to the existent concepts without modifying them.
In MPS generator's templates are implemented using macro attributes.
Do you have more questions on attributes?