Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » When will an Tag-Action be executed
When will an Tag-Action be executed [message #52310] Thu, 23 October 2008 10:51 Go to next message
Timothy Marc is currently offline Timothy MarcFriend
Messages: 547
Registered: July 2009
Senior Member

a question concerning the point in time of an Tag-Action. Will the
corresponding action be executed when the parser founds the declaration
position or when the content of the tag was executed finally?

Let's assume the following example. I will focus the ws:file-Tag:

<control:include .../>

The include-Tag invokes a template and returns the result back. My own
computeContent-Tag takes this content and does additional things.
Afterwards, i want to write it out to an file.

But now my question: If the file exists, which is specified in the file-Tag,
will it be replaced after the exection of computeContent or a declaration
time? In the computeContent-Tag, i need access to the file in the file-Tag,
if it exists, for some comparing work. After this, the computed content
should be written out.

Re: When will an Tag-Action be executed [message #52370 is a reply to message #52310] Mon, 27 October 2008 16:50 Go to previous message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member

JET tags execute during template expansion. Tags which have content have
methods that execute before and after the content is processed.

But, JET has a more extensive eventing model that just tag expansion. JET
currently has events for:

JET2Writer events. See org.eclipse.jet.JET2Writer.addEventListener(String,
IWriterListener) to register for these
* finalizing buffer contents once template expansion is complete. The
c:userRegion and java:merge tags make uses of this event
* post file writing. The c:marker event makes use of this

JET transformation events:
* commit transformation contents (this occurs after all templates have run).
This is primarily used to support Workspace actions. In particular, tags
like ws:file do not write their contents immediately. Instead, the actual
work of writing the expanded template to the Eclipse workspace is defered
until all templates have completed. This lets JET accumulate all changes
into a single workspace operation. This lets JET play nicely with the
Eclipse workspace and with Team environments.

It is also possible to place temporary markers on expanded buffers so that
you can return to those locations later. Tags like c:userRegion and
java:importsLocation make use of this.

I'd suggest looking at any of the above tag implementations for some ideas.

Previous Topic:How to check if XPath query returns empty result?
Next Topic:Resolving "non-containment" EReference's
Goto Forum:

Current Time: Sat Jun 23 22:01:44 GMT 2018

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

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

Back to the top