Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » JET1 Editor for EMF Codegen template extensions
JET1 Editor for EMF Codegen template extensions [message #426809] Wed, 21 January 2009 11:31 Go to next message
J F is currently offline J FFriend
Messages: 256
Registered: July 2009
Senior Member
Following
http://www.ibm.com/developerworks/library/os-eclipse-emfmeta model/index.html
I am extending the way some of my code is generated.

Is there any editor to make editing JET**1** easier?

Is there any way to extend EMF Codegen templates using JET2 .. other than
a separate generation followed by JMerge? ( as in
http://dev.eclipse.org/newslists/news.eclipse.modeling.m2t/m sg00640.html,
I know I can use JET2 templates on .ecore files as outlined in the JET2
help )

Are there any plans to migrate Codegen to use JET2?

Thanks
Re: JET1 Editor for EMF Codegen template extensions [message #426811 is a reply to message #426809] Wed, 21 January 2009 11:55 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------070204000107040203020204
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

JF,

Comments below.


JF wrote:
> Following
> http://www.ibm.com/developerworks/library/os-eclipse-emfmeta model/index.html
> I am extending the way some of my code is generated.
>
> Is there any editor to make editing JET**1** easier?
The editor that's in the JET2 project works.
>
> Is there any way to extend EMF Codegen templates using JET2 ..
I don't think so.
> other than a separate generation followed by JMerge? ( as in
> http://dev.eclipse.org/newslists/news.eclipse.modeling.m2t/m sg00640.html,
> I know I can use JET2 templates on .ecore files as outlined in the
> JET2 help )
Yes, only separately...
>
> Are there any plans to migrate Codegen to use JET2?
There this bugzilla:
<https://bugs.eclipse.org/bugs/show_bug.cgi?id=152374>

https://bugs.eclipse.org/bugs/show_bug.cgi?id=152374

But realistically, the drive to do this is poor given it's in the end a
big no-op and that it introduces problematic build dependencies...
<https://bugs.eclipse.org/bugs/show_bug.cgi?id=152374>
>
> Thanks
>

--------------070204000107040203020204
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
JF,<br>
<br>
Comments below.<br>
<br>
<br>
JF wrote:
<blockquote
cite="mid:aaec40727a2fc15863d96500f1e86941$1@www.eclipse.org"
type="cite">Following
<a class="moz-txt-link-freetext" href=" http://www.ibm.com/developerworks/library/os-eclipse-emfmeta model/index.html"> http://www.ibm.com/developerworks/library/os-eclipse-emfmeta model/index.html</a>
I am extending the way some of my code is generated.
<br>
<br>
Is there any editor to make editing JET**1** easier?
<br>
</blockquote>
The editor that's in the JET2 project works.<br>
<blockquote
cite="mid:aaec40727a2fc15863d96500f1e86941$1@www.eclipse.org"
type="cite"><br>
Is there any way to extend EMF Codegen templates using JET2 ..</blockquote>
I don't think so.<br>
<blockquote
cite="mid:aaec40727a2fc15863d96500f1e86941$1@www.eclipse.org"
type="cite"> other than a separate generation followed by JMerge? ( as
in
<a class="moz-txt-link-freetext" href=" http://dev.eclipse.org/newslists/news.eclipse.modeling.m2t/m sg00640.html"> http://dev.eclipse.org/newslists/news.eclipse.modeling.m2t/m sg00640.html</a>,
I know I can use JET2 templates on .ecore files as outlined in the JET2
help )
<br>
</blockquote>
Yes, only separately...<br>
<blockquote
cite="mid:aaec40727a2fc15863d96500f1e86941$1@www.eclipse.org"
type="cite"><br>
Are there any plans to migrate Codegen to use JET2?
<br>
</blockquote>
There this bugzilla:<a
href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=152374"><br>
</a>
<blockquote><a
href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=152374">https://bugs.eclipse.org/bugs/show_bug.cgi?id=152374</a><br>
</blockquote>
But realistically, the drive to do this is poor given it's in the end a
big no-op and that it introduces problematic build dependencies...<br>
<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=152374"></a>
<blockquote
cite="mid:aaec40727a2fc15863d96500f1e86941$1@www.eclipse.org"
type="cite"><br>
Thanks
<br>
<br>
</blockquote>
</body>
</html>

--------------070204000107040203020204--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: JET1 Editor for EMF Codegen template extensions [message #426820 is a reply to message #426811] Wed, 21 January 2009 14:58 Go to previous messageGo to next message
J F is currently offline J FFriend
Messages: 256
Registered: July 2009
Senior Member
Thanks once again Ed,

I have set the JET2 editor up to work with my JET1 templates.

However I obviously have problems with <%@ include
file="foo2.javajetinc"%> since the JET Editor tells me it cannot find
them. JET2 would give me that modularity I know, but I just wondered if
there are any solutions to some other minor wrinkles that I have using
JET2 Editor on JET1 source.

This is not much of a worry since the java is generated as expected.

Editing an include file is obviously problematic - it's just a text
insertion, and the including context changes what is syntactically correct
or what is not (i.e. you could only really edit it in JET 1 "in place").
However if I define a variable in the include ( see below ) and reference
it in the including javajet file, it still shows it as an error,
eventhough in the generated java it is not.

Am I doing anything wrong or is that the limit of JET1 support?

Project/templates/foo.javajet:

<%@ jet package="deleteMe" class="foo"%>
<%@ include file="foo2.javajetinc"%>
<% foo = "new";
reallyNotThere = "stuff";%>

Project/templates/foo2.javajetinc:

<% String foo="stuff"; %>
Re: JET1 Editor for EMF Codegen template extensions [message #426838 is a reply to message #426820] Thu, 22 January 2009 11:33 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
JF,

Comments below.


JF wrote:
> Thanks once again Ed,
>
> I have set the JET2 editor up to work with my JET1 templates.
>
> However I obviously have problems with <%@ include
> file="foo2.javajetinc"%> since the JET Editor tells me it cannot find
> them. JET2 would give me that modularity I know, but I just wondered
> if there are any solutions to some other minor wrinkles that I have
> using JET2 Editor on JET1 source.
Did you configure it's preferences to expect JET1 syntax?
>
> This is not much of a worry since the java is generated as expected.
>
> Editing an include file is obviously problematic - it's just a text
> insertion, and the including context changes what is syntactically
> correct or what is not (i.e. you could only really edit it in JET 1
> "in place").
Yes, it kind of sucks.
> However if I define a variable in the include ( see below ) and
> reference it in the including javajet file, it still shows it as an
> error, eventhough in the generated java it is not.
>
> Am I doing anything wrong or is that the limit of JET1 support?
The errors are generated by compiling the template and mapping the
errors back. I assume you've done that? Perhaps is worth reporting in
a bugzilla if something that should be working isn't...
>
> Project/templates/foo.javajet:
>
> <%@ jet package="deleteMe" class="foo"%>
> <%@ include file="foo2.javajetinc"%>
> <% foo = "new"; reallyNotThere = "stuff";%>
>
> Project/templates/foo2.javajetinc:
>
> <% String foo="stuff"; %>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: JET1 Editor for EMF Codegen template extensions [message #426883 is a reply to message #426838] Fri, 23 January 2009 10:25 Go to previous messageGo to next message
J F is currently offline J FFriend
Messages: 256
Registered: July 2009
Senior Member
I've added a bugzilla ( seems a bit harsh but... )
https://bugs.eclipse.org/bugs/show_bug.cgi?id=262139

One last (hopefully) question my ***old*** JET1 project has a .project
file with the following JET nature;


<nature>org.eclipse.emf.codegen.jet.IJETNature</nature>

and a Builder as follows:


<buildCommand>
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name >
<triggers>full,incremental,</triggers>
<arguments>
<dictionary>
<key>LaunchConfigHandle</key>
<value> &lt;project&gt;/.externalToolBuilders/org.eclipse.em f.codegen.JETBuilder.launch </value>
</dictionary>
</arguments>
</buildCommand>

Any reason why I shouldn't convert those to use the new JET builder and
JET nature?

<nature>org.eclipse.jet.jet2Nature</nature>

and the new JET builder ( setting the compliance level to JET1 ? )

<buildCommand>
<name>org.eclipse.jet.builder</name>
<arguments>
</arguments>
</buildCommand>

Thanks
Re: JET1 Editor for EMF Codegen template extensions [message #426884 is a reply to message #426883] Fri, 23 January 2009 10:27 Go to previous messageGo to next message
J F is currently offline J FFriend
Messages: 256
Registered: July 2009
Senior Member
Sorry the JET1 builder should have been;


<buildCommand>
<name>org.eclipse.emf.codegen.JETBuilder</name>
<arguments>
</arguments>
</buildCommand>
Re: JET1 Editor for EMF Codegen template extensions [message #426885 is a reply to message #426884] Fri, 23 January 2009 10:50 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
JF,

You could try it. Probably that will be fine...


JF wrote:
> Sorry the JET1 builder should have been;
>
>
> <buildCommand>
> <name>org.eclipse.emf.codegen.JETBuilder</name>
> <arguments>
> </arguments>
> </buildCommand>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: JET1 Editor for EMF Codegen template extensions [message #426887 is a reply to message #426885] Fri, 23 January 2009 13:23 Go to previous messageGo to next message
J F is currently offline J FFriend
Messages: 256
Registered: July 2009
Senior Member
I did some more work on this and put my notes on the bug report
https://bugs.eclipse.org/bugs/show_bug.cgi?id=262139

Basically I can't get the M2T JETEditor to work with includes at all well.

Do you have any tips? How do you edit the codegen templates?


Otherwise I guess its time to port to JET2...
Re: JET1 Editor for EMF Codegen template extensions [message #426888 is a reply to message #426887] Fri, 23 January 2009 13:55 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
JF,

I find that if I change the JET compiler preferences, because they're
global, it messes up the JET project itself. So I just tolerate the few
JET1 errors at the top. Our templates use include, but that doesn't
seem to cause any problems, so I'm not sure what to suggest...


JF wrote:
> I did some more work on this and put my notes on the bug report
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=262139
>
> Basically I can't get the M2T JETEditor to work with includes at all
> well.
>
> Do you have any tips? How do you edit the codegen templates?
>
>
> Otherwise I guess its time to port to JET2...
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: JET1 Editor for EMF Codegen template extensions [message #426890 is a reply to message #426888] Fri, 23 January 2009 14:38 Go to previous messageGo to next message
J F is currently offline J FFriend
Messages: 256
Registered: July 2009
Senior Member
Thanks Ed,

So you leave the Window->Peferences->JET Complier stuff as it was and
change the settings to JET1 on a per project basis?

What is the project in CVS that you use to edit the templates .. maybe if
I downloaded that it would help.

Thanks...
Re: JET1 Editor for EMF Codegen template extensions [message #426891 is a reply to message #426890] Fri, 23 January 2009 15:27 Go to previous messageGo to next message
J F is currently offline J FFriend
Messages: 256
Registered: July 2009
Senior Member
It seems that some of my problems are caused by the fact that my include
files had a directive on the first line. If I just add an empty line at
the top my problems opening editors go away so far...
Re: JET1 Editor for EMF Codegen template extensions [message #426892 is a reply to message #426890] Fri, 23 January 2009 15:28 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
JF,

It's been a long time since I fiddled with settings for this. I didn't
know there were any project level ones but now that you ask I realize I
have to add the JET1 nature for those; silly me. But since my project
doesn't actually depend on new JET, I don't really want to add that
nature. If I change the global settings, the org.eclipse.jet project
ends up with build errors; I've not had the time to track down why...


JF wrote:
> Thanks Ed,
>
> So you leave the Window->Peferences->JET Complier stuff as it was and
> change the settings to JET1 on a per project basis?
> What is the project in CVS that you use to edit the templates .. maybe
> if I downloaded that it would help.
>
> Thanks...
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: JET1 Editor for EMF Codegen template extensions [message #426893 is a reply to message #426892] Fri, 23 January 2009 15:54 Go to previous messageGo to next message
J F is currently offline J FFriend
Messages: 256
Registered: July 2009
Senior Member
In case anyone else has problems with this later;
I have my JET1 stuff working with the current JET Editor plugin, bar the
moaning about not finding includes, which however it still finds and
generates with

The project is set to JET1 style.

My .project now looks like

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>XXXX</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.emf.codegen.JETBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.emf.codegen.jet.IJETNature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>


I also have a .jpetproperties in the project root with

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jet-settings>
<template-container>templates</template-container> <source-container>src</source-container>
</jet-settings>
Re: JET1 Editor for EMF Codegen template extensions [message #426978 is a reply to message #426893] Tue, 27 January 2009 15:31 Go to previous message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
JF & Ed:

I've taken a look at these problems and have made some fixes. They will be
available in this weeks M and I builds. For the record, here are the defects
I've fixed:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=262139
https://bugs.eclipse.org/bugs/show_bug.cgi?id=262422

Paul

" JF" <jfrancis@his.co.uk> wrote in message
news:ee9aaa34f17191a43cbd18beb7a81824$1@www.eclipse.org...
> In case anyone else has problems with this later;
> I have my JET1 stuff working with the current JET Editor plugin, bar the
> moaning about not finding includes, which however it still finds and
> generates with
>
> The project is set to JET1 style.
>
> My .project now looks like
>
> <?xml version="1.0" encoding="UTF-8"?>
> <projectDescription>
> <name>XXXX</name>
> <comment></comment>
> <projects>
> </projects>
> <buildSpec>
> <buildCommand>
> <name>org.eclipse.emf.codegen.JETBuilder</name>
> <arguments>
> </arguments>
> </buildCommand>
> <buildCommand>
> <name>org.eclipse.jdt.core.javabuilder</name>
> <arguments>
> </arguments>
> </buildCommand>
> <buildCommand>
> <name>org.eclipse.pde.ManifestBuilder</name>
> <arguments>
> </arguments>
> </buildCommand>
> <buildCommand>
> <name>org.eclipse.pde.SchemaBuilder</name>
> <arguments>
> </arguments>
> </buildCommand>
> </buildSpec>
> <natures>
> <nature>org.eclipse.emf.codegen.jet.IJETNature</nature>
> <nature>org.eclipse.pde.PluginNature</nature>
> <nature>org.eclipse.jdt.core.javanature</nature>
> </natures>
> </projectDescription>
>
>
> I also have a .jpetproperties in the project root with
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <jet-settings>
> <template-container>templates</template-container>
> <source-container>src</source-container>
> </jet-settings>
>
>
Previous Topic:[CDO/Net4J]java.lang.InterruptedException
Next Topic:[Announce] Win a Copy of the EMF Book
Goto Forum:
  


Current Time: Sat Apr 20 02:27:55 GMT 2024

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

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

Back to the top