Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Using "external" library in JET template
Using "external" library in JET template [message #82144] Sat, 05 May 2007 21:08 Go to next message
Eclipse UserFriend
Originally posted by: dangerous_id2006.yahoo.com

Hi everyone,

I'm just starting to learn using JET, and my case is as follows:
I create a new plug in project and write some classes that make use of JET
package (JETEmitter class) to produce some classes (just like explained in
JET Tutorial 2 and its example) , based on ecore-model. Because the argument
needs the ecore package, I have to import the emf.ecore into my template.
The question is: What should I do to make the generated Java template class
can import the emf.ecore package "correctly"?
I did write import="org.eclipse.emf.ecore.*" within the <%@ jet ....%>
tag, and could see this import statement too in the generated class in
..JETEmitters folder, but I got an error report "the import org.eclipse
cannot be resolved".
What should I do to make this right? Do I have to add something within the
plugin.xml?

Many thanks for any idea and suggestions.
Regards
Kevin
Re: Using "external" library in JET template [message #82159 is a reply to message #82144] Sun, 06 May 2007 12:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------040709070509030204060905
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Kevin,

Use do this in our generator adapter to set up the classpath
dependencies needed in that .JETEmitters project:

protected void addClasspathEntries(JETEmitter jetEmitter) throws
JETException
{
jetEmitter.addVariable("EMF_CODEGEN", "org.eclipse.emf.codegen");
jetEmitter.addVariable("EMF_CODEGEN_ECORE",
"org.eclipse.emf.codegen.ecore");
jetEmitter.addVariable("EMF_COMMON", "org.eclipse.emf.common");
jetEmitter.addVariable("EMF_ECORE", "org.eclipse.emf.ecore");
}

Be sure to use a JETEmitter constructor that passes in a classpath for a
plugin that depends on these plugins and hence is able to load the classes.


Kevin Lo wrote:
> Hi everyone,
>
> I'm just starting to learn using JET, and my case is as follows:
> I create a new plug in project and write some classes that make use of JET
> package (JETEmitter class) to produce some classes (just like explained in
> JET Tutorial 2 and its example) , based on ecore-model. Because the argument
> needs the ecore package, I have to import the emf.ecore into my template.
> The question is: What should I do to make the generated Java template class
> can import the emf.ecore package "correctly"?
> I did write import="org.eclipse.emf.ecore.*" within the <%@ jet ....%>
> tag, and could see this import statement too in the generated class in
> .JETEmitters folder, but I got an error report "the import org.eclipse
> cannot be resolved".
> What should I do to make this right? Do I have to add something within the
> plugin.xml?
>
> Many thanks for any idea and suggestions.
> Regards
> Kevin
>
>
>


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

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Kevin,<br>
<br>
Use do this in our generator adapter to set up the classpath
dependencies needed in that .JETEmitters project:<br>
<blockquote>&nbsp; protected void addClasspathEntries(JETEmitter jetEmitter)
throws JETException<br>
&nbsp; {<br>
&nbsp;&nbsp;&nbsp; jetEmitter.addVariable("EMF_CODEGEN", "org.eclipse.emf.codegen");<br>
&nbsp;&nbsp;&nbsp; jetEmitter.addVariable("EMF_CODEGEN_ECORE",
"org.eclipse.emf.codegen.ecore");<br>
&nbsp;&nbsp;&nbsp; jetEmitter.addVariable("EMF_COMMON", "org.eclipse.emf.common");<br>
&nbsp;&nbsp;&nbsp; jetEmitter.addVariable("EMF_ECORE", "org.eclipse.emf.ecore");<br>
&nbsp; }<br>
</blockquote>
Be sure to use a JETEmitter constructor that passes in a classpath for
a plugin that depends on these plugins and hence is able to load the
classes.<br>
<br>
<br>
Kevin Lo wrote:
<blockquote cite="midf1irp2$bdb$1@build.eclipse.org" type="cite">
<pre wrap="">Hi everyone,

I'm just starting to learn using JET, and my case is as follows:
I create a new plug in project and write some classes that make use of JET
package (JETEmitter class) to produce some classes (just like explained in
JET Tutorial 2 and its example) , based on ecore-model. Because the argument
needs the ecore package, I have to import the emf.ecore into my template.
The question is: What should I do to make the generated Java template class
can import the emf.ecore package "correctly"?
I did write import="org.eclipse.emf.ecore.*" within the &lt;%@ jet ....%&gt;
tag, and could see this import statement too in the generated class in
..JETEmitters folder, but I got an error report "the import org.eclipse
cannot be resolved".
What should I do to make this right? Do I have to add something within the
plugin.xml?

Many thanks for any idea and suggestions.
Regards
Kevin


</pre>
</blockquote>
<br>
</body>
</html>

--------------040709070509030204060905--
Re: Using "external" library in JET template [message #82218 is a reply to message #82159] Sun, 06 May 2007 19:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dangerous_id2006.yahoo.com

This is a multi-part message in MIME format.

------=_NextPart_000_0027_01C79027.C63C3FB0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi Ed,

Thanks a lot.
I use the source code from the example explained in 2nd JET tutorial =
(with TypeSafeEnum) where it used Config and JETGateway classes. It =
looks like this:
.....
Config config =3D getConfig();

JETEmitter emitter =3D new JETEmitter(config.getTemplateFullUri(), =
getClass().getClassLoader());

try {

emitter.addVariable(config.getClasspathVariable(), =
config.getPluginId());

emitter.addVariable("EMF_ECORE", "org.eclipse.emf.ecore");

} catch (JETException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

So, this should work for any external plug-ins I want to use with my own =
plug-in, right?

Thanks again!



Regards

Kevin

"Ed Merks" <merks@ca.ibm.com> schrieb im Newsbeitrag =
news:f1khqs$560$1@build.eclipse.org...
Kevin,

Use do this in our generator adapter to set up the classpath =
dependencies needed in that .JETEmitters project:

protected void addClasspathEntries(JETEmitter jetEmitter) throws =
JETException
{
jetEmitter.addVariable("EMF_CODEGEN", =
"org.eclipse.emf.codegen");
jetEmitter.addVariable("EMF_CODEGEN_ECORE", =
"org.eclipse.emf.codegen.ecore");
jetEmitter.addVariable("EMF_COMMON", "org.eclipse.emf.common");
jetEmitter.addVariable("EMF_ECORE", "org.eclipse.emf.ecore");
}

Be sure to use a JETEmitter constructor that passes in a classpath for =
a plugin that depends on these plugins and hence is able to load the =
classes.


Kevin Lo wrote:=20
Hi everyone,

I'm just starting to learn using JET, and my case is as follows:
I create a new plug in project and write some classes that make use of =
JET
package (JETEmitter class) to produce some classes (just like explained =
in
JET Tutorial 2 and its example) , based on ecore-model. Because the =
argument
needs the ecore package, I have to import the emf.ecore into my =
template.
The question is: What should I do to make the generated Java template =
class
can import the emf.ecore package "correctly"?
I did write import=3D"org.eclipse.emf.ecore.*" within the <%@ jet =
.....%>
tag, and could see this import statement too in the generated class in
..JETEmitters folder, but I got an error report "the import org.eclipse
cannot be resolved".
What should I do to make this right? Do I have to add something within =
the
plugin.xml?

Many thanks for any idea and suggestions.
Regards
Kevin


=20

------=_NextPart_000_0027_01C79027.C63C3FB0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type =
content=3Dtext/html;charset=3DISO-8859-1>
<META content=3D"MSHTML 6.00.2800.1561" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY text=3D#000000 bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi Ed,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks a lot.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I use the source code from the example =
explained in=20
2nd JET tutorial (with TypeSafeEnum) where it used Config and JETGateway =

classes. It looks like this:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>....</FONT></DIV>
<DIV><FONT size=3D2>
<P align=3Dleft>Config config =3D getConfig();</P>
<P align=3Dleft>JETEmitter emitter =3D </FONT><B><FONT color=3D#7f0055=20
size=3D2>new</B></FONT><FONT size=3D2> =
JETEmitter(config.getTemplateFullUri(),=20
getClass().getClassLoader());</P>
<P align=3Dleft></FONT><B><FONT color=3D#7f0055 =
size=3D2>try</B></FONT><FONT size=3D2>=20
{</P>
<P align=3Dleft>emitter.addVariable(config.getClasspathVariable(),=20
config.getPluginId());</P>
<P align=3Dleft>emitter.addVariable(</FONT><FONT color=3D#2a00ff=20
size=3D2>"EMF_ECORE"</FONT><FONT size=3D2>, </FONT><FONT color=3D#2a00ff =

size=3D2>"org.eclipse.emf.ecore"</FONT><FONT size=3D2>);</P>
<P align=3Dleft>} </FONT><B><FONT color=3D#7f0055 =
size=3D2>catch</B></FONT><FONT=20
size=3D2> (JETException e) {</P>
<P align=3Dleft></FONT><FONT color=3D#3f7f5f size=3D2>// </FONT><B><FONT =
color=3D#7f9fbf=20
size=3D2>TODO</B></FONT><FONT color=3D#3f7f5f size=3D2> Auto-generated =
catch=20
block</P></FONT><FONT size=3D2>
<P align=3Dleft>e.printStackTrace();</P>
<P>}</P>
<P><FONT face=3DArial>So, this should work for any external plug-ins I =
want to use=20
with my own plug-in, right?</FONT></P>
<P><FONT face=3DArial>Thanks again!</FONT></P>
<P><FONT face=3DArial></FONT>&nbsp;</P>
<P><FONT face=3DArial>Regards</FONT></P>
<P><FONT face=3DArial>Kevin</FONT></P></FONT></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Ed Merks" &lt;<A =
href=3D"mailto:merks@ca.ibm.com">merks@ca.ibm.com</A>&gt;=20
schrieb im Newsbeitrag <A=20
=
href=3D"news:f1khqs$560$1@build.eclipse.org">news:f1khqs$560$1@build.ecli=
pse.org</A>...</DIV>Kevin,<BR><BR>Use=20
do this in our generator adapter to set up the classpath dependencies =
needed=20
in that .JETEmitters project:<BR>
<BLOCKQUOTE>&nbsp; protected void addClasspathEntries(JETEmitter =
jetEmitter)=20
throws JETException<BR>&nbsp; {<BR>&nbsp;&nbsp;&nbsp;=20
jetEmitter.addVariable("EMF_CODEGEN",=20
"org.eclipse.emf.codegen");<BR>&nbsp;&nbsp;&nbsp;=20
jetEmitter.addVariable("EMF_CODEGEN_ECORE",=20
"org.eclipse.emf.codegen.ecore");<BR>&nbsp;&nbsp;&nbsp;=20
jetEmitter.addVariable("EMF_COMMON",=20
"org.eclipse.emf.common");<BR>&nbsp;&nbsp;&nbsp;=20
jetEmitter.addVariable("EMF_ECORE", =
"org.eclipse.emf.ecore");<BR>&nbsp;=20
}<BR></BLOCKQUOTE>Be sure to use a JETEmitter constructor that passes =
in a=20
classpath for a plugin that depends on these plugins and hence is able =
to load=20
the classes.<BR><BR><BR>Kevin Lo wrote:=20
<BLOCKQUOTE cite=3Dmidf1irp2$bdb$1@build.eclipse.org =
type=3D"cite"><PRE wrap=3D"">Hi everyone,

I'm just starting to learn using JET, and my case is as follows:
I create a new plug in project and write some classes that make use of =
JET
package (JETEmitter class) to produce some classes (just like explained =
in
JET Tutorial 2 and its example) , based on ecore-model. Because the =
argument
needs the ecore package, I have to import the emf.ecore into my =
template.
The question is: What should I do to make the generated Java template =
class
can import the emf.ecore package "correctly"?
I did write import=3D"org.eclipse.emf.ecore.*" within the &lt;%@ =
jet ....%&gt;
tag, and could see this import statement too in the generated class in
..JETEmitters folder, but I got an error report "the import org.eclipse
cannot be resolved".
What should I do to make this right? Do I have to add something within =
the
plugin.xml?

Many thanks for any idea and suggestions.
Regards
Kevin


</PRE></BLOCKQUOTE><BR></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_0027_01C79027.C63C3FB0--
Re: Using "external" library in JET template [message #82237 is a reply to message #82218] Sun, 06 May 2007 21:25 Go to previous message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------080204020807020202080309
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Kevin,

It looks right.


Kevin Lo wrote:
> Hi Ed,
>
> Thanks a lot.
> I use the source code from the example explained in 2nd JET tutorial
> (with TypeSafeEnum) where it used Config and JETGateway classes. It
> looks like this:
> ....
>
> Config config = getConfig();
>
> JETEmitter emitter = *new* JETEmitter(config.getTemplateFullUri(),
> getClass().getClassLoader());
>
> *try* {
>
> emitter.addVariable(config.getClasspathVariable(), config.getPluginId());
>
> emitter.addVariable("EMF_ECORE", "org.eclipse.emf.ecore");
>
> } *catch* (JETException e) {
>
> // *TODO* Auto-generated catch block
>
> e.printStackTrace();
>
> }
>
> So, this should work for any external plug-ins I want to use with my
> own plug-in, right?
>
> Thanks again!
>
>
>
> Regards
>
> Kevin
>
> "Ed Merks" <merks@ca.ibm.com <mailto:merks@ca.ibm.com>> schrieb im
> Newsbeitrag news:f1khqs$560$1@build.eclipse.org...
> Kevin,
>
> Use do this in our generator adapter to set up the classpath
> dependencies needed in that .JETEmitters project:
>
> protected void addClasspathEntries(JETEmitter jetEmitter)
> throws JETException
> {
> jetEmitter.addVariable("EMF_CODEGEN",
> "org.eclipse.emf.codegen");
> jetEmitter.addVariable("EMF_CODEGEN_ECORE",
> "org.eclipse.emf.codegen.ecore");
> jetEmitter.addVariable("EMF_COMMON",
> "org.eclipse.emf.common");
> jetEmitter.addVariable("EMF_ECORE", "org.eclipse.emf.ecore");
> }
>
> Be sure to use a JETEmitter constructor that passes in a classpath
> for a plugin that depends on these plugins and hence is able to
> load the classes.
>
>
> Kevin Lo wrote:
>> Hi everyone,
>>
>> I'm just starting to learn using JET, and my case is as follows:
>> I create a new plug in project and write some classes that make use of JET
>> package (JETEmitter class) to produce some classes (just like explained in
>> JET Tutorial 2 and its example) , based on ecore-model. Because the argument
>> needs the ecore package, I have to import the emf.ecore into my template.
>> The question is: What should I do to make the generated Java template class
>> can import the emf.ecore package "correctly"?
>> I did write import="org.eclipse.emf.ecore.*" within the <%@ jet ....%>
>> tag, and could see this import statement too in the generated class in
>> .JETEmitters folder, but I got an error report "the import org.eclipse
>> cannot be resolved".
>> What should I do to make this right? Do I have to add something within the
>> plugin.xml?
>>
>> Many thanks for any idea and suggestions.
>> Regards
>> Kevin
>>
>>
>>
>


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

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Kevin,<br>
<br>
It looks right.<br>
<br>
<br>
Kevin Lo wrote:
<blockquote cite="midf1lb7r$1oe$1@build.eclipse.org" type="cite">
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<meta content="MSHTML 6.00.2800.1561" name="GENERATOR">
<style></style>
<div><font face="Arial" size="2">Hi Ed,</font></div>
<div>&nbsp;</div>
<div><font face="Arial" size="2">Thanks a lot.</font></div>
<div><font face="Arial" size="2">I use the source code from the
example explained in 2nd JET tutorial (with TypeSafeEnum) where it used
Config and JETGateway classes. It looks like this:</font></div>
<div><font face="Arial" size="2">....</font></div>
<div><font size="2">
</font>
<p align="left"><font size="2">Config config = getConfig();</font></p>
<p align="left"><font size="2">JETEmitter emitter = </font><b><font
color="#7f0055" size="2">new</font></b><font size="2">
JETEmitter(config.getTemplateFullUri(), getClass().getClassLoader());</font></p>
<p align="left"><b><font color="#7f0055" size="2">try</font></b><font
size="2"> {</font></p>
<p align="left"><font size="2">emitter.addVariable(config.getClasspathVariable(),
config.getPluginId());</font></p>
<p align="left"><font size="2">emitter.addVariable(</font><font
color="#2a00ff" size="2">"EMF_ECORE"</font><font size="2">, </font><font
color="#2a00ff" size="2">"org.eclipse.emf.ecore"</font><font size="2">);</font></p>
<p align="left"><font size="2">} </font><b><font color="#7f0055"
size="2">catch</font></b><font size="2"> (JETException e) {</font></p>
<p align="left"><font color="#3f7f5f" size="2">// </font><b><font
color="#7f9fbf" size="2">TODO</font></b><font color="#3f7f5f" size="2">
Auto-generated catch block</font></p>
<font size="2">
<p align="left">e.printStackTrace();</p>
<p>}</p>
<p><font face="Arial">So, this should work for any external plug-ins
I want to use with my own plug-in, right?</font></p>
<p><font face="Arial">Thanks again!</font></p>
<p>&nbsp;</p>
<p><font face="Arial">Regards</font></p>
<p><font face="Arial">Kevin</font></p>
</font></div>
<blockquote
style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<div>"Ed Merks" &lt;<a href="mailto:merks@ca.ibm.com">merks@ca.ibm.com</a>&gt;
schrieb im Newsbeitrag <a href="news:f1khqs$560$1@build.eclipse.org">news:f1khqs$560$1@build.eclipse.org</a>...</div>
Kevin,<br>
<br>
Use do this in our generator adapter to set up the classpath
dependencies needed in that .JETEmitters project:<br>
<blockquote>&nbsp; protected void addClasspathEntries(JETEmitter
jetEmitter) throws JETException<br>
&nbsp; {<br>
&nbsp;&nbsp;&nbsp; jetEmitter.addVariable("EMF_CODEGEN", "org.eclipse.emf.codegen");<br>
&nbsp;&nbsp;&nbsp; jetEmitter.addVariable("EMF_CODEGEN_ECORE",
"org.eclipse.emf.codegen.ecore");<br>
&nbsp;&nbsp;&nbsp; jetEmitter.addVariable("EMF_COMMON", "org.eclipse.emf.common");<br>
&nbsp;&nbsp;&nbsp; jetEmitter.addVariable("EMF_ECORE", "org.eclipse.emf.ecore");<br>
&nbsp; }<br>
</blockquote>
Be sure to use a JETEmitter constructor that passes in a classpath for
a plugin that depends on these plugins and hence is able to load the
classes.<br>
<br>
<br>
Kevin Lo wrote:
<blockquote cite="midf1irp2$bdb$1@build.eclipse.org" type="cite">
<pre wrap="">Hi everyone,

I'm just starting to learn using JET, and my case is as follows:
I create a new plug in project and write some classes that make use of JET
package (JETEmitter class) to produce some classes (just like explained in
JET Tutorial 2 and its example) , based on ecore-model. Because the argument
needs the ecore package, I have to import the emf.ecore into my template.
The question is: What should I do to make the generated Java template class
can import the emf.ecore package "correctly"?
I did write import="org.eclipse.emf.ecore.*" within the &lt;%@ jet ....%&gt;
tag, and could see this import statement too in the generated class in
..JETEmitters folder, but I got an error report "the import org.eclipse
cannot be resolved".
What should I do to make this right? Do I have to add something within the
plugin.xml?

Many thanks for any idea and suggestions.
Regards
Kevin


</pre>
</blockquote>
<br>
</blockquote>
</blockquote>
<br>
</body>
</html>

--------------080204020807020202080309--
Re: Using "external" library in JET template [message #605305 is a reply to message #82144] Sun, 06 May 2007 12:31 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 31702
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------040709070509030204060905
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Kevin,

Use do this in our generator adapter to set up the classpath
dependencies needed in that .JETEmitters project:

protected void addClasspathEntries(JETEmitter jetEmitter) throws
JETException
{
jetEmitter.addVariable("EMF_CODEGEN", "org.eclipse.emf.codegen");
jetEmitter.addVariable("EMF_CODEGEN_ECORE",
"org.eclipse.emf.codegen.ecore");
jetEmitter.addVariable("EMF_COMMON", "org.eclipse.emf.common");
jetEmitter.addVariable("EMF_ECORE", "org.eclipse.emf.ecore");
}

Be sure to use a JETEmitter constructor that passes in a classpath for a
plugin that depends on these plugins and hence is able to load the classes.


Kevin Lo wrote:
> Hi everyone,
>
> I'm just starting to learn using JET, and my case is as follows:
> I create a new plug in project and write some classes that make use of JET
> package (JETEmitter class) to produce some classes (just like explained in
> JET Tutorial 2 and its example) , based on ecore-model. Because the argument
> needs the ecore package, I have to import the emf.ecore into my template.
> The question is: What should I do to make the generated Java template class
> can import the emf.ecore package "correctly"?
> I did write import="org.eclipse.emf.ecore.*" within the <%@ jet ....%>
> tag, and could see this import statement too in the generated class in
> .JETEmitters folder, but I got an error report "the import org.eclipse
> cannot be resolved".
> What should I do to make this right? Do I have to add something within the
> plugin.xml?
>
> Many thanks for any idea and suggestions.
> Regards
> Kevin
>
>
>


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

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Kevin,<br>
<br>
Use do this in our generator adapter to set up the classpath
dependencies needed in that .JETEmitters project:<br>
<blockquote>&nbsp; protected void addClasspathEntries(JETEmitter jetEmitter)
throws JETException<br>
&nbsp; {<br>
&nbsp;&nbsp;&nbsp; jetEmitter.addVariable("EMF_CODEGEN", "org.eclipse.emf.codegen");<br>
&nbsp;&nbsp;&nbsp; jetEmitter.addVariable("EMF_CODEGEN_ECORE",
"org.eclipse.emf.codegen.ecore");<br>
&nbsp;&nbsp;&nbsp; jetEmitter.addVariable("EMF_COMMON", "org.eclipse.emf.common");<br>
&nbsp;&nbsp;&nbsp; jetEmitter.addVariable("EMF_ECORE", "org.eclipse.emf.ecore");<br>
&nbsp; }<br>
</blockquote>
Be sure to use a JETEmitter constructor that passes in a classpath for
a plugin that depends on these plugins and hence is able to load the
classes.<br>
<br>
<br>
Kevin Lo wrote:
<blockquote cite="midf1irp2$bdb$1@build.eclipse.org" type="cite">
<pre wrap="">Hi everyone,

I'm just starting to learn using JET, and my case is as follows:
I create a new plug in project and write some classes that make use of JET
package (JETEmitter class) to produce some classes (just like explained in
JET Tutorial 2 and its example) , based on ecore-model. Because the argument
needs the ecore package, I have to import the emf.ecore into my template.
The question is: What should I do to make the generated Java template class
can import the emf.ecore package "correctly"?
I did write import="org.eclipse.emf.ecore.*" within the &lt;%@ jet ....%&gt;
tag, and could see this import statement too in the generated class in
..JETEmitters folder, but I got an error report "the import org.eclipse
cannot be resolved".
What should I do to make this right? Do I have to add something within the
plugin.xml?

Many thanks for any idea and suggestions.
Regards
Kevin


</pre>
</blockquote>
<br>
</body>
</html>

--------------040709070509030204060905--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Using "external" library in JET template [message #605315 is a reply to message #82159] Sun, 06 May 2007 19:44 Go to previous message
Kevin Lo is currently offline Kevin LoFriend
Messages: 5
Registered: July 2009
Junior Member
This is a multi-part message in MIME format.

------=_NextPart_000_0027_01C79027.C63C3FB0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi Ed,

Thanks a lot.
I use the source code from the example explained in 2nd JET tutorial =
(with TypeSafeEnum) where it used Config and JETGateway classes. It =
looks like this:
.....
Config config =3D getConfig();

JETEmitter emitter =3D new JETEmitter(config.getTemplateFullUri(), =
getClass().getClassLoader());

try {

emitter.addVariable(config.getClasspathVariable(), =
config.getPluginId());

emitter.addVariable("EMF_ECORE", "org.eclipse.emf.ecore");

} catch (JETException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

So, this should work for any external plug-ins I want to use with my own =
plug-in, right?

Thanks again!



Regards

Kevin

"Ed Merks" <merks@ca.ibm.com> schrieb im Newsbeitrag =
news:f1khqs$560$1@build.eclipse.org...
Kevin,

Use do this in our generator adapter to set up the classpath =
dependencies needed in that .JETEmitters project:

protected void addClasspathEntries(JETEmitter jetEmitter) throws =
JETException
{
jetEmitter.addVariable("EMF_CODEGEN", =
"org.eclipse.emf.codegen");
jetEmitter.addVariable("EMF_CODEGEN_ECORE", =
"org.eclipse.emf.codegen.ecore");
jetEmitter.addVariable("EMF_COMMON", "org.eclipse.emf.common");
jetEmitter.addVariable("EMF_ECORE", "org.eclipse.emf.ecore");
}

Be sure to use a JETEmitter constructor that passes in a classpath for =
a plugin that depends on these plugins and hence is able to load the =
classes.


Kevin Lo wrote:=20
Hi everyone,

I'm just starting to learn using JET, and my case is as follows:
I create a new plug in project and write some classes that make use of =
JET
package (JETEmitter class) to produce some classes (just like explained =
in
JET Tutorial 2 and its example) , based on ecore-model. Because the =
argument
needs the ecore package, I have to import the emf.ecore into my =
template.
The question is: What should I do to make the generated Java template =
class
can import the emf.ecore package "correctly"?
I did write import=3D"org.eclipse.emf.ecore.*" within the <%@ jet =
.....%>
tag, and could see this import statement too in the generated class in
..JETEmitters folder, but I got an error report "the import org.eclipse
cannot be resolved".
What should I do to make this right? Do I have to add something within =
the
plugin.xml?

Many thanks for any idea and suggestions.
Regards
Kevin


=20

------=_NextPart_000_0027_01C79027.C63C3FB0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type =
content=3Dtext/html;charset=3DISO-8859-1>
<META content=3D"MSHTML 6.00.2800.1561" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY text=3D#000000 bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi Ed,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks a lot.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I use the source code from the example =
explained in=20
2nd JET tutorial (with TypeSafeEnum) where it used Config and JETGateway =

classes. It looks like this:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>....</FONT></DIV>
<DIV><FONT size=3D2>
<P align=3Dleft>Config config =3D getConfig();</P>
<P align=3Dleft>JETEmitter emitter =3D </FONT><B><FONT color=3D#7f0055=20
size=3D2>new</B></FONT><FONT size=3D2> =
JETEmitter(config.getTemplateFullUri(),=20
getClass().getClassLoader());</P>
<P align=3Dleft></FONT><B><FONT color=3D#7f0055 =
size=3D2>try</B></FONT><FONT size=3D2>=20
{</P>
<P align=3Dleft>emitter.addVariable(config.getClasspathVariable(),=20
config.getPluginId());</P>
<P align=3Dleft>emitter.addVariable(</FONT><FONT color=3D#2a00ff=20
size=3D2>"EMF_ECORE"</FONT><FONT size=3D2>, </FONT><FONT color=3D#2a00ff =

size=3D2>"org.eclipse.emf.ecore"</FONT><FONT size=3D2>);</P>
<P align=3Dleft>} </FONT><B><FONT color=3D#7f0055 =
size=3D2>catch</B></FONT><FONT=20
size=3D2> (JETException e) {</P>
<P align=3Dleft></FONT><FONT color=3D#3f7f5f size=3D2>// </FONT><B><FONT =
color=3D#7f9fbf=20
size=3D2>TODO</B></FONT><FONT color=3D#3f7f5f size=3D2> Auto-generated =
catch=20
block</P></FONT><FONT size=3D2>
<P align=3Dleft>e.printStackTrace();</P>
<P>}</P>
<P><FONT face=3DArial>So, this should work for any external plug-ins I =
want to use=20
with my own plug-in, right?</FONT></P>
<P><FONT face=3DArial>Thanks again!</FONT></P>
<P><FONT face=3DArial></FONT>&nbsp;</P>
<P><FONT face=3DArial>Regards</FONT></P>
<P><FONT face=3DArial>Kevin</FONT></P></FONT></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Ed Merks" &lt;<A =
href=3D"mailto:merks@ca.ibm.com">merks@ca.ibm.com</A>&gt;=20
schrieb im Newsbeitrag <A=20
=
href=3D"news:f1khqs$560$1@build.eclipse.org">news:f1khqs$560$1@build.ecli=
pse.org</A>...</DIV>Kevin,<BR><BR>Use=20
do this in our generator adapter to set up the classpath dependencies =
needed=20
in that .JETEmitters project:<BR>
<BLOCKQUOTE>&nbsp; protected void addClasspathEntries(JETEmitter =
jetEmitter)=20
throws JETException<BR>&nbsp; {<BR>&nbsp;&nbsp;&nbsp;=20
jetEmitter.addVariable("EMF_CODEGEN",=20
"org.eclipse.emf.codegen");<BR>&nbsp;&nbsp;&nbsp;=20
jetEmitter.addVariable("EMF_CODEGEN_ECORE",=20
"org.eclipse.emf.codegen.ecore");<BR>&nbsp;&nbsp;&nbsp;=20
jetEmitter.addVariable("EMF_COMMON",=20
"org.eclipse.emf.common");<BR>&nbsp;&nbsp;&nbsp;=20
jetEmitter.addVariable("EMF_ECORE", =
"org.eclipse.emf.ecore");<BR>&nbsp;=20
}<BR></BLOCKQUOTE>Be sure to use a JETEmitter constructor that passes =
in a=20
classpath for a plugin that depends on these plugins and hence is able =
to load=20
the classes.<BR><BR><BR>Kevin Lo wrote:=20
<BLOCKQUOTE cite=3Dmidf1irp2$bdb$1@build.eclipse.org =
type=3D"cite"><PRE wrap=3D"">Hi everyone,

I'm just starting to learn using JET, and my case is as follows:
I create a new plug in project and write some classes that make use of =
JET
package (JETEmitter class) to produce some classes (just like explained =
in
JET Tutorial 2 and its example) , based on ecore-model. Because the =
argument
needs the ecore package, I have to import the emf.ecore into my =
template.
The question is: What should I do to make the generated Java template =
class
can import the emf.ecore package "correctly"?
I did write import=3D"org.eclipse.emf.ecore.*" within the &lt;%@ =
jet ....%&gt;
tag, and could see this import statement too in the generated class in
..JETEmitters folder, but I got an error report "the import org.eclipse
cannot be resolved".
What should I do to make this right? Do I have to add something within =
the
plugin.xml?

Many thanks for any idea and suggestions.
Regards
Kevin


</PRE></BLOCKQUOTE><BR></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_0027_01C79027.C63C3FB0--
Re: Using "external" library in JET template [message #605321 is a reply to message #82218] Sun, 06 May 2007 21:25 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 31702
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------080204020807020202080309
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Kevin,

It looks right.


Kevin Lo wrote:
> Hi Ed,
>
> Thanks a lot.
> I use the source code from the example explained in 2nd JET tutorial
> (with TypeSafeEnum) where it used Config and JETGateway classes. It
> looks like this:
> ....
>
> Config config = getConfig();
>
> JETEmitter emitter = *new* JETEmitter(config.getTemplateFullUri(),
> getClass().getClassLoader());
>
> *try* {
>
> emitter.addVariable(config.getClasspathVariable(), config.getPluginId());
>
> emitter.addVariable("EMF_ECORE", "org.eclipse.emf.ecore");
>
> } *catch* (JETException e) {
>
> // *TODO* Auto-generated catch block
>
> e.printStackTrace();
>
> }
>
> So, this should work for any external plug-ins I want to use with my
> own plug-in, right?
>
> Thanks again!
>
>
>
> Regards
>
> Kevin
>
> "Ed Merks" <merks@ca.ibm.com <mailto:merks@ca.ibm.com>> schrieb im
> Newsbeitrag news:f1khqs$560$1@build.eclipse.org...
> Kevin,
>
> Use do this in our generator adapter to set up the classpath
> dependencies needed in that .JETEmitters project:
>
> protected void addClasspathEntries(JETEmitter jetEmitter)
> throws JETException
> {
> jetEmitter.addVariable("EMF_CODEGEN",
> "org.eclipse.emf.codegen");
> jetEmitter.addVariable("EMF_CODEGEN_ECORE",
> "org.eclipse.emf.codegen.ecore");
> jetEmitter.addVariable("EMF_COMMON",
> "org.eclipse.emf.common");
> jetEmitter.addVariable("EMF_ECORE", "org.eclipse.emf.ecore");
> }
>
> Be sure to use a JETEmitter constructor that passes in a classpath
> for a plugin that depends on these plugins and hence is able to
> load the classes.
>
>
> Kevin Lo wrote:
>> Hi everyone,
>>
>> I'm just starting to learn using JET, and my case is as follows:
>> I create a new plug in project and write some classes that make use of JET
>> package (JETEmitter class) to produce some classes (just like explained in
>> JET Tutorial 2 and its example) , based on ecore-model. Because the argument
>> needs the ecore package, I have to import the emf.ecore into my template.
>> The question is: What should I do to make the generated Java template class
>> can import the emf.ecore package "correctly"?
>> I did write import="org.eclipse.emf.ecore.*" within the <%@ jet ....%>
>> tag, and could see this import statement too in the generated class in
>> .JETEmitters folder, but I got an error report "the import org.eclipse
>> cannot be resolved".
>> What should I do to make this right? Do I have to add something within the
>> plugin.xml?
>>
>> Many thanks for any idea and suggestions.
>> Regards
>> Kevin
>>
>>
>>
>


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

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Kevin,<br>
<br>
It looks right.<br>
<br>
<br>
Kevin Lo wrote:
<blockquote cite="midf1lb7r$1oe$1@build.eclipse.org" type="cite">
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<meta content="MSHTML 6.00.2800.1561" name="GENERATOR">
<style></style>
<div><font face="Arial" size="2">Hi Ed,</font></div>
<div>&nbsp;</div>
<div><font face="Arial" size="2">Thanks a lot.</font></div>
<div><font face="Arial" size="2">I use the source code from the
example explained in 2nd JET tutorial (with TypeSafeEnum) where it used
Config and JETGateway classes. It looks like this:</font></div>
<div><font face="Arial" size="2">....</font></div>
<div><font size="2">
</font>
<p align="left"><font size="2">Config config = getConfig();</font></p>
<p align="left"><font size="2">JETEmitter emitter = </font><b><font
color="#7f0055" size="2">new</font></b><font size="2">
JETEmitter(config.getTemplateFullUri(), getClass().getClassLoader());</font></p>
<p align="left"><b><font color="#7f0055" size="2">try</font></b><font
size="2"> {</font></p>
<p align="left"><font size="2">emitter.addVariable(config.getClasspathVariable(),
config.getPluginId());</font></p>
<p align="left"><font size="2">emitter.addVariable(</font><font
color="#2a00ff" size="2">"EMF_ECORE"</font><font size="2">, </font><font
color="#2a00ff" size="2">"org.eclipse.emf.ecore"</font><font size="2">);</font></p>
<p align="left"><font size="2">} </font><b><font color="#7f0055"
size="2">catch</font></b><font size="2"> (JETException e) {</font></p>
<p align="left"><font color="#3f7f5f" size="2">// </font><b><font
color="#7f9fbf" size="2">TODO</font></b><font color="#3f7f5f" size="2">
Auto-generated catch block</font></p>
<font size="2">
<p align="left">e.printStackTrace();</p>
<p>}</p>
<p><font face="Arial">So, this should work for any external plug-ins
I want to use with my own plug-in, right?</font></p>
<p><font face="Arial">Thanks again!</font></p>
<p>&nbsp;</p>
<p><font face="Arial">Regards</font></p>
<p><font face="Arial">Kevin</font></p>
</font></div>
<blockquote
style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<div>"Ed Merks" &lt;<a href="mailto:merks@ca.ibm.com">merks@ca.ibm.com</a>&gt;
schrieb im Newsbeitrag <a href="news:f1khqs$560$1@build.eclipse.org">news:f1khqs$560$1@build.eclipse.org</a>...</div>
Kevin,<br>
<br>
Use do this in our generator adapter to set up the classpath
dependencies needed in that .JETEmitters project:<br>
<blockquote>&nbsp; protected void addClasspathEntries(JETEmitter
jetEmitter) throws JETException<br>
&nbsp; {<br>
&nbsp;&nbsp;&nbsp; jetEmitter.addVariable("EMF_CODEGEN", "org.eclipse.emf.codegen");<br>
&nbsp;&nbsp;&nbsp; jetEmitter.addVariable("EMF_CODEGEN_ECORE",
"org.eclipse.emf.codegen.ecore");<br>
&nbsp;&nbsp;&nbsp; jetEmitter.addVariable("EMF_COMMON", "org.eclipse.emf.common");<br>
&nbsp;&nbsp;&nbsp; jetEmitter.addVariable("EMF_ECORE", "org.eclipse.emf.ecore");<br>
&nbsp; }<br>
</blockquote>
Be sure to use a JETEmitter constructor that passes in a classpath for
a plugin that depends on these plugins and hence is able to load the
classes.<br>
<br>
<br>
Kevin Lo wrote:
<blockquote cite="midf1irp2$bdb$1@build.eclipse.org" type="cite">
<pre wrap="">Hi everyone,

I'm just starting to learn using JET, and my case is as follows:
I create a new plug in project and write some classes that make use of JET
package (JETEmitter class) to produce some classes (just like explained in
JET Tutorial 2 and its example) , based on ecore-model. Because the argument
needs the ecore package, I have to import the emf.ecore into my template.
The question is: What should I do to make the generated Java template class
can import the emf.ecore package "correctly"?
I did write import="org.eclipse.emf.ecore.*" within the &lt;%@ jet ....%&gt;
tag, and could see this import statement too in the generated class in
..JETEmitters folder, but I got an error report "the import org.eclipse
cannot be resolved".
What should I do to make this right? Do I have to add something within the
plugin.xml?

Many thanks for any idea and suggestions.
Regards
Kevin


</pre>
</blockquote>
<br>
</blockquote>
</blockquote>
<br>
</body>
</html>

--------------080204020807020202080309--


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[Teneo] Help needed with inherance mapping
Next Topic:[Teneo+hibernate]
Goto Forum:
  


Current Time: Tue Jan 19 22:33:15 GMT 2021

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

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

Back to the top