use of org.eclipse.xtend.ide.codebuilder.AbstractAnnotationBuilder in project xtext-xtend by eclipse.
the class AnnotationBuilderTest method testJavaAnnotation.
@Test
public void testJavaAnnotation() {
AbstractAnnotationBuilder _createAnnotationBuilder = this._codeBuilderFactory.createAnnotationBuilder(this.getJavaClass());
final Procedure1<AbstractAnnotationBuilder> _function = (AbstractAnnotationBuilder it) -> {
it.setContext(this.getJavaClass());
it.setAnnotationName("Bar");
it.setVisibility(JvmVisibility.PUBLIC);
};
AbstractAnnotationBuilder _doubleArrow = ObjectExtensions.<AbstractAnnotationBuilder>operator_doubleArrow(_createAnnotationBuilder, _function);
StringConcatenation _builder = new StringConcatenation();
_builder.append("public @interface Bar {");
_builder.newLine();
_builder.append("}");
this.assertBuilds(_doubleArrow, _builder.toString());
}
use of org.eclipse.xtend.ide.codebuilder.AbstractAnnotationBuilder in project xtext-xtend by eclipse.
the class CreateXtendTypeQuickfixes method newLocalXtendAnnotationQuickfix.
protected void newLocalXtendAnnotationQuickfix(String typeName, XtextResource resource, Issue issue, IssueResolutionAcceptor issueResolutionAcceptor) {
EObject eObject = resource.getEObject(issue.getUriToProblem().fragment());
XtendTypeDeclaration xtendType = getAnnotationTarget(eObject);
if (xtendType != null) {
JvmDeclaredType inferredType = associations.getInferredType(xtendType);
if (inferredType != null) {
AbstractAnnotationBuilder annotationBuilder = codeBuilderFactory.createAnnotationBuilder(inferredType);
annotationBuilder.setAnnotationName(typeName);
annotationBuilder.setVisibility(JvmVisibility.PUBLIC);
annotationBuilder.setContext(xtendType);
codeBuilderQuickfix.addQuickfix(annotationBuilder, "Create local Xtend annotation '@" + typeName + "'", issue, issueResolutionAcceptor);
}
}
}
use of org.eclipse.xtend.ide.codebuilder.AbstractAnnotationBuilder in project xtext-xtend by eclipse.
the class AnnotationBuilderTest method testXtendAnnotation.
@Test
public void testXtendAnnotation() {
AbstractAnnotationBuilder _createAnnotationBuilder = this._codeBuilderFactory.createAnnotationBuilder(this.getXtendClass());
final Procedure1<AbstractAnnotationBuilder> _function = (AbstractAnnotationBuilder it) -> {
it.setContext(this.getXtendClass());
it.setAnnotationName("Bar");
it.setVisibility(JvmVisibility.PUBLIC);
};
AbstractAnnotationBuilder _doubleArrow = ObjectExtensions.<AbstractAnnotationBuilder>operator_doubleArrow(_createAnnotationBuilder, _function);
StringConcatenation _builder = new StringConcatenation();
_builder.append("annotation Bar {");
_builder.newLine();
_builder.append("}");
this.assertBuilds(_doubleArrow, _builder.toString());
}
Aggregations