Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Protected Regions for Codegeneration
Protected Regions for Codegeneration [message #1715212] Fri, 20 November 2015 09:36 Go to next message
Stephan Schaer is currently offline Stephan SchaerFriend
Messages: 3
Registered: November 2015
Junior Member
We like to modify the generated code which should not be overridden after an additional generation. For that we used https://github.com/danieldietrich/xtext-protected-regions.

For that we registered this mechanism with the following code inside RuntimeModule implementation:


	@Provides
	public JavaIoFileSystemAccess createJavaIoFileSystemAccess(ProtectedRegionJavaIoFileSystemAccess fsa, ParserFactory factory) {
	  fsa.support().addParser(factory.javaParser(), ".java");
	  fsa.support().addParser(factory.xmlParser(), ".xml", ".xsd");
	 // BidiJavaIoFileSystemAccess fsa2 = new BidiJavaIoFileSystemAccess(support);
	  return fsa;
	}


With the newest Version this is not possible anymore. How can we do the same with the newest version? Which possibilities do we have? Is there an alternative?

[Updated on: Tue, 24 November 2015 08:06]

Report message to a moderator

Re: Protected Regions for Codegeneration [message #1715428 is a reply to message #1715212] Mon, 23 November 2015 14:02 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
What is the error you get?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Protected Regions for Codegeneration [message #1715506 is a reply to message #1715428] Tue, 24 November 2015 08:06 Go to previous messageGo to next message
Stephan Schaer is currently offline Stephan SchaerFriend
Messages: 3
Registered: November 2015
Junior Member
I have no error. The problem is that the registration of the parsers will not be executed. For me is not clear how I can register this parsers with Xtend 2.9.

[Updated on: Thu, 26 November 2015 07:07]

Report message to a moderator

Re: Protected Regions for Codegeneration [message #1715519 is a reply to message #1715506] Tue, 24 November 2015 09:06 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
the api of the post process method has changed

=>

	override postProcess(String fileName, String outputConfiguration, CharSequence content, String charset) {
		logger.debug("postProcess('{}', '{}', <content>)", fileName, outputConfiguration)
		val postProcessed = super.postProcess(fileName, outputConfiguration, content, charset)
		val file = file(fileName, outputConfiguration)
		support.merge(file, postProcessed, charsetProvider)
	}


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Protected Regions for Codegeneration [message #1715520 is a reply to message #1715519] Tue, 24 November 2015 09:07 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
i think a pullrequest for the protected regions project world be welcome.
maybe you have to patch the Access in the ui project as well.


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Protected Regions for Codegeneration [message #1715821 is a reply to message #1715520] Thu, 26 November 2015 12:55 Go to previous messageGo to next message
Stephan Schaer is currently offline Stephan SchaerFriend
Messages: 3
Registered: November 2015
Junior Member
For me it's not really clear what I have to do. Is there a tutorial where I can learn the necessary steps?
Re: Protected Regions for Codegeneration [message #1715827 is a reply to message #1715821] Thu, 26 November 2015 13:18 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
no simply clone the code from github and patch the filesystemaccess class . or at least open a issue at github

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Xcore model support with Xtext 2.9.0.rc2
Next Topic:Get information about current bundle in generator
Goto Forum:
  


Current Time: Tue Apr 23 13:15:16 GMT 2024

Powered by FUDForum. Page generated in 0.03430 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top