Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Protected Regions for Codegeneration
Protected Regions for Codegeneration [message #1715212] Fri, 20 November 2015 04:36 Go to next message
Eclipse UserFriend
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 03:06] by Moderator

Re: Protected Regions for Codegeneration [message #1715428 is a reply to message #1715212] Mon, 23 November 2015 09:02 Go to previous messageGo to next message
Eclipse UserFriend
What is the error you get?
Re: Protected Regions for Codegeneration [message #1715506 is a reply to message #1715428] Tue, 24 November 2015 03:06 Go to previous messageGo to next message
Eclipse UserFriend
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 02:07] by Moderator

Re: Protected Regions for Codegeneration [message #1715519 is a reply to message #1715506] Tue, 24 November 2015 04:06 Go to previous messageGo to next message
Eclipse UserFriend
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)
	}
Re: Protected Regions for Codegeneration [message #1715520 is a reply to message #1715519] Tue, 24 November 2015 04:07 Go to previous messageGo to next message
Eclipse UserFriend
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.
Re: Protected Regions for Codegeneration [message #1715821 is a reply to message #1715520] Thu, 26 November 2015 07:55 Go to previous messageGo to next message
Eclipse UserFriend
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 08:18 Go to previous message
Eclipse UserFriend
no simply clone the code from github and patch the filesystemaccess class . or at least open a issue at github
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 Jul 15 04:22:39 EDT 2025

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

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

Back to the top