Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Using JET2 to modify existing files(request for API hints to carry out PDE operations)
Using JET2 to modify existing files [message #522283] Mon, 22 March 2010 03:43 Go to next message
Jörn Guy Süß is currently offline Jörn Guy SüßFriend
Messages: 320
Registered: July 2009
Location: Anstead, Brisbane, Queens...
Senior Member

How can I update the content of a file using JET2?

Background:
I am writing a code generator that creates a bridge from SableCC to EMF. My code is generated using JET2 from Ecore. The result is a SableCC parser that parses into a corresponding EMF model. I would like to list the service class as a resource factory, which means modifying plugin.xml, MANIFEST.MF and build.properties via API.
any pointers how I could use JET2 to add the respective content?
Re: Using JET2 to modify existing files [message #522362 is a reply to message #522283] Mon, 22 March 2010 13:25 Go to previous messageGo to next message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Joerr:

Unfortunately, JET2 only offers crude methods for updating plugin.xml
and MANIFEST.MF, namely the <c:userRegion> and <c:initialCode> tags.
But, if your starting point is an arbitrary plug-in, then even this will
prove inadequate.

For the .properties file, the news is a little better. The <java:merge>
tag will automatically add new properties to an existing file (but never
update existing values).

I have wondered (but not had the time to do anything) about building
some tags that had a hybrid text/model view of complex documents like
plugin.xml and MANIFEST.MF. I could imagine a tag something like:

<java:manifest path="...META-INF/MANIFEST.MF"
template="templates/MANIFEST.MF.jet"
merge="true"/>

Which would combine the existing MANIFEST.MF with the generated
MANIFEST.MF. Things could get complex when it comes to merging
properties that exist in both - the rules could be different in each
case. Require-Bundle: and Export-Package: contain lists, while things
like Bundle-Activator: are single values.

You could imagine similar tags for XML. Again, you would need rules to
control the merge. Which elements are to be merged? What happens when in
the case of a conflict?

As I stated at the beginning, I haven't had time to make progress on any
of these, but if you are interested, I be happy to lend my support into
figuring out some answers - especially if we can get them contributed
back into JET.

Paul
Re: Using JET2 to modify existing files [message #522530 is a reply to message #522362] Mon, 22 March 2010 22:17 Go to previous message
Jörn Guy Süß is currently offline Jörn Guy SüßFriend
Messages: 320
Registered: July 2009
Location: Anstead, Brisbane, Queens...
Senior Member

Thanks for the clarification. That is great. I think those structured access tags you are envisioning are precisely what I was looking for. I am trying to extend a manually pre-generated EMF model project (manually mostly because I was not able to control the generator from within a running Eclipse instance. (tried embedded ant, app and gentask, then gave up...)). The pointers you provided should help me make some progress.
Previous Topic:[Acceleo] Controlling whitespace in output text
Next Topic:[XTEND]Iteration over a list
Goto Forum:
  


Current Time: Fri Apr 26 12:45:18 GMT 2024

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

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

Back to the top