Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Source file handling for artefacts which shouldn't be overwritten
Source file handling for artefacts which shouldn't be overwritten [message #762048] Wed, 07 December 2011 13:33 Go to next message
Martin Kuhn is currently offline Martin KuhnFriend
Messages: 49
Registered: July 2009
Member
Hi,

I try to create a project with Xtext 2.1 based on Xtend 2.

In my former xtext projects (XPand based), I defined generation relevant properties like "overwrite = false" and so on in my workflow.

Now I'm able to use org.eclipse.xtext.generator.IFileSystemAccess for file generation which is implemented in org.eclipse.xtext.generator.JavaIoFileSystemAccess.

I tried to find out how I can achieve an effect like the "overwrite=false" setting (available in the xpand generation component (org.eclipse.xpand2.Generator)) but I had no success.
In org.eclipse.xtext.generator.GeneratorComponent members are rather not accessible and customizing is not possible, right?

Can anybody of you give me a hint for an equivalent solution?


TIA
Martin
Re: Source file handling for artefacts which shouldn't be overwritten [message #762273 is a reply to message #762048] Wed, 07 December 2011 19:41 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

this is a bug that IOutputConfigurationProvider is not supported standalone https://bugs.eclipse.org/bugs/show_bug.cgi?id=362080. id try to build a custom version of JavaIoFileSystemAccess. let you inspire by JavaIoFileSystemAccess.
and bind a custom IOutputConfigurationProvider that give a OutputConfiguration with override = false

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Wed, 07 December 2011 19:42]

Report message to a moderator

Re: Source file handling for artefacts which shouldn't be overwritten [message #763726 is a reply to message #762273] Sat, 10 December 2011 12:23 Go to previous messageGo to next message
Martin Kuhn is currently offline Martin KuhnFriend
Messages: 49
Registered: July 2009
Member
Hi,

thanks for repsonding. You mean I should write my own version of org.eclipse.xtext.generator.GeneratorComponent and org.eclipse.xtext.generator.JavaIoFileSystemAccess, right? (I would not really like to do this...)

These classes are not really prepared to be extended...

Am I the only one who has such a problem? For me it is a common use case to differentiate between artefacts which should be overriden and others.
Is it really the case that there is no support for such things.

Is nothing planned in that direction?

TIA

Regards,
Martin
Re: Source file handling for artefacts which shouldn't be overwritten [message #763740 is a reply to message #763726] Sat, 10 December 2011 13:06 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

if you sublass or do copy and paste is your choice
yes it is a common usecase and it is already supported if you use the builder and not a workflow component.
as i said: it is a bug. so it will be fixed. if you attach a patch to the bug this will be sooner than later.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Source file handling for artefacts which shouldn't be overwritten [message #763745 is a reply to message #763740] Sat, 10 December 2011 13:20 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
P.s: subclassing JavaIoFileSystemAccess should be sufficient

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Source file handling for artefacts which shouldn't be overwritten [message #763755 is a reply to message #763745] Sat, 10 December 2011 13:43 Go to previous messageGo to next message
Martin Kuhn is currently offline Martin KuhnFriend
Messages: 49
Registered: July 2009
Member
Hi Christian,

there is a patch already ( https://bugs.eclipse.org/bugs/show_bug.cgi?id=362080) -> as you mentioned. Is this patch not sufficient?

When I use the workflow ( with org.eclipse.xtext.generator.GeneratorComponent) I don't know how to provide my "own" org.eclipse.xtext.generator.JavaIoFileSystemAccess implementation.

With GeneratorComponent I'm only able to define "outlets" and not more, right?

TIA
Martin

Re: Source file handling for artefacts which shouldn't be overwritten [message #763791 is a reply to message #763755] Sat, 10 December 2011 15:25 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
No it is not sufficient. Just add a binding to JavaIOFileSystem access to your guice module. Same as for IOutputConfiguration provider where you do the actual config.of course you could make this more fancy with a own GeneratorComponent. See the Eclipse....Access2 for inspiration.
Just give it a start you will have a sufficient solution soon.


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:how to override XbaseCompiler
Next Topic:importURI
Goto Forum:
  


Current Time: Thu Apr 25 03:51:55 GMT 2024

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

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

Back to the top