Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Xtend]Executing Xtend templates contributed by other plugins through extension point(Executing Xtend templates contributed by other plugins through extension point)
[Xtend]Executing Xtend templates contributed by other plugins through extension point [message #489848] Tue, 06 October 2009 08:56 Go to next message
Dhiraj  is currently offline Dhiraj Friend
Messages: 18
Registered: July 2009
Junior Member
In my project I will be having Xtend templates contributed through
extension point. So the plugin that executes these templates will
be different from the one containing these templates.
But I have read on the Xtend/Xpand reference that the template
should be on the classpath of the process executing this
template.
So is there a way to run such kind of templates?
Re: [Xtend]Executing Xtend templates contributed by other plugins through extension point [message #490006 is a reply to message #489848] Tue, 06 October 2009 20:33 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1771
Registered: July 2009
Senior Member
Dhiraj schrieb:
> In my project I will be having Xtend templates contributed through
> extension point. So the plugin that executes these templates will
> be different from the one containing these templates. But I have read on
> the Xtend/Xpand reference that the template
> should be on the classpath of the process executing this
> template.
> So is there a way to run such kind of templates?
>

There's a so called ResourceManager, which is used to load extension
files. The default implementation uses the classpath to locate
extensions, but you could provide a different implementation.

Subclassing org.eclipse.xtend.expression.ResourceManagerDefaultImpl and
overwriting its loadResource() method should be a good starting point.

You have to provide your implementation when creating an execution
context using
org.eclipse.xpand2.XpandExecutionContextImpl.setResourceMana ger(ResourceManager)

Cheers,
Sven


--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com


--
Need professional support on Xtext or Xtend?
Mail to: xtext (at) itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
Re: [Xtend]Executing Xtend templates contributed by other plugins through extension point [message #490054 is a reply to message #490006] Wed, 07 October 2009 06:03 Go to previous message
Dhiraj  is currently offline Dhiraj Friend
Messages: 18
Registered: July 2009
Junior Member
Thanks for the solution Sven. But apparently it works out of the
box. We don't have to do anything. We verified it and it was able to
load the Xtend template defined in some other bundle. The reason
being that the bundle org.openarchitectureware.core.workflow has
the manifest header:-
Eclipse-BuddyPolicy: dependent

This enables loading resources/classes from dependent bundles.
Previous Topic:m2t projects
Next Topic:<jet.compile> generates files under wrong directory
Goto Forum:
  


Current Time: Mon Dec 22 08:00:01 GMT 2014

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

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