use of org.eclipse.xtext.xbase.annotations.xAnnotations.XAnnotation in project xtext-eclipse by eclipse.
the class XbaseWithAnnotationsProposalProvider method completeXAnnotation_Value.
@Override
public void completeXAnnotation_Value(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
if (model instanceof XAnnotation) {
JvmType annotationType = ((XAnnotation) model).getAnnotationType();
if (annotationType != null && !annotationType.eIsProxy() && annotationType instanceof JvmAnnotationType) {
JvmAnnotationType casted = (JvmAnnotationType) annotationType;
List<JvmOperation> operations = Lists.newArrayList(casted.getDeclaredOperations());
if (operations.size() == 1) {
JvmOperation singleOperation = operations.get(0);
if ("value".equals(singleOperation.getSimpleName())) {
// TODO propose qualified enum literals + import
super.completeXAnnotation_Value(model, assignment, context, acceptor);
if ("java.lang.Class".equals(getRawReturnType(singleOperation))) {
// eager proposals for classes if the expected type is a suptype of class
// TODO evaluate the bounds of the class
completeJavaTypes(context, TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE, // force
true, getQualifiedNameValueConverter(), createVisibilityFilter(context), acceptor);
} else {
proposeDeclaringTypeForStaticInvocation(model, assignment, context, acceptor);
}
}
}
}
}
}
Aggregations