use of org.eclipse.xtext.TypeRef in project xtext-eclipse by eclipse.
the class XtextLabelProvider method getLabel.
private String getLabel(CrossReference ref) {
TypeRef type = ref.getType();
String typeName = getClassifierName(type);
if (ref.getTerminal() instanceof RuleCall)
return "[" + typeName + "|" + getLabel((RuleCall) ref.getTerminal()) + "]";
return "[" + typeName + "|..]";
}
use of org.eclipse.xtext.TypeRef in project xtext-eclipse by eclipse.
the class XtextProposalProvider method completeAssignment_Feature.
/**
* Not a full featured solution for the computation of available structural features, but it is sufficient for some
* interesting 85%.
*/
@Override
public void completeAssignment_Feature(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
AbstractRule rule = EcoreUtil2.getContainerOfType(model, AbstractRule.class);
TypeRef typeRef = rule.getType();
if (typeRef != null && typeRef.getClassifier() instanceof EClass) {
Iterable<EStructuralFeature> features = ((EClass) typeRef.getClassifier()).getEAllStructuralFeatures();
Function<IEObjectDescription, ICompletionProposal> factory = getProposalFactory(grammarAccess.getValidIDRule().getName(), context);
Iterable<String> processedFeatures = completeStructuralFeatures(context, factory, acceptor, features);
if (rule.getType().getMetamodel() instanceof GeneratedMetamodel) {
if (notNull(rule.getName()).toLowerCase().startsWith("import")) {
completeSpecialAttributeAssignment("importedNamespace", 2, processedFeatures, factory, context, acceptor);
completeSpecialAttributeAssignment("importURI", 1, processedFeatures, factory, context, acceptor);
} else {
completeSpecialAttributeAssignment("name", 3, processedFeatures, factory, context, acceptor);
}
}
}
super.completeAssignment_Feature(model, assignment, context, acceptor);
}
Aggregations