Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Xtend] XtendComponent vs. XtendFacade
[Xtend] XtendComponent vs. XtendFacade [message #503205] Fri, 11 December 2009 11:52 Go to next message
Michael Matzen is currently offline Michael MatzenFriend
Messages: 13
Registered: July 2009
Junior Member
Hi all,

i am using Xtend to execute in-place model transformations on GMF
diagram elements from Java code.

However, it seems like there is more than one way to execute Xtend from
Java.
1. Using an XtendComponent and the invoke method
2. Using an XtendFacade and the call method

Right now i'm using the XtendComponent and its working really fine, but
i wonder if there is any real difference between the two and a
recommended way of calling xtend?

The only thing i found so far, is that the XtendComponent can be used to
execute extension which are located somewhere in the file system by
using a "usual" path (like
/home/user/eclipse-runtime/.metadata/...../extension), which is not
possible when using the XtendFacades '::' paths. (?)

Maybe the XtendComponent is a bit more complicated, because i have to
use a workflow context to set the model elements as the extension
parameters where the facade allows the use of Object[].


Cheers,
Michael
Re: [Xtend] XtendComponent vs. XtendFacade [message #503338 is a reply to message #503205] Fri, 11 December 2009 23:33 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 6550
Registered: July 2009
Senior Member
Hello,

you may find some hints on this topic in the xtend documentation http:// help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.xpand. doc/help/ch01s05.html



  • The XtendComponent is meant to be used to call Xtend from an MWE Workflow file
  • The XtendFacade is meant to be called from java directly.


i hope is answers your question
Re: [Xtend] XtendComponent vs. XtendFacade [message #503411 is a reply to message #503338] Sun, 13 December 2009 12:51 Go to previous messageGo to next message
Michael Matzen is currently offline Michael MatzenFriend
Messages: 13
Registered: July 2009
Junior Member
Hi,

thanks for your answer, so i should rather use the XtendFacade.
But is it possible to call an extension that is not included in the
class path?

My .ext files are either contained in a plug-in or somewhere in the
plug-in state location (.metadata/..../).


> Hello,
>
> you may find some hints on this topic in the xtend documentation
> http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .xpand.doc/help/ch01s05.html
>
>
>
>
> The XtendComponent is meant to be used to call Xtend from an MWE
> Workflow file
> The XtendFacade is meant to be called from java directly.
>
>
> i hope is answers your question
>
Re: [Xtend] XtendComponent vs. XtendFacade [message #503597 is a reply to message #503411] Mon, 14 December 2009 21:09 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 6550
Registered: July 2009
Senior Member
hi

if the plugin is in the workspace you could try something like this

XtendFacade f = XtendFacade.create("../test-project/META-INF/test/test");
Re: [Xtend] XtendComponent vs. XtendFacade [message #503669 is a reply to message #503597] Tue, 15 December 2009 09:19 Go to previous messageGo to next message
Michael Matzen is currently offline Michael MatzenFriend
Messages: 13
Registered: July 2009
Junior Member
Hi,

the plug-in is only a .jar file, so i can't directly access the folder.
(I could use the Plugin.find or Plugin.openStream, but i think the
XtendFacade can only be used with fully qualified names and no paths or
urls).

I need to access the .metadata folder, not the meta-inf folder, because
i need to serialize an xtend file "somewhere" and execute it and i can't
say if the project even has a meta-inf folder.
So i decided to use the Plugin.StateLocation folder, because it always
exists (or will be created)



> hi
>
> if the plugin is in the workspace you could try something like this
>
>
> XtendFacade f = XtendFacade.create("../test-project/META-INF/test/test");
>
Re: [Xtend] XtendComponent vs. XtendFacade [message #503682 is a reply to message #503669] Tue, 15 December 2009 05:30 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 6550
Registered: July 2009
Senior Member
hi,

the same a with my relative path should work with absolute paths. so if you can find out file file uri of the state dir and concat it with the relative path of the extension file it should work.
Re: [Xtend] XtendComponent vs. XtendFacade [message #503753 is a reply to message #503682] Tue, 15 December 2009 10:56 Go to previous message
Michael Matzen is currently offline Michael MatzenFriend
Messages: 13
Registered: July 2009
Junior Member
Ahhh my fault, i tried to use the hasExtension(...) method before
registering my metamodel.

And because the facade loads extension files by using them as "imported
extensions" the facade itself had no extensions and i assumed that the
file could not be loaded :)

Thanks for your help


> hi,
>
> the same a with my relative path should work with absolute paths. so if
> you can find out file file uri of the state dir and concat it with the
> relative path of the extension file it should work.
Previous Topic:migrating from oaw: Workflow problems
Next Topic:[Acceleo] line feeds in templates
Goto Forum:
  


Current Time: Sat Dec 20 12:15:34 GMT 2014

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

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