calling genmodel dynamic templates stored into plugins [message #415810] |
Tue, 08 January 2008 05:16  |
Eclipse User |
|
|
|
Hi,
In a genmodel file, I have tried to call dynamic templates files that
are stored into my current workspace: it works.
After that, I have tried to call the same dynamic templates files that
are stored into my plugin installation: it does not work.
Is there a workaround to call dynamic templates that are stored into
plugins ?
Best regards,
Cyril.
--
Cyril Faucher
IRISA-INRIA - Rennes, France
[Breathe life into your metamodels www.kermeta.org]
|
|
|
Re: calling genmodel dynamic templates stored into plugins [message #415819 is a reply to message #415810] |
Tue, 08 January 2008 08:48   |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
--------------000605080200050308020302
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Cyril,
If you use platform:/plugin/<plugin-ID> in the template path it should
end up in this code path in JETEmitter to look for the compiled
templates in the runtime environment
else if (templateURI.isPlatformPlugin())
{
final Bundle bundle =
Platform.getBundle(templateURI.segment(1));
if (bundle != null)
{
// Define a class loader that will look up the class in
the bundle,
// and if it doesn't find it there, will look in the parent.
//
theClassLoader =
new URLClassLoader(new URL [0], jetEmitter.classLoader)
{
@Override
public Class<?> loadClass(String className) throws
ClassNotFoundException
{
try
{
return bundle.loadClass(className);
}
catch (ClassNotFoundException classNotFoundException)
{
return super.loadClass(className);
}
}
};
}
}
Cyril Faucher wrote:
> Hi,
>
> In a genmodel file, I have tried to call dynamic templates files that
> are stored into my current workspace: it works.
> After that, I have tried to call the same dynamic templates files that
> are stored into my plugin installation: it does not work.
>
> Is there a workaround to call dynamic templates that are stored into
> plugins ?
>
> Best regards,
> Cyril.
>
--------------000605080200050308020302
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">
Cyril,<br>
<br>
If you use platform:/plugin/<plugin-ID> in the template path it
should end up in this code path in JETEmitter to look for the compiled
templates in the runtime environment<br>
<br>
<small> else if (templateURI.isPlatformPlugin())<br>
{<br>
final Bundle bundle =
Platform.getBundle(templateURI.segment(1));<br>
if (bundle != null)<br>
{<br>
// Define a class loader that will look up the class in
the bundle,<br>
// and if it doesn't find it there, will look in the
parent.<br>
//<br>
theClassLoader = <br>
new URLClassLoader(new URL [0], jetEmitter.classLoader)<br>
{<br>
@Override<br>
public Class<?> loadClass(String className)
throws ClassNotFoundException<br>
{<br>
try<br>
{<br>
return bundle.loadClass(className);<br>
}<br>
catch (ClassNotFoundException
classNotFoundException)<br>
{<br>
return super.loadClass(className);<br>
}<br>
}<br>
};<br>
}<br>
}</small><br>
<br>
<br>
Cyril Faucher wrote:
<blockquote cite="mid:flviii$c7c$1@build.eclipse.org" type="cite">Hi,
<br>
<br>
In a genmodel file, I have tried to call dynamic templates files that
are stored into my current workspace: it works.
<br>
After that, I have tried to call the same dynamic templates files that
are stored into my plugin installation: it does not work.
<br>
<br>
Is there a workaround to call dynamic templates that are stored into
plugins ?
<br>
<br>
Best regards,
<br>
Cyril.
<br>
<br>
</blockquote>
<br>
</body>
</html>
--------------000605080200050308020302--
|
|
|
Re: calling genmodel dynamic templates stored into plugins [message #415839 is a reply to message #415819] |
Wed, 09 January 2008 07:57  |
Eclipse User |
|
|
|
Hi Ed,
Thanks to your reply, for further reasons I have my own "generator"
class, so I have added the missing plugin id like that:
CodeGenUtil.EclipseUtil.addClasspathEntries(classpathEntries , xyz, xyz)
and now it works in deployed mode.
Regards,
Cyril.
Ed Merks a écrit :
> Cyril,
>
> If you use platform:/plugin/<plugin-ID> in the template path it should
> end up in this code path in JETEmitter to look for the compiled
> templates in the runtime environment
>
> else if (templateURI.isPlatformPlugin())
> {
> final Bundle bundle =
> Platform.getBundle(templateURI.segment(1));
> if (bundle != null)
> {
> // Define a class loader that will look up the class in
> the bundle,
> // and if it doesn't find it there, will look in the parent.
> //
> theClassLoader =
> new URLClassLoader(new URL [0], jetEmitter.classLoader)
> {
> @Override
> public Class<?> loadClass(String className) throws
> ClassNotFoundException
> {
> try
> {
> return bundle.loadClass(className);
> }
> catch (ClassNotFoundException classNotFoundException)
> {
> return super.loadClass(className);
> }
> }
> };
> }
> }
>
>
> Cyril Faucher wrote:
>> Hi,
>>
>> In a genmodel file, I have tried to call dynamic templates files that
>> are stored into my current workspace: it works.
>> After that, I have tried to call the same dynamic templates files that
>> are stored into my plugin installation: it does not work.
>>
>> Is there a workaround to call dynamic templates that are stored into
>> plugins ?
>>
>> Best regards,
>> Cyril.
>>
>
--
Cyril Faucher
IRISA-INRIA - Rennes, France
[Breathe life into your metamodels www.kermeta.org]
|
|
|
Powered by
FUDForum. Page generated in 0.05584 seconds