use of org.eclipse.xtend.ide.codebuilder.AbstractClassBuilder in project xtext-xtend by eclipse.
the class ClassBuilderTest method testXtendClass.
@Test
public void testXtendClass() {
AbstractClassBuilder _createClassBuilder = this._codeBuilderFactory.createClassBuilder(this.getXtendClass());
final Procedure1<AbstractClassBuilder> _function = (AbstractClassBuilder it) -> {
it.setContext(this.getXtendClass());
it.setClassName("Bar");
it.setVisibility(JvmVisibility.PUBLIC);
};
AbstractClassBuilder _doubleArrow = ObjectExtensions.<AbstractClassBuilder>operator_doubleArrow(_createClassBuilder, _function);
StringConcatenation _builder = new StringConcatenation();
_builder.append("class Bar {");
_builder.newLine();
_builder.append("}");
this.assertBuilds(_doubleArrow, _builder.toString());
}
use of org.eclipse.xtend.ide.codebuilder.AbstractClassBuilder in project xtext-xtend by eclipse.
the class ClassBuilderTest method testJavaClass.
@Test
public void testJavaClass() {
AbstractClassBuilder _createClassBuilder = this._codeBuilderFactory.createClassBuilder(this.getJavaClass());
final Procedure1<AbstractClassBuilder> _function = (AbstractClassBuilder it) -> {
it.setContext(this.getJavaClass());
it.setClassName("Bar");
it.setVisibility(JvmVisibility.PUBLIC);
};
AbstractClassBuilder _doubleArrow = ObjectExtensions.<AbstractClassBuilder>operator_doubleArrow(_createClassBuilder, _function);
StringConcatenation _builder = new StringConcatenation();
_builder.append("public class Bar {");
_builder.newLine();
_builder.append("}");
this.assertBuilds(_doubleArrow, _builder.toString());
}
use of org.eclipse.xtend.ide.codebuilder.AbstractClassBuilder in project xtext-xtend by eclipse.
the class CreateXtendTypeQuickfixes method newLocalXtendClassQuickfix.
protected void newLocalXtendClassQuickfix(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) {
AbstractClassBuilder classBuilder = codeBuilderFactory.createClassBuilder(inferredType);
classBuilder.setClassName(typeName);
classBuilder.setVisibility(JvmVisibility.PUBLIC);
classBuilder.setContext(xtendType);
classBuilder.setImage("xtend_file.png");
codeBuilderQuickfix.addQuickfix(classBuilder, "Create local Xtend class '" + typeName + "'", issue, issueResolutionAcceptor);
}
}
}
Aggregations