use of org.eclipse.xtext.common.types.JvmVisibility in project xtext-xtend by eclipse.
the class CodeBuilderQuickfix method getImage.
protected String getImage(final ICodeBuilder builder) {
String _switchResult = null;
JvmVisibility _visibility = builder.getVisibility();
if (_visibility != null) {
switch(_visibility) {
case PRIVATE:
_switchResult = "fix_private_obj.gif";
break;
case PUBLIC:
_switchResult = "fix_public_obj.gif";
break;
case PROTECTED:
_switchResult = "fix_protected_obj.gif";
break;
default:
_switchResult = "fix_default_obj.gif";
break;
}
} else {
_switchResult = "fix_default_obj.gif";
}
return _switchResult;
}
use of org.eclipse.xtext.common.types.JvmVisibility in project xtext-xtend by eclipse.
the class XtendJvmModelInferrer method transform.
protected void transform(XtendConstructor source, JvmGenericType container) {
JvmConstructor constructor = typesFactory.createJvmConstructor();
container.getMembers().add(constructor);
associator.associatePrimary(source, constructor);
JvmVisibility visibility = source.getVisibility();
constructor.setSimpleName(container.getSimpleName());
constructor.setVisibility(visibility);
for (XtendParameter parameter : source.getParameters()) {
translateParameter(constructor, parameter);
}
copyAndFixTypeParameters(source.getTypeParameters(), constructor);
for (JvmTypeReference exception : source.getExceptions()) {
constructor.getExceptions().add(jvmTypesBuilder.cloneWithProxies(exception));
}
translateAnnotationsTo(source.getAnnotations(), constructor);
setBody(constructor, source.getExpression());
jvmTypesBuilder.copyDocumentationTo(source, constructor);
}
use of org.eclipse.xtext.common.types.JvmVisibility in project xtext-xtend by eclipse.
the class XtendJvmModelInferrer method transform.
protected void transform(XtendFunction source, JvmGenericType container, boolean allowDispatch) {
JvmOperation operation = typesFactory.createJvmOperation();
operation.setAbstract(source.isAbstract());
operation.setNative(source.isNative());
operation.setSynchronized(source.isSynchonized());
operation.setStrictFloatingPoint(source.isStrictFloatingPoint());
if (!source.isAbstract())
operation.setFinal(source.isFinal());
container.getMembers().add(operation);
associator.associatePrimary(source, operation);
String sourceName = source.getName();
JvmVisibility visibility = source.getVisibility();
if (allowDispatch && source.isDispatch()) {
if (source.getDeclaredVisibility() == null)
visibility = JvmVisibility.PROTECTED;
sourceName = "_" + sourceName;
}
operation.setSimpleName(sourceName);
operation.setVisibility(visibility);
operation.setStatic(source.isStatic());
if (!operation.isAbstract() && !operation.isStatic() && container.isInterface())
operation.setDefault(true);
for (XtendParameter parameter : source.getParameters()) {
translateParameter(operation, parameter);
}
XExpression expression = source.getExpression();
CreateExtensionInfo createExtensionInfo = source.getCreateExtensionInfo();
JvmTypeReference returnType = null;
if (source.getReturnType() != null) {
returnType = jvmTypesBuilder.cloneWithProxies(source.getReturnType());
} else if (createExtensionInfo != null) {
returnType = jvmTypesBuilder.inferredType(createExtensionInfo.getCreateExpression());
} else if (expression != null) {
returnType = jvmTypesBuilder.inferredType(expression);
} else {
returnType = jvmTypesBuilder.inferredType();
}
operation.setReturnType(returnType);
copyAndFixTypeParameters(source.getTypeParameters(), operation);
for (JvmTypeReference exception : source.getExceptions()) {
operation.getExceptions().add(jvmTypesBuilder.cloneWithProxies(exception));
}
translateAnnotationsTo(source.getAnnotations(), operation);
if (source.isOverride() && generatorConfig.getJavaSourceVersion().isAtLeast(JAVA6) && !containsAnnotation(operation, Override.class) && typeReferences.findDeclaredType(Override.class, source) != null) {
operation.getAnnotations().add(_annotationTypesBuilder.annotationRef(Override.class));
}
if (createExtensionInfo != null) {
transformCreateExtension(source, createExtensionInfo, container, operation, returnType);
} else {
setBody(operation, expression);
}
jvmTypesBuilder.copyDocumentationTo(source, operation);
}
use of org.eclipse.xtext.common.types.JvmVisibility in project xtext-xtend by eclipse.
the class AbstractExecutableBuilder method getImage.
@Override
public String getImage() {
String _switchResult = null;
JvmVisibility _visibility = this.getVisibility();
if (_visibility != null) {
switch(_visibility) {
case PRIVATE:
_switchResult = "methpri_obj.gif";
break;
case PROTECTED:
_switchResult = "methpro_obj.gif";
break;
case PUBLIC:
_switchResult = "methpub_obj.gif";
break;
default:
_switchResult = "methdef_obj.gif";
break;
}
} else {
_switchResult = "methdef_obj.gif";
}
return _switchResult;
}
use of org.eclipse.xtext.common.types.JvmVisibility in project xtext-xtend by eclipse.
the class JvmMemberDeclarationImpl method setVisibility.
public void setVisibility(final Visibility visibility) {
this.checkMutable();
T _delegate = this.getDelegate();
JvmVisibility _switchResult = null;
if (visibility != null) {
switch(visibility) {
case DEFAULT:
_switchResult = JvmVisibility.DEFAULT;
break;
case PUBLIC:
_switchResult = JvmVisibility.PUBLIC;
break;
case PRIVATE:
_switchResult = JvmVisibility.PRIVATE;
break;
case PROTECTED:
_switchResult = JvmVisibility.PROTECTED;
break;
default:
break;
}
}
_delegate.setVisibility(_switchResult);
}
Aggregations