Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [TEXO] Calling custom java methods from overriden templates
[TEXO] Calling custom java methods from overriden templates [message #1229913] Fri, 10 January 2014 14:25 Go to next message
Dominik Leszyk is currently offline Dominik LeszykFriend
Messages: 22
Registered: December 2013
Junior Member
Currently I'm overriding Texo templates following documention on http://wiki.eclipse.org/Texo/Template_Overriding. One thing that I am currently stuck is calling my custom processing logic written in java from overriden templates. This is done through additional extension file (service-utils.ext) i.e.:

addition.xpt -> service-utils.ext -> org.example.service.utils.AnnotationUtils.isRemote().

I've tried to put custom processing logic (i.e. AnnotationUtils) in:
- the same plugin where addition.xpt and service-utils.ext are located
- separate plugin (with dependencies set correctly in MANIFEST.MF file);

However every time when I call Texo / Generate Model Code on my ecore file I got exception like this:

java.lang.IllegalStateException: org.example.service.utils.AnnotationUtils.isRemote() not found, problems were: 
[AnalysationIssueType not found] - Couldn't find Java type org.example.service.utils.AnnotationUtils : org.example.service.utils.AnnotationUtils


Could anybody confirm that it's possible to invoke custom logic from overriden templates in Texo?
Thanks for help.

Dominik
Re: [TEXO] Calling custom java methods from overriden templates [message #1230268 is a reply to message #1229913] Sat, 11 January 2014 13:50 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Dominik,
I can see why this does not work, but not sure what a good solution would be. The code generation runs in the IDE
itself, so it uses the classpath of the IDE itself.
I think for this to ever work the code you have should be in a plugin installed in the IDE, this plugin should register
its dependency with the modelgenerator plugin or be dependent on (then I would need to change the buddy policy of the
Texo generation plugins to do 'dependent').

Is your code in a plugin in the IDE?

Can you enter a testcase for this? I can add a testcase to cover this.

gr. Martin

On 01/10/2014 03:25 PM, Dominik Leszyk wrote:
> Currently I'm overriding Texo templates following documention on http://wiki.eclipse.org/Texo/Template_Overriding. One
> thing that I am currently stuck is calling my custom processing logic written in java from overriden templates. This is
> done through additional extension file (service-utils.ext) i.e.:
>
> addition.xpt -> service-utils.ext -> org.example.service.utils.AnnotationUtils.isRemote().
>
> I've tried to put custom processing logic (i.e. AnnotationUtils) in:
> - the same plugin where addition.xpt and service-utils.ext are located
> - separate plugin (with dependencies set correctly in MANIFEST.MF file);
>
> However every time when I call Texo / Generate Model Code on my ecore file I got exception like this:
>
> java.lang.IllegalStateException: org.example.service.utils.AnnotationUtils.isRemote() not found, problems were:
> [AnalysationIssueType not found] - Couldn't find Java type org.example.service.utils.AnnotationUtils :
> org.example.service.utils.AnnotationUtils
>
>
> Could anybody confirm that it's possible to invoke custom logic from overriden templates in Texo? Thanks for help.
>
> Dominik
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: [TEXO] Calling custom java methods from overriden templates [message #1230833 is a reply to message #1230268] Mon, 13 January 2014 07:27 Go to previous messageGo to next message
Dominik Leszyk is currently offline Dominik LeszykFriend
Messages: 22
Registered: December 2013
Junior Member
Hi Martin,

Thanks for quick answer and support. I was somehow thinking that my problem is connected with Texo working on IDE classpath and my plugins or java files not being there. However finally I was able to rewrite my processing logic from java to Xpand extensions (.ext). So from my point of view this feature is not needed.

On the other hand I would really like to see support for writing templates in Xtend instead of Xpand. What do you think? As I have seen in the sources, you're already using Xtend internally.

Cheers,
Dominik
Re: [TEXO] Calling custom java methods from overriden templates [message #1230847 is a reply to message #1230833] Mon, 13 January 2014 08:12 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Dominik,
The reason is that xpand templates can be loaded dynamically from the development project in the workspace development
project. This also makes it quick to try it out.

Xtend templates are converted in java code in the same dev project, Texo can not compile/load this code in the IDE
classpath/environment. At least not that I know.

But maybe there are other ways to accomplish this, for example by calling Texo code generation from the development
project itself. But I don't have a good idea on this...

gr. Martin

On 01/13/2014 08:27 AM, Dominik Leszyk wrote:
> Hi Martin,
>
> Thanks for quick answer and support. I was somehow thinking that my problem is connected with Texo working on IDE
> classpath and my plugins or java files not being there. However finally I was able to rewrite my processing logic from
> java to Xpand extensions (.ext). So from my point of view this feature is not needed.
> On the other hand I would really like to see support for writing templates in Xtend instead of Xpand. What do you think?
> As I have seen in the sources, you're already using Xtend internally.
> Cheers,
> Dominik
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: [TEXO] Calling custom java methods from overriden templates [message #1231368 is a reply to message #1230847] Tue, 14 January 2014 13:45 Go to previous messageGo to next message
techteam is currently offline techteamFriend
Messages: 55
Registered: September 2010
Member
Hi Martin,
have you ever looked to the "InPlace Activator"? ( http://javatime.no/ )
It needs a runing IDE under Java 7 but allows you to start and run
workspace bundles in your current enviroment.
Maybe this would be a nice approach for the Xtend templates.

Greetings
Heiko

Am 13.01.2014 09:12, schrieb Martin Taal:
> Hi Dominik,
> The reason is that xpand templates can be loaded dynamically from the
> development project in the workspace development project. This also
> makes it quick to try it out.
>
> Xtend templates are converted in java code in the same dev project, Texo
> can not compile/load this code in the IDE classpath/environment. At
> least not that I know.
>
> But maybe there are other ways to accomplish this, for example by
> calling Texo code generation from the development project itself. But I
> don't have a good idea on this...
>
> gr. Martin
>
> On 01/13/2014 08:27 AM, Dominik Leszyk wrote:
>> Hi Martin,
>>
>> Thanks for quick answer and support. I was somehow thinking that my
>> problem is connected with Texo working on IDE
>> classpath and my plugins or java files not being there. However
>> finally I was able to rewrite my processing logic from
>> java to Xpand extensions (.ext). So from my point of view this feature
>> is not needed.
>> On the other hand I would really like to see support for writing
>> templates in Xtend instead of Xpand. What do you think?
>> As I have seen in the sources, you're already using Xtend internally.
>> Cheers,
>> Dominik
>>
>
>
Re: [TEXO] Calling custom java methods from overriden templates [message #1231561 is a reply to message #1231368] Wed, 15 January 2014 00:12 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Heiko,
Thanks for the link, always interesting to check it out. I need to dive into this to get a feel for how/if this can be
used. But first I want to get xcore support in Texo..

gr. Martin

On 01/14/2014 02:45 PM, Heiko wrote:
> Hi Martin,
> have you ever looked to the "InPlace Activator"? ( http://javatime.no/ )
> It needs a runing IDE under Java 7 but allows you to start and run workspace bundles in your current enviroment.
> Maybe this would be a nice approach for the Xtend templates.
>
> Greetings
> Heiko
>
> Am 13.01.2014 09:12, schrieb Martin Taal:
>> Hi Dominik,
>> The reason is that xpand templates can be loaded dynamically from the
>> development project in the workspace development project. This also
>> makes it quick to try it out.
>>
>> Xtend templates are converted in java code in the same dev project, Texo
>> can not compile/load this code in the IDE classpath/environment. At
>> least not that I know.
>>
>> But maybe there are other ways to accomplish this, for example by
>> calling Texo code generation from the development project itself. But I
>> don't have a good idea on this...
>>
>> gr. Martin
>>
>> On 01/13/2014 08:27 AM, Dominik Leszyk wrote:
>>> Hi Martin,
>>>
>>> Thanks for quick answer and support. I was somehow thinking that my
>>> problem is connected with Texo working on IDE
>>> classpath and my plugins or java files not being there. However
>>> finally I was able to rewrite my processing logic from
>>> java to Xpand extensions (.ext). So from my point of view this feature
>>> is not needed.
>>> On the other hand I would really like to see support for writing
>>> templates in Xtend instead of Xpand. What do you think?
>>> As I have seen in the sources, you're already using Xtend internally.
>>> Cheers,
>>> Dominik
>>>
>>
>>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Previous Topic:[CDO][Xcore] Can't create resource on the base of Xcore defined model
Next Topic:TENEO : DTYPE ISSUE
Goto Forum:
  


Current Time: Mon Mar 01 08:07:49 GMT 2021

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

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

Back to the top