Quick Fix: How to find a node by its unique id and change a property value

Guess having a quix fix and you want to change a property of another node (not the one triggering the fix). All what you know about the targets node is its unique id. How could I find that node from within execute(node) { ... } of "quick fix" to be able to change a property?

Help would be appreciated

Thanks
Kai

0
3 comments

Finding a node by id in a model is done by calling SModel.getNode(SNodeId).

Note that node id is unique inside a model, but not globally unique. So, at least you also need to know the model (e.g. as SModelReference). The absolutely correct way to reference a node is SNodeReference, not SNodeId; you can try this if possible in your case.

 

0

Thanks Mihail!


Is it possible to get a pointer to a property, too?


Regards
Kai

0

We don't have a property reference for now. If you need to reference a certain property in a certain node, use a pair (SNodeReference, SProperty). It will mean that you reference the property described by this SProperty in the node referenced by SNodeReference.


One important thing to mention. While SNode is a part of the program's AST, the SConcept, SProperty, SReferenceLink and SContainmentLink are parts of the "language universe". The SProperty is actually a proxy to a compiled property declaration. It can be used both to access the compiled property data (it's an analogue to reflection entities in Java) and to identify the property. 

0

Please sign in to leave a comment.