Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Re: JET2 - declaring custom tags
Re: JET2 - declaring custom tags [message #4486] Wed, 14 March 2007 17:59 Go to next message
Eclipse User
Originally posted by: merks.ca.ibm.com

Vincent,

Questions about JET2 should be directed to the m2t newsgroup, which I've
added to the "to" list.


Vincent wrote:
> Hi everyone, I just discovered new JET2 capabilities and I would like
> to use it in my project.
> I followed the IBM's tutorial
> ( http://www-128.ibm.com/developerworks/opensource/library/os- ecl-jet/)
> and doing simple transformations works right now.
>
> My question is : how to extend JET2 by declaring my own custom tags ?
> I tried to add a extension point (org.eclipse.jet.tagLibrairies) and
> implement a HelloWorldTag.java as my custom tag, but when I call this
> newly tag in the dump.jet, it just prints out my tag (ie. the tag is
> not recognized by the parser)
>
> Have anyone ever tried to declare custom tags ? How can I do that ?
>
> Thanks in advance !
>
Re: JET2 - declaring custom tags [message #4557 is a reply to message #4486] Wed, 14 March 2007 18:00 Go to previous messageGo to next message
Eclipse User
Originally posted by: merks.ca.ibm.com

Sorry, I see you already did that. Just don't bother cross posting it
to EMFT next time...


Ed Merks wrote:
> Vincent,
>
> Questions about JET2 should be directed to the m2t newsgroup, which
> I've added to the "to" list.
>
>
> Vincent wrote:
>> Hi everyone, I just discovered new JET2 capabilities and I would like
>> to use it in my project.
>> I followed the IBM's tutorial
>> ( http://www-128.ibm.com/developerworks/opensource/library/os- ecl-jet/)
>> and doing simple transformations works right now.
>>
>> My question is : how to extend JET2 by declaring my own custom tags ?
>> I tried to add a extension point (org.eclipse.jet.tagLibrairies) and
>> implement a HelloWorldTag.java as my custom tag, but when I call this
>> newly tag in the dump.jet, it just prints out my tag (ie. the tag is
>> not recognized by the parser)
>>
>> Have anyone ever tried to declare custom tags ? How can I do that ?
>>
>> Thanks in advance !
>>
Re: JET2 - declaring custom tags [message #4625 is a reply to message #4557] Thu, 15 March 2007 08:20 Go to previous messageGo to next message
Eclipse User
Originally posted by: vincent.lg.voila.fr

Thanks for the reply Ed.
Re: JET2 - declaring custom tags [message #4694 is a reply to message #4625] Thu, 15 March 2007 14:48 Go to previous messageGo to next message
Eclipse User
Originally posted by: vincent.lg.voila.fr

Ok, I did some more investigations.

I had hard time debugging my plugins and I found where I was mistaken when
I was writing this post, and now it works.

I was confused with all those libraries and tags ids and forgot a package
when importing mys custom tag... too bad :-(

I keep wondering why there is so few articles about JET2. Online help is
good for a minimal implementation but it goes hard when trying to go
further.

Anyways, thanks for the EMFT and all Eclipse Teams for their great job.
Vincent.
Re: JET2 - declaring custom tags [message #4762 is a reply to message #4694] Thu, 15 March 2007 15:03 Go to previous messageGo to next message
Eclipse User
Originally posted by: merks.ca.ibm.com

Vincent,

Documentation is typically lacking because there are barely enough
people to do all the development and support work. :-(


Vincent wrote:
> Ok, I did some more investigations.
>
> I had hard time debugging my plugins and I found where I was mistaken
> when I was writing this post, and now it works.
>
> I was confused with all those libraries and tags ids and forgot a
> package when importing mys custom tag... too bad :-(
>
> I keep wondering why there is so few articles about JET2. Online help
> is good for a minimal implementation but it goes hard when trying to
> go further.
>
> Anyways, thanks for the EMFT and all Eclipse Teams for their great job.
> Vincent.
>
Re: JET2 - declaring custom tags [message #4830 is a reply to message #4694] Thu, 15 March 2007 15:54 Go to previous messageGo to next message
Vladimir Sosnin is currently offline Vladimir Sosnin
Messages: 19
Registered: July 2009
Junior Member
Vincent,

I wrote plugin for JET2 using obvious rules for writing plugins. There
were nothing special. You should use extension points and dependencies,
and nothing more.

Regards,
Vladimir

Vincent wrote:
> Ok, I did some more investigations.
>
> I had hard time debugging my plugins and I found where I was mistaken
> when I was writing this post, and now it works.
>
> I was confused with all those libraries and tags ids and forgot a
> package when importing mys custom tag... too bad :-(
>
> I keep wondering why there is so few articles about JET2. Online help is
> good for a minimal implementation but it goes hard when trying to go
> further.
>
> Anyways, thanks for the EMFT and all Eclipse Teams for their great job.
> Vincent.
>
Re: JET2 - declaring custom tags [message #4897 is a reply to message #4830] Fri, 16 March 2007 08:27 Go to previous messageGo to next message
Eclipse User
Originally posted by: vincent.lg.voila.fr

Hi Vladimir,

your're right, it was just a matter of extension point and depedency, but
i'm new to eclipse and all that stuff was not so clear to me. Hoppefully
my plugins works fine now.

Best regards,
Vincent.
Re: JET2 - declaring custom tags [message #6601 is a reply to message #4897] Mon, 26 March 2007 11:13 Go to previous messageGo to next message
Eclipse User
Originally posted by: vinsarwate.rediffmail.com

Hi,

I am fairly new to JET. I tried my hands with custom JET tags using steps
described in this thread. Everything runs smooth when custom tags are
defined in same project where my JET Templates are but what I want is -
custom tags should be in separate project and templates in another
project. Following are the steps I performed -

1. Create plugin project (org.test.customtag) and written custom tag
there. Dependencies include org.eclipse.jet.Also created
org.eclipse.jet.tagLibraries extension (library id - "customlibrary", tag
id - "HelloWorld" (function tag), prefix - "cl").

2. I created another project (EMFT JET Transformation Project) having JET
transformations which has org.test.customtag in its dependencies list
along with org.eclipse.jet. I also added my custom library under
(transform)/(taglibraries) using new importLibrary option, specifying id
as "org.test.customtag.customlibrary" and prefix as "cl" along with
autoImport="true".

Then I am using my tag (<cl:HelloWorld>James</cl:HelloWorld>) in one of
the template. But when I run my template, I am getting following error -
"Could not load JET template loader". Can any one please point out the
cause of this error.

Please note that as soon as I remove "org.test.customtag" project from
dependencies list, this error goes away (though in this case I cann't get
output of my custom tag but this gives me a feeling that I am doing
something wrong while including this custom tag project in my JET template
project).

Thanks in advance.
Vinay
Re: JET2 - declaring custom tags [message #6656 is a reply to message #6601] Mon, 26 March 2007 12:40 Go to previous message
Paul Elder is currently offline Paul Elder
Messages: 849
Registered: July 2009
Senior Member
Vinay:

When you run a JET Transformation from a workspace project, the JET engine
attempts dynamically loads the plug-in into the workbench. But, JET will not
attempt to dynamically load dependencies (such as your tag library). Here's
the sequence of events:

1) you run you JET transform.
2) JET engine realizes its the workspace, and attempts to load it via OSGi.
3) OSGi realizes the transform plug-in has an unresolved dependency on
org.test.customtags and fails the load of transform plug-in.
4) The message you are getting is a side effect of this failure - the engine
is reporting that it could not load a class out of the plug-in that failed
to load. I've submitted a bugzilla to make the error message better
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=179286)

But, the fact remains that the transformation plug-in won't load. You have
two choices:

1) launch a run-time workbench that includes both you JET transformation and
your custom tags plug-in, and run your transformation there.
2) install you custom tags plug-in into your development workbench.

I would consider an enhancement to the JET engine to attempt to load
dependencies dynamically, but my sense is this could get very complex, very
quickly. It certainly won't happen for this release.

Paul

"Vinay" <vinsarwate@rediffmail.com> wrote in message
news:64e4bfb90aa3adde5c07b0891f865090$1@www.eclipse.org...
> Hi,
>
> I am fairly new to JET. I tried my hands with custom JET tags using steps
> described in this thread. Everything runs smooth when custom tags are
> defined in same project where my JET Templates are but what I want is -
> custom tags should be in separate project and templates in another
> project. Following are the steps I performed -
>
> 1. Create plugin project (org.test.customtag) and written custom tag
> there. Dependencies include org.eclipse.jet.Also created
> org.eclipse.jet.tagLibraries extension (library id - "customlibrary", tag
> id - "HelloWorld" (function tag), prefix - "cl").
>
> 2. I created another project (EMFT JET Transformation Project) having JET
> transformations which has org.test.customtag in its dependencies list
> along with org.eclipse.jet. I also added my custom library under
> (transform)/(taglibraries) using new importLibrary option, specifying id
> as "org.test.customtag.customlibrary" and prefix as "cl" along with
> autoImport="true".
>
> Then I am using my tag (<cl:HelloWorld>James</cl:HelloWorld>) in one of
> the template. But when I run my template, I am getting following error -
> "Could not load JET template loader". Can any one please point out the
> cause of this error.
>
> Please note that as soon as I remove "org.test.customtag" project from
> dependencies list, this error goes away (though in this case I cann't get
> output of my custom tag but this gives me a feeling that I am doing
> something wrong while including this custom tag project in my JET template
> project).
>
> Thanks in advance.
> Vinay
>
>
Previous Topic:Checking if a tag exists
Next Topic:src directory where code is generated does not appear
Goto Forum:
  


Current Time: Wed Sep 17 17:45:38 GMT 2014

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

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