Search in sources :

Example 86 with StringConcatenation

use of org.eclipse.xtend2.lib.StringConcatenation in project applause by applause.

the class ScreensDefiningScreensSpec method _screensMustBeUnique.

/**
   * Screens must be unique. Currently, this means they must be unique across the board and __cannot__
   * be namespaced.
   * @filter('''|.hasDuplicateScreen)
   */
@Test
@Named("Screens must be unique")
@Order(2)
public void _screensMustBeUnique() throws Exception {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("screen DefaultList PersonList {");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    _builder.append("screen DefaultList PersonList {");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    this._screensValidationTestHelper.hasDuplicateScreen(_builder);
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) Order(org.jnario.runner.Order) Named(org.jnario.runner.Named) Test(org.junit.Test)

Example 87 with StringConcatenation

use of org.eclipse.xtend2.lib.StringConcatenation in project applause by applause.

the class DefaultListScreenEditActionCompiler method compileCommitEditing.

public CharSequence compileCommitEditing(final Screen it) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath");
    _builder.newLine();
    _builder.append("{");
    _builder.newLine();
    _builder.append("\t");
    Entity _resourceType = this._defaultListScreenClassExtensions.resourceType(it);
    String _typeName = this._typeExtensions.typeName(_resourceType);
    _builder.append(_typeName, "	");
    _builder.append(" *item= self.items[indexPath.row];");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.append("[item ");
    DataSourceAccessMethod _deleteMethod = this.deleteMethod(it);
    String _name = _deleteMethod.getName();
    _builder.append(_name, "	");
    _builder.append(":^(");
    Entity _resourceType_1 = this._defaultListScreenClassExtensions.resourceType(it);
    String _typeName_1 = this._typeExtensions.typeName(_resourceType_1);
    _builder.append(_typeName_1, "	");
    _builder.append(" *item, NSError *error)");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.append("{");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("if (error) {");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("NSLog(@\"Error %@\", error);");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("else {");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("if (indexPath.row < self.items.count) {");
    _builder.newLine();
    _builder.append("\t\t\t\t");
    _builder.append("[self.items removeObjectAtIndex:indexPath.row];");
    _builder.newLine();
    _builder.append("\t\t\t\t");
    _builder.append("[self.tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}];");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    return _builder;
}
Also used : Entity(org.applause.lang.applauseDsl.Entity) DataSourceAccessMethod(org.applause.lang.applauseDsl.DataSourceAccessMethod) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation)

Example 88 with StringConcatenation

use of org.eclipse.xtend2.lib.StringConcatenation in project applause by applause.

the class DefaultListScreenHeaderFileCompiler method compileHeader.

public CharSequence compileHeader(final Screen it) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("#import <UIKit/UIKit.h>");
    _builder.newLine();
    _builder.newLine();
    _builder.append("@interface ");
    String _controllerClassName = this._defaultListScreenClassExtensions.controllerClassName(it);
    _builder.append(_controllerClassName, "");
    _builder.append(" : UITableViewController");
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    _builder.append("@end");
    _builder.newLine();
    return _builder;
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation)

Example 89 with StringConcatenation

use of org.eclipse.xtend2.lib.StringConcatenation in project applause by applause.

the class DefaultListScreenModuleFileCompiler method compileConfiguration.

public CharSequence compileConfiguration(final UIComponentMemberConfiguration it) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("cell.");
    UIComponentMemberCall _type = it.getType();
    UIComponentMemberDeclaration _component = _type.getComponent();
    String _name = _component.getName();
    _builder.append(_name, "");
    _builder.append(".");
    UIComponentMemberCall _type_1 = it.getType();
    UIComponentMemberDeclaration _member = _type_1.getMember();
    String _name_1 = _member.getName();
    _builder.append(_name_1, "");
    _builder.append(" = item.");
    Expression _value = it.getValue();
    String _evaluateExpression = this._expressionExtensions.evaluateExpression(_value);
    _builder.append(_evaluateExpression, "");
    _builder.append(";");
    _builder.newLineIfNotEmpty();
    return _builder;
}
Also used : Expression(org.applause.lang.applauseDsl.Expression) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) UIComponentMemberCall(org.applause.lang.applauseDsl.UIComponentMemberCall) UIComponentMemberDeclaration(org.applause.lang.applauseDsl.UIComponentMemberDeclaration)

Example 90 with StringConcatenation

use of org.eclipse.xtend2.lib.StringConcatenation in project applause by applause.

the class ParserTest method parseDomainModel.

@Test
public void parseDomainModel() {
    try {
        StringConcatenation _builder = new StringConcatenation();
        _builder.append("datatype String");
        _builder.newLine();
        _builder.append("datatype Integer");
        _builder.newLine();
        final Model model = this.parser.parse(_builder);
        EList<NamedElement> _elements = model.getElements();
        NamedElement _head = IterableExtensions.<NamedElement>head(_elements);
        final DataType dtString = ((DataType) _head);
        String _name = dtString.getName();
        Assert.assertEquals("String", _name);
    } catch (Throwable _e) {
        throw Exceptions.sneakyThrow(_e);
    }
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) Model(org.applause.lang.applauseDsl.Model) DataType(org.applause.lang.applauseDsl.DataType) NamedElement(org.applause.lang.applauseDsl.NamedElement) Test(org.junit.Test)

Aggregations

StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)4966 Test (org.junit.Test)4419 AbstractXtendCompilerTest (org.eclipse.xtend.core.tests.compiler.AbstractXtendCompilerTest)1231 XtendFile (org.eclipse.xtend.core.xtend.XtendFile)372 AbstractXtendFormatterTest (org.eclipse.xtend.core.tests.formatting.AbstractXtendFormatterTest)214 AbstractXtendContentAssistBugTest (org.eclipse.xtend.ide.tests.contentassist.AbstractXtendContentAssistBugTest)183 ContentAssistProcessorTestBuilder (org.eclipse.xtext.ui.testing.ContentAssistProcessorTestBuilder)182 XtendMember (org.eclipse.xtend.core.xtend.XtendMember)131 CompilationUnitImpl (org.eclipse.xtend.core.macro.declaration.CompilationUnitImpl)130 XtendClass (org.eclipse.xtend.core.xtend.XtendClass)129 IFile (org.eclipse.core.resources.IFile)122 QuickfixTestBuilder (org.eclipse.xtend.ide.tests.quickfix.QuickfixTestBuilder)122 AmbiguityValidationTest (org.eclipse.xtend.core.tests.validation.AmbiguityValidationTest)118 XtendFunction (org.eclipse.xtend.core.xtend.XtendFunction)115 Grammar (org.eclipse.xtext.Grammar)101 EObject (org.eclipse.emf.ecore.EObject)99 MapBasedPreferenceValues (org.eclipse.xtext.preferences.MapBasedPreferenceValues)99 Procedure1 (org.eclipse.xtext.xbase.lib.Procedures.Procedure1)99 MutableClassDeclaration (org.eclipse.xtend.lib.macro.declaration.MutableClassDeclaration)97 AbstractRule (org.eclipse.xtext.AbstractRule)96