|When will an Tag-Action be executed [message #52310]
||Thu, 23 October 2008 06:51
| Timothy Marc
Registered: July 2009
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:
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 12:50
| Paul Elder
Registered: July 2009
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.
Powered by FUDForum
. Page generated in 0.01717 seconds