use of com.nedap.archie.aom.CPrimitiveObject in project archetype-languageserver by nedap.
the class ArchetypeHoverInfo method getHoverInfoForCObject.
private void getHoverInfoForCObject(DocumentInformation documentInformation, CObject definition, Archetype archetypeForTerms) {
ArchetypeTerm term = archetypeForTerms.getTerm(definition, language);
String content;
if (term != null) {
content = "### " + definition.getRmTypeName() + ": " + term.getText() + "\n\n\t" + term.getDescription();
} else {
content = "### No term found";
}
CObject flattenedObject = (definition instanceof CPrimitiveObject) ? definition : archetypeForTerms.itemAtPath(definition.getPath());
if (flattenedObject == null) {
// fallback if something went wrong
flattenedObject = definition;
}
MultiplicityInterval occurrences = flattenedObject.effectiveOccurrences(metaModels::referenceModelPropMultiplicity);
content += "\n occurrences: " + occurrences;
content += "\n\n path: " + definition.getPath();
Hover hover = new Hover();
hover.setContents(new MarkupContent(MARKDOWN, content.toString()));
Range range = getHoverRange(documentInformation, definition);
if (range != null) {
hoverRanges.addRange(range, hover);
}
}
Aggregations