@Override
public IScope getScope(EObject context, EReference reference) {
if (reference == XAnnotationsPackage.Literals.XANNOTATION_ELEMENT_VALUE_PAIR__ELEMENT) {
XAnnotation annotation = EcoreUtil2.getContainerOfType(context, XAnnotation.class);
JvmType annotationType = annotation.getAnnotationType();
if (annotationType == null || annotationType.eIsProxy() || !(annotationType instanceof JvmAnnotationType)) {
return IScope.NULLSCOPE;
}
Iterable<JvmOperation> operations = ((JvmAnnotationType) annotationType).getDeclaredOperations();
Iterable<IEObjectDescription> descriptions = transform(operations, new Function<JvmOperation, IEObjectDescription>() {
@Override
public IEObjectDescription apply(JvmOperation from) {
return EObjectDescription.create(QualifiedName.create(from.getSimpleName()), from);
}
});
return MapBasedScope.createScope(IScope.NULLSCOPE, descriptions);
}
return super.getScope(context, reference);
}