org.eclipse.xtext.serializer.impl.Serializer Java Examples

The following examples show how to use org.eclipse.xtext.serializer.impl.Serializer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PartialParserTest.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Test public void testBug370426() throws Exception {
	with(SimpleExpressionsTestLanguageStandaloneSetup.class);
	String model = "a/b\n+c";
	XtextResource resource = getResourceFromString(model);
	assertTrue(resource.getErrors().toString(), resource.getErrors().isEmpty());
	// turn /b into a comment
	resource.update(model.indexOf("/"), 0, "/");
	assertTrue(resource.getErrors().toString(), resource.getErrors().isEmpty());
	Serializer serializer = get(Serializer.class);
	String newModel = serializer.serialize(EcoreUtil.copy(resource.getContents().get(0)));
	assertEquals("a + c", newModel);
	
	// change comment back into /b 		
	resource.update(model.indexOf("/"), 1, "");
	assertTrue(resource.getErrors().toString(), resource.getErrors().isEmpty());
	assertEquals(model, serialize(resource.getContents().get(0)));
}
 
Example #2
Source File: SerializerFragment2.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void generate() {
  new GuiceModuleAccess.BindingFactory().addTypeToType(TypeReference.typeRef(ISemanticSequencer.class), this.getSemanticSequencerClass(this.getGrammar())).addTypeToType(TypeReference.typeRef(ISyntacticSequencer.class), this.getSyntacticSequencerClass(this.getGrammar())).addTypeToType(TypeReference.typeRef(ISerializer.class), TypeReference.typeRef(Serializer.class)).contributeTo(this.getLanguage().getRuntimeGenModule());
  ManifestAccess _manifest = this.getProjectConfig().getRuntime().getManifest();
  boolean _tripleNotEquals = (_manifest != null);
  if (_tripleNotEquals) {
    Set<String> _exportedPackages = this.getProjectConfig().getRuntime().getManifest().getExportedPackages();
    String _serializerBasePackage = this.getSerializerBasePackage(this.getGrammar());
    _exportedPackages.add(_serializerBasePackage);
    Set<String> _requiredBundles = this.getProjectConfig().getRuntime().getManifest().getRequiredBundles();
    String _xbaseLibVersionLowerBound = this.getProjectConfig().getRuntime().getXbaseLibVersionLowerBound();
    String _plus = ("org.eclipse.xtext.xbase.lib;bundle-version=\"" + _xbaseLibVersionLowerBound);
    String _plus_1 = (_plus + "\"");
    _requiredBundles.add(_plus_1);
  }
  this.generateAbstractSemanticSequencer();
  this.generateAbstractSyntacticSequencer();
  boolean _isGenerateStub = this.isGenerateStub();
  if (_isGenerateStub) {
    this.generateSemanticSequencer();
    this.generateSyntacticSequencer();
  }
  if (this.generateDebugData) {
    this.generateGrammarConstraints();
    Iterable<Pair<String, String>> _generateDebugGraphs = this.debugGraphGenerator.generateDebugGraphs();
    for (final Pair<String, String> fileToContent : _generateDebugGraphs) {
      this.getProjectConfig().getRuntime().getSrcGen().generateFile(fileToContent.getKey(), fileToContent.getValue());
    }
  }
}
 
Example #3
Source File: SerializerFragment.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public Set<Binding> getGuiceBindingsRt(Grammar grammar) {
	BindFactory bf = new BindFactory();
	bf.addTypeToType(ISemanticSequencer.class.getName(), names.getSemanticSequencer().getQualifiedName());
	bf.addTypeToType(ISyntacticSequencer.class.getName(), names.getSyntacticSequencer().getQualifiedName());
	bf.addTypeToType(ISerializer.class.getName(), Serializer.class.getName());
	return bf.getBindings();
}
 
Example #4
Source File: AbstractParametersTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ISerializer> bindISerializer() {
	return Serializer.class;
}
 
Example #5
Source File: AbstractXtextTerminalsTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ISerializer> bindISerializer() {
	return Serializer.class;
}
 
Example #6
Source File: AbstractLazyLinkingTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ISerializer> bindISerializer() {
	return Serializer.class;
}
 
Example #7
Source File: AbstractRefactoringTestLanguage1RuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ISerializer> bindISerializer() {
	return Serializer.class;
}
 
Example #8
Source File: AbstractCodetemplatesRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ISerializer> bindISerializer() {
	return Serializer.class;
}
 
Example #9
Source File: AbstractBug296889TestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ISerializer> bindISerializer() {
	return Serializer.class;
}
 
Example #10
Source File: AbstractQuickfixCrossrefTestLanguageRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ISerializer> bindISerializer() {
	return Serializer.class;
}
 
Example #11
Source File: AbstractFowlerDslTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ISerializer> bindISerializer() {
	return Serializer.class;
}
 
Example #12
Source File: AbstractInheritanceTest3LanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ISerializer> bindISerializer() {
	return Serializer.class;
}
 
Example #13
Source File: AbstractBug305397RuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ISerializer> bindISerializer() {
	return Serializer.class;
}
 
Example #14
Source File: AbstractTwoParametersTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ISerializer> bindISerializer() {
	return Serializer.class;
}
 
Example #15
Source File: AbstractHiddenTerminalsTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ISerializer> bindISerializer() {
	return Serializer.class;
}
 
Example #16
Source File: SimpleExpressionsRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public Class<? extends ISerializer> bindISerializer() {
	return Serializer.class;
}
 
Example #17
Source File: AbstractFormatterTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ISerializer> bindISerializer() {
	return Serializer.class;
}
 
Example #18
Source File: AbstractContentAssistContextTestLanguageRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ISerializer> bindISerializer() {
	return Serializer.class;
}
 
Example #19
Source File: AbstractBug348427TestLanguageRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ISerializer> bindISerializer() {
	return Serializer.class;
}
 
Example #20
Source File: AbstractUnassignedTextTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ISerializer> bindISerializer() {
	return Serializer.class;
}
 
Example #21
Source File: AbstractAbstractIgnoreCaseLinkingTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ISerializer> bindISerializer() {
	return Serializer.class;
}
 
Example #22
Source File: AbstractTwoContextsTestLanguageRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ISerializer> bindISerializer() {
	return Serializer.class;
}
 
Example #23
Source File: AbstractRegionAccessTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ISerializer> bindISerializer() {
	return Serializer.class;
}
 
Example #24
Source File: AbstractXtextRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ISerializer> bindISerializer() {
	return Serializer.class;
}
 
Example #25
Source File: AbstractBug299395TestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ISerializer> bindISerializer() {
	return Serializer.class;
}
 
Example #26
Source File: AbstractEcoreFragmentTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ISerializer> bindISerializer() {
	return Serializer.class;
}
 
Example #27
Source File: AbstractBug303200TestLanguageRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ISerializer> bindISerializer() {
	return Serializer.class;
}
 
Example #28
Source File: AbstractDomainmodelRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ISerializer> bindISerializer() {
	return Serializer.class;
}
 
Example #29
Source File: AbstractSyntacticSequencerTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ISerializer> bindISerializer() {
	return Serializer.class;
}
 
Example #30
Source File: AbstractConcreteSyntaxValidationTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends ISerializer> bindISerializer() {
	return Serializer.class;
}