SNode parentNode = ... // get the parent node SNode childNode = ... // get the child node SLink link = parentNode.getReferenceLink("child"); // get the reference link SNode targetNode = link.getTarget(); // get the current target node SLinkOperations.setTarget(link, childNode); // set the target node
SNode node = ... // get the node SModelReference reference = ... // get the model reference SNode targetNode = ... // get the target node SLink link = node.getLink(reference); // get the link SLinkOperations.setTarget(link, targetNode); // set the target nodeThis example shows how to set the target of a link using a model reference. We get the link using the reference and set the target using the setTarget() method. Package library: jetbrains.mps.lang.smodel.generator.smodeladapter.