当前位置: 首页>>代码示例>>Java>>正文


Java StringConcatenation.newLine方法代码示例

本文整理汇总了Java中org.eclipse.xtend2.lib.StringConcatenation.newLine方法的典型用法代码示例。如果您正苦于以下问题:Java StringConcatenation.newLine方法的具体用法?Java StringConcatenation.newLine怎么用?Java StringConcatenation.newLine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.xtend2.lib.StringConcatenation的用法示例。


在下文中一共展示了StringConcatenation.newLine方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: generateInitialContents

import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
public void generateInitialContents(final IFileSystemAccess2 fsa) {
  String _primaryFileExtension = this.fileExtensionProvider.getPrimaryFileExtension();
  String _plus = ("src/model/Model." + _primaryFileExtension);
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("Restaurantes \"Hola\" fecha 30-10-2016");
  _builder.newLine();
  _builder.newLine();
  _builder.append("Ingredientes {");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("Ingrediente: COD1 \'moluscos\' infoURL: http://moluscos.com alergenico");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  fsa.generateFile(_plus, _builder);
}
 
开发者ID:vicegd,项目名称:org.xtext.dsl.restaurante,代码行数:17,代码来源:RestauranteNewProjectWizardInitialContents.java

示例2: testBug_272566_1

import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Test
public void testBug_272566_1() throws Exception {
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("grammar test with org.eclipse.xtext.common.Terminals");
  _builder.newLine();
  _builder.append("generate test \'http://test\'");
  _builder.newLine();
  _builder.append("Model:");
  _builder.newLine();
  _builder.append("   ");
  _builder.append("test=Test");
  _builder.newLine();
  _builder.append(";");
  _builder.newLine();
  _builder.newLine();
  _builder.append("Test:");
  _builder.newLine();
  _builder.append("   ");
  _builder.append("\"keyword\" WS name=ID");
  _builder.newLine();
  _builder.append(";");
  _builder.newLine();
  String grammar = _builder.toString();
  final XtextResource resource = this.getResourceFromString(grammar);
  Assert.assertTrue(resource.getErrors().toString(), resource.getErrors().isEmpty());
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:27,代码来源:Xtext2EcoreTransformerTest.java

示例3: testRedundantCases_02

import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Test
public void testRedundantCases_02() {
  try {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("switch i : 1 {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("case 1,");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("case 2,");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    this._validationTestHelper.assertError(this.expression(_builder), XbasePackage.Literals.XCASE_PART, IssueCodes.REDUNDANT_CASE);
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:20,代码来源:XbaseValidationTest.java

示例4: testIgnoreEmptyLines_1

import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Test
public void testIgnoreEmptyLines_1() {
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("first");
  _builder.newLine();
  _builder.append("\t");
  _builder.newLine();
  _builder.append("second");
  _builder.newLine();
  final ICompositeNode tree = this.getRootNode(_builder);
  StringConcatenation _builder_1 = new StringConcatenation();
  _builder_1.append("[ID:first][-WS:");
  _builder_1.newLine();
  _builder_1.append("\\t");
  _builder_1.newLine();
  _builder_1.append("][ID:second][-WS:");
  _builder_1.newLine();
  _builder_1.append("]");
  _builder_1.newLine();
  NodeModelTest.assertEquals(_builder_1.toString().trim(), this.asText(tree));
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:22,代码来源:NodeModelTest.java

示例5: testRemoveElementInSameLine

import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Test
public void testRemoveElementInSameLine() {
  try {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("entities");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("Foo \"Bar\" /* the foo */ Baz \"Fizzle\"");
    _builder.newLine();
    _builder.append("end");
    _builder.newLine();
    final Model model = this._parseHelper.parse(_builder);
    model.getDomainModel().getEntities().remove(1);
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("entities");
    _builder_1.newLine();
    _builder_1.append("\t");
    _builder_1.append("Foo \"Bar\" /* the foo */");
    _builder_1.newLine();
    _builder_1.append("end");
    this.assertSerializesTo(model, _builder_1);
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:26,代码来源:SerializationAfterModelChangeTest.java

示例6: testLastCompleteNode_3_1

import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Test
@Override
public void testLastCompleteNode_3_1() {
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("c");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("d");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("g");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("<|>");
  _builder.newLine();
  StringConcatenation _builder_1 = new StringConcatenation();
  _builder_1.append("[ID:c]");
  _builder_1.newLine();
  _builder_1.append("[INDENT:]");
  _builder_1.newLine();
  _builder_1.append("[ID:d]");
  _builder_1.newLine();
  _builder_1.append("[ID:g]");
  _builder_1.newLine();
  this.assertLastCompleteNode(_builder, _builder_1.toString());
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:27,代码来源:IndentationAwareCompletionPrefixProviderTest.java

示例7: formatWhile11

import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Test
public void formatWhile11() {
  final Procedure1<FormatterTestRequest> _function = (FormatterTestRequest it) -> {
    final Procedure1<MapBasedPreferenceValues> _function_1 = (MapBasedPreferenceValues it_1) -> {
      it_1.<Boolean>put(XbaseFormatterPreferenceKeys.whitespaceBetweenKeywordAndParenthesisML, Boolean.valueOf(true));
    };
    it.preferences(_function_1);
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("while (true)");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("println(\"x\")");
    _builder.newLine();
    it.setToBeFormatted(_builder);
  };
  this._xbaseFormatterTester.assertFormattedExpression(_function);
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:18,代码来源:XbaseFormatterTest.java

示例8: testParserRuleFragment_08

import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Test
public void testParserRuleFragment_08() throws Exception {
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("grammar test with org.eclipse.xtext.common.Terminals");
  _builder.newLine();
  _builder.append("generate test \'http://test\'");
  _builder.newLine();
  _builder.append("RuleA: feature=Fragment;");
  _builder.newLine();
  _builder.append("fragment Fragment * Fragment: name=ID;");
  _builder.newLine();
  final String grammar = _builder.toString();
  this.errorAcceptorMock.acceptError(TransformationErrorCode.InvalidFragmentCall, 
    TestErrorAcceptor.ANY_STRING, TestErrorAcceptor.ANY_EOBJECT);
  EPackage result = this.getEPackageFromGrammar(grammar, 2);
  Assert.assertEquals(1, result.getEClassifiers().size());
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:18,代码来源:Xtext2EcoreTransformerTest.java

示例9: testDuplicateCases_object

import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Test
public void testDuplicateCases_object() {
  try {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("switch x : new Object {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("case \'A\': 1");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("case \'A\': 1");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    this._validationTestHelper.assertError(this.expression(_builder), XbasePackage.Literals.XSTRING_LITERAL, IssueCodes.DUPLICATE_CASE);
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:20,代码来源:XbaseValidationTest.java

示例10: loadModel

import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Test
public void loadModel() {
  try {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("Hello Xtext!");
    _builder.newLine();
    final Mensamodel result = this.parseHelper.parse(_builder);
    Assert.assertNotNull(result);
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
开发者ID:fatalerrortan,项目名称:Xtext_Xtend_HTML_Generator,代码行数:13,代码来源:MyDslParsingTest.java

示例11: compilarIngredientes

import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
public CharSequence compilarIngredientes(final List<Ingrediente> ingredientes) {
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("var code = \'<table class=\"tingredientes\">\\");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("<tr class=\"tingredientes_cabecera\">\\");
  _builder.newLine();
  _builder.append("\t\t");
  _builder.append("<td></td>\\");
  _builder.newLine();
  _builder.append("\t\t");
  _builder.append("<td>Ingrediente</td>\\");
  _builder.newLine();
  _builder.append("\t\t");
  _builder.append("<td>Al�rgeno</td>\\");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("</tr>\\");
  _builder.newLine();
  {
    for(final Ingrediente i : ingredientes) {
      _builder.append("\t");
      CharSequence _compilarTexto = this.compilarTexto(i);
      _builder.append(_compilarTexto, "\t");
      _builder.newLineIfNotEmpty();
    }
  }
  _builder.append("</table>\';");
  _builder.newLine();
  return _builder;
}
 
开发者ID:vicegd,项目名称:org.xtext.dsl.restaurante,代码行数:32,代码来源:GeneradorWeb.java

示例12: compilarTexto

import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
public CharSequence compilarTexto(final Restaurante r) {
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("Restaurantes ==> ");
  String _nombre = r.getNombre();
  _builder.append(_nombre);
  _builder.newLineIfNotEmpty();
  _builder.append("Fecha de edici�n ==> ");
  String _fecha = r.getFecha();
  _builder.append(_fecha);
  _builder.newLineIfNotEmpty();
  _builder.newLine();
  _builder.append("Informaci�n sobre los productos");
  _builder.newLine();
  _builder.append("-------------------------------");
  _builder.newLine();
  {
    EList<Producto> _productos = r.getProductos();
    for(final Producto p : _productos) {
      CharSequence _compilarTexto = this.compilarTexto(p);
      _builder.append(_compilarTexto);
      _builder.newLineIfNotEmpty();
    }
  }
  _builder.newLine();
  _builder.append("Informaci�n sobre los men�s");
  _builder.newLine();
  _builder.append("---------------------------");
  _builder.newLine();
  {
    EList<Menu> _menus = r.getMenus();
    for(final Menu m : _menus) {
      CharSequence _compilarTexto_1 = this.compilarTexto(m);
      _builder.append(_compilarTexto_1);
      _builder.newLineIfNotEmpty();
    }
  }
  return _builder;
}
 
开发者ID:vicegd,项目名称:org.xtext.dsl.restaurante,代码行数:39,代码来源:GeneradorTexto.java

示例13: testBug296496_02

import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Test
public void testBug296496_02() throws Exception {
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("grammar test with org.eclipse.xtext.common.Terminals");
  _builder.newLine();
  _builder.append("import \"classpath:/org/eclipse/xtext/enumrules/enums.ecore\"");
  _builder.newLine();
  _builder.append("generate myDsl \"http://example.xtext.org/MyDsl\"");
  _builder.newLine();
  _builder.append("CreatedType:");
  _builder.newLine();
  _builder.append("  ");
  _builder.append("enumFeature=ExistingEnum otherEnumFeature=ExistingEnum;");
  _builder.newLine();
  _builder.append("enum ExistingEnum:");
  _builder.newLine();
  _builder.append("  ");
  _builder.append("SameName | OverriddenLiteral = \"overridden\" | DifferentName;");
  _builder.newLine();
  final String grammarAsString = _builder.toString();
  final XtextResource resource = this.getResourceFromStringAndExpect(grammarAsString, 0);
  Assert.assertTrue(resource.getErrors().toString(), resource.getErrors().isEmpty());
  EObject _head = IterableExtensions.<EObject>head(resource.getContents());
  final Grammar grammar = ((Grammar) _head);
  AbstractMetamodelDeclaration _get = grammar.getMetamodelDeclarations().get(1);
  GeneratedMetamodel generatedMetamodel = ((GeneratedMetamodel) _get);
  Assert.assertEquals("myDsl", generatedMetamodel.getName());
  EClassifier _type = this.<EClassifier>type(generatedMetamodel.getEPackage(), "CreatedType");
  EClass createdType = ((EClass) _type);
  Assert.assertEquals(this.<EStructuralFeature>feature(createdType, "enumFeature").getEType(), 
    this.<EStructuralFeature>feature(createdType, "otherEnumFeature").getEType());
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:33,代码来源:Xtext2EcoreTransformerTest.java

示例14: formatTryCatchCatchFinallyExpression1

import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Test
public void formatTryCatchCatchFinallyExpression1() {
  final Procedure1<FormatterTestRequest> _function = (FormatterTestRequest it) -> {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("try");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("println(\"x\")");
    _builder.newLine();
    _builder.append("catch (Exception e)");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("println(\"y\")");
    _builder.newLine();
    _builder.append("catch (Exception f)");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("println(\"z\")");
    _builder.newLine();
    _builder.append("finally");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("println(\"a\")");
    _builder.newLine();
    it.setExpectation(_builder);
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("try   println(\"x\")  catch   (   Exception   e   )   println(\"y\")  catch   (   Exception   f  )   println(\"z\")  finally   println(\"a\")");
    _builder_1.newLine();
    it.setToBeFormatted(_builder_1);
  };
  this._xbaseFormatterTester.assertFormattedExpression(_function);
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:33,代码来源:XbaseFormatterTest.java

示例15: testOverrideDatatypeRule_02

import org.eclipse.xtend2.lib.StringConcatenation; //导入方法依赖的package包/类
@Test
public void testOverrideDatatypeRule_02() throws Exception {
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("grammar test with org.eclipse.xtext.parser.datatyperules.DatatypeRulesTestLanguage");
  _builder.newLine();
  _builder.append("terminal ModelId: \'a\'..\'z\'+;");
  _builder.newLine();
  final String grammarAsString = _builder.toString();
  this.getResourceFromString(grammarAsString);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:11,代码来源:Xtext2EcoreTransformerTest.java


注:本文中的org.eclipse.xtend2.lib.StringConcatenation.newLine方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。