use of org.eclipse.xtend.core.xtend.XtendEnumLiteral in project xtext-xtend by eclipse.
the class XAnnotationExtensions method getAnnotatedTarget.
public XtendAnnotationTarget getAnnotatedTarget(final XAnnotation annotation) {
XtendAnnotationTarget _switchResult = null;
EObject _eContainer = annotation.eContainer();
final EObject container = _eContainer;
boolean _matched = false;
if (container instanceof XtendAnnotationType) {
_matched = true;
}
if (!_matched) {
if (container instanceof XtendClass) {
_matched = true;
}
}
if (!_matched) {
if (container instanceof XtendInterface) {
_matched = true;
}
}
if (!_matched) {
if (container instanceof XtendEnum) {
_matched = true;
}
}
if (!_matched) {
if (container instanceof XtendField) {
_matched = true;
}
}
if (!_matched) {
if (container instanceof XtendFunction) {
_matched = true;
}
}
if (!_matched) {
if (container instanceof XtendConstructor) {
_matched = true;
}
}
if (!_matched) {
if (container instanceof XtendEnumLiteral) {
_matched = true;
}
}
if (!_matched) {
if (container instanceof XtendParameter) {
_matched = true;
}
}
if (_matched) {
_switchResult = ((XtendAnnotationTarget) container);
}
if (!_matched) {
if (container instanceof XtendAnnotationTarget) {
_matched = true;
XtendAnnotationTarget _xblockexpression = null;
{
final EObject containerContainer = ((XtendAnnotationTarget) container).eContainer();
XtendAnnotationTarget _xifexpression = null;
if ((containerContainer instanceof XtendAnnotationTarget)) {
_xifexpression = ((XtendAnnotationTarget) containerContainer);
} else {
_xifexpression = ((XtendAnnotationTarget) container);
}
_xblockexpression = _xifexpression;
}
_switchResult = _xblockexpression;
}
}
if (!_matched) {
if (container instanceof XAnnotation) {
_matched = true;
_switchResult = this.getAnnotatedTarget(((XAnnotation) container));
}
}
if (!_matched) {
_switchResult = null;
}
return _switchResult;
}
use of org.eclipse.xtend.core.xtend.XtendEnumLiteral in project xtext-xtend by eclipse.
the class CompilationUnitImpl method toXtendMemberDeclaration.
public MemberDeclaration toXtendMemberDeclaration(final XtendMember delegate) {
final Function1<XtendMember, XtendMemberDeclarationImpl<? extends XtendMember>> _function = (XtendMember it) -> {
XtendMemberDeclarationImpl<? extends XtendMember> _switchResult = null;
boolean _matched = false;
if (delegate instanceof XtendTypeDeclaration) {
_matched = true;
_switchResult = this.toXtendTypeDeclaration(((XtendTypeDeclaration) delegate));
}
if (!_matched) {
if (delegate instanceof XtendFunction) {
_matched = true;
XtendMethodDeclarationImpl _xtendMethodDeclarationImpl = new XtendMethodDeclarationImpl();
final Procedure1<XtendMethodDeclarationImpl> _function_1 = (XtendMethodDeclarationImpl it_1) -> {
it_1.setDelegate(((XtendFunction) delegate));
it_1.setCompilationUnit(this);
};
_switchResult = ObjectExtensions.<XtendMethodDeclarationImpl>operator_doubleArrow(_xtendMethodDeclarationImpl, _function_1);
}
}
if (!_matched) {
if (delegate instanceof XtendConstructor) {
_matched = true;
XtendConstructorDeclarationImpl _xtendConstructorDeclarationImpl = new XtendConstructorDeclarationImpl();
final Procedure1<XtendConstructorDeclarationImpl> _function_1 = (XtendConstructorDeclarationImpl it_1) -> {
it_1.setDelegate(((XtendConstructor) delegate));
it_1.setCompilationUnit(this);
};
_switchResult = ObjectExtensions.<XtendConstructorDeclarationImpl>operator_doubleArrow(_xtendConstructorDeclarationImpl, _function_1);
}
}
if (!_matched) {
if (delegate instanceof XtendField) {
_matched = true;
XtendMemberDeclarationImpl<XtendField> _xifexpression = null;
EObject _eContainer = ((XtendField) delegate).eContainer();
if ((_eContainer instanceof XtendAnnotationType)) {
XtendAnnotationTypeElementDeclarationImpl _xtendAnnotationTypeElementDeclarationImpl = new XtendAnnotationTypeElementDeclarationImpl();
final Procedure1<XtendAnnotationTypeElementDeclarationImpl> _function_1 = (XtendAnnotationTypeElementDeclarationImpl it_1) -> {
it_1.setDelegate(((XtendField) delegate));
it_1.setCompilationUnit(this);
};
_xifexpression = ObjectExtensions.<XtendAnnotationTypeElementDeclarationImpl>operator_doubleArrow(_xtendAnnotationTypeElementDeclarationImpl, _function_1);
} else {
XtendFieldDeclarationImpl _xtendFieldDeclarationImpl = new XtendFieldDeclarationImpl();
final Procedure1<XtendFieldDeclarationImpl> _function_2 = (XtendFieldDeclarationImpl it_1) -> {
it_1.setDelegate(((XtendField) delegate));
it_1.setCompilationUnit(this);
};
_xifexpression = ObjectExtensions.<XtendFieldDeclarationImpl>operator_doubleArrow(_xtendFieldDeclarationImpl, _function_2);
}
_switchResult = _xifexpression;
}
}
if (!_matched) {
if (delegate instanceof XtendEnumLiteral) {
_matched = true;
XtendEnumerationValueDeclarationImpl _xtendEnumerationValueDeclarationImpl = new XtendEnumerationValueDeclarationImpl();
final Procedure1<XtendEnumerationValueDeclarationImpl> _function_1 = (XtendEnumerationValueDeclarationImpl it_1) -> {
it_1.setDelegate(((XtendEnumLiteral) delegate));
it_1.setCompilationUnit(this);
};
_switchResult = ObjectExtensions.<XtendEnumerationValueDeclarationImpl>operator_doubleArrow(_xtendEnumerationValueDeclarationImpl, _function_1);
}
}
return _switchResult;
};
return this.<XtendMember, XtendMemberDeclarationImpl<? extends XtendMember>>getOrCreate(delegate, _function);
}
use of org.eclipse.xtend.core.xtend.XtendEnumLiteral in project xtext-xtend by eclipse.
the class XtendQualifiedNameProvider method getFullyQualifiedName.
@Override
public QualifiedName getFullyQualifiedName(EObject obj) {
if (obj instanceof XtendTypeDeclaration) {
XtendTypeDeclaration typeDecl = (XtendTypeDeclaration) obj;
String typeName = typeDecl.getName();
if (typeDecl.eContainer() instanceof XtendFile) {
if (typeName == null)
return null;
XtendFile file = (XtendFile) typeDecl.eContainer();
String packageName = file.getPackage();
if (packageName != null) {
return qualifiedNameConverter.toQualifiedName(packageName).append(typeName);
}
return QualifiedName.create(typeName);
} else {
return concatNames(obj, typeName);
}
}
if (obj instanceof XtendConstructor) {
return getFullyQualifiedName(obj.eContainer());
}
if (obj instanceof JvmIdentifiableElement && !(obj instanceof JvmTypeParameter)) {
return getFullyQualifiedName((JvmIdentifiableElement) obj);
}
if (obj instanceof XtendField) {
return concatNames(obj, ((XtendField) obj).getName());
}
if (obj instanceof XtendFunction) {
return concatNames(obj, ((XtendFunction) obj).getName());
}
if (obj instanceof XtendEnumLiteral) {
return concatNames(obj, ((XtendEnumLiteral) obj).getName());
}
return null;
}
use of org.eclipse.xtend.core.xtend.XtendEnumLiteral in project xtext-xtend by eclipse.
the class XtendJvmModelInferrer method initialize.
protected void initialize(XtendEnum source, JvmEnumerationType inferredJvmType) {
inferredJvmType.setVisibility(source.getVisibility());
inferredJvmType.setStatic(source.isStatic() && !isTopLevel(source));
translateAnnotationsTo(source.getAnnotations(), inferredJvmType);
for (XtendMember member : source.getMembers()) {
if (member instanceof XtendEnumLiteral)
transform((XtendEnumLiteral) member, inferredJvmType);
}
jvmTypesBuilder.copyDocumentationTo(source, inferredJvmType);
}
Aggregations