Search in sources :

Example 91 with StringConcatenation

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

the class DefaultDetailsScreenModuleFileCompiler method compileUpdateItemFragment.

public CharSequence compileUpdateItemFragment(final Screen it) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("[self.item ");
    String _dataAccessMethodNameForUpdate = this.dataAccessMethodNameForUpdate(it);
    _builder.append(_dataAccessMethodNameForUpdate, "");
    _builder.append(":^(");
    Entity _resourceType = this._defaultDetailsScreenClassExtensions.resourceType(it);
    String _typeName = this._typeExtensions.typeName(_resourceType);
    _builder.append(_typeName, "");
    _builder.append(" *item, NSError *error)");
    _builder.newLineIfNotEmpty();
    _builder.append("{");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("if(error == nil) {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("if (self.doneBlock) {");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("self.doneBlock(item);");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("else {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("// use a HUD to display this to the user:");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("NSLog(@\"Problem saving the ");
    Entity _resourceType_1 = this._defaultDetailsScreenClassExtensions.resourceType(it);
    String _typeName_1 = this._typeExtensions.typeName(_resourceType_1);
    String _firstLower = StringExtensions.toFirstLower(_typeName_1);
    _builder.append(_firstLower, "		");
    _builder.append(". Try again later.\");");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}];");
    _builder.newLine();
    return _builder;
}
Also used : Entity(org.applause.lang.applauseDsl.Entity) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation)

Example 92 with StringConcatenation

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

the class DefaultDetailsScreenModuleFileCompiler method compileCreateNewItemFragment.

public CharSequence compileCreateNewItemFragment(final Screen it) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("[self.item ");
    String _dataAccessMethodNameForCreate = this.dataAccessMethodNameForCreate(it);
    _builder.append(_dataAccessMethodNameForCreate, "");
    _builder.append(":^(");
    Entity _resourceType = this._defaultDetailsScreenClassExtensions.resourceType(it);
    String _typeName = this._typeExtensions.typeName(_resourceType);
    _builder.append(_typeName, "");
    _builder.append(" *item, NSError *error)");
    _builder.newLineIfNotEmpty();
    _builder.append("{");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("if(error == nil) {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("if (self.doneBlock) {");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("self.doneBlock(item);");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("else {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("// use a HUD to display this to the user:");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("NSLog(@\"Problem saving the ");
    Entity _resourceType_1 = this._defaultDetailsScreenClassExtensions.resourceType(it);
    String _typeName_1 = this._typeExtensions.typeName(_resourceType_1);
    String _firstLower = StringExtensions.toFirstLower(_typeName_1);
    _builder.append(_firstLower, "		");
    _builder.append(". Try again later.\");");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}];");
    _builder.newLine();
    return _builder;
}
Also used : Entity(org.applause.lang.applauseDsl.Entity) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation)

Example 93 with StringConcatenation

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

the class DefaultListScreenActionCompiler method compileActionMethod_EditItem.

private CharSequence compileActionMethod_EditItem(final Screen it) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("- (void)onEditItem:(");
    Entity _resourceType = this._defaultListScreenClassExtensions.resourceType(it);
    String _typeName = this._typeExtensions.typeName(_resourceType);
    _builder.append(_typeName, "");
    _builder.append(" *)item");
    _builder.newLineIfNotEmpty();
    _builder.append("{");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("[");
    Screen _targetNavigationScreen = this._defaultListScreenClassExtensions.targetNavigationScreen(it);
    String _controllerClassName = this._defaultListScreenClassExtensions.controllerClassName(_targetNavigationScreen);
    _builder.append(_controllerClassName, "	");
    _builder.append(" presentForEditingItem:item fromParent:self onDone:^(");
    Entity _resourceType_1 = this._defaultListScreenClassExtensions.resourceType(it);
    String _typeName_1 = this._typeExtensions.typeName(_resourceType_1);
    _builder.append(_typeName_1, "	");
    _builder.append(" *editedItem)");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.append("{");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("[self refresh];");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}];");
    _builder.newLine();
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    return _builder;
}
Also used : Entity(org.applause.lang.applauseDsl.Entity) Screen(org.applause.lang.applauseDsl.Screen) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation)

Example 94 with StringConcatenation

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

the class DefaultListScreenActionCompiler method compileActionButton_AddItem.

private CharSequence compileActionButton_AddItem(final Screen it) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd");
    _builder.newLine();
    _builder.append("\t\t\t\t\t\t\t\t\t\t\t  ");
    _builder.append("target:self");
    _builder.newLine();
    _builder.append("\t\t\t\t\t\t\t\t\t\t\t  ");
    _builder.append("action:@selector(onAddItem)]");
    _builder.newLine();
    return _builder;
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation)

Example 95 with StringConcatenation

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

the class DefaultListScreenActionCompiler method compileActionMethod_AddItem.

private CharSequence compileActionMethod_AddItem(final Screen it) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("- (void)onAddItem");
    _builder.newLine();
    _builder.append("{");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("[");
    Screen _targetNavigationScreen = this._defaultListScreenClassExtensions.targetNavigationScreen(it);
    String _controllerClassName = this._defaultListScreenClassExtensions.controllerClassName(_targetNavigationScreen);
    _builder.append(_controllerClassName, "	");
    _builder.append(" presentForAddingNewItemFromParent:self onDone:^(");
    Entity _resourceType = this._defaultListScreenClassExtensions.resourceType(it);
    String _typeName = this._typeExtensions.typeName(_resourceType);
    _builder.append(_typeName, "	");
    _builder.append(" *item)");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.append("{");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("[self refresh];");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}];");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    return _builder;
}
Also used : Entity(org.applause.lang.applauseDsl.Entity) Screen(org.applause.lang.applauseDsl.Screen) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation)

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