Autocomplete for not INamedConcept references
In my application I have a concept that has context-depended name (MyConcept_Behavior.getName(node<> contextNode)). How should I declare a reference concept (and its constraints) in a way to render referenced node's name properly?
I created a MyConceptReference extends Expression concept with reference to a MyConcept[1]. Then I created a MyConceptReference_Constraints node and reference constraint in it with reference scope like this:
return new SimpleScope(model.nodes<MyConcept>){ public string getReferenceText(node<> target){ ifInstanceOf (target is MyConcept mc){ return mc.getName(null); } return "Unknown node " + target/.getNodeId(); } }
No aliases were defined for both MyConcept and MyConceptReference. Still I don't see getName(null) invocation result in autocomplete list, but "MyConcept" label for every entry.
How should I use references like these?
I created a MyConceptReference extends Expression concept with reference to a MyConcept[1]. Then I created a MyConceptReference_Constraints node and reference constraint in it with reference scope like this:
return new SimpleScope(model.nodes<MyConcept>){ public string getReferenceText(node<> target){ ifInstanceOf (target is MyConcept mc){ return mc.getName(null); } return "Unknown node " + target/.getNodeId(); } }
No aliases were defined for both MyConcept and MyConceptReference. Still I don't see getName(null) invocation result in autocomplete list, but "MyConcept" label for every entry.
How should I use references like these?
Please sign in to leave a comment.
(parameterNode, visible, smartReference, inEditor, model, exists, contextNode, contextRole, position, scope, referenceNode, linkTarget, enclosingNode, containingLink, operationContext)->string {
}
Here I used a utility class XmlPathHelper to do the calculation.