Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Calling Java from Xpand (QVTO variety)
Calling Java from Xpand (QVTO variety) [message #483773] Wed, 02 September 2009 21:56 Go to next message
RefuX Zanzeebarr is currently offline RefuX ZanzeebarrFriend
Messages: 51
Registered: July 2009
Member
Hi there,

I have a Java utility method getIdForGuid(String guid) I want to call
from my Xpand template.

From what research I have done it seems I need to use the <<EXTENSION>>
mechanism to do this. The approach using Xtend extensions is documented,
however the QVTO mechanism is not so clear to me.
Looking at some of the examples xpt templates there are often
<<EXTENSION xpt:StringOperations>> included in the templates. I can find
the class org.eclipse.m2m.internal.qvt.oml.stdlib.StringOperations. I'd
like to do the same kind of idea for my utility methods, just not too
sure how I tie it all together.
To confuse me even more I also see some EXTENSIONS that seem to call
out to QVTO files.. (jem2java.xpt has an extension jemUtil and I can
find a jemUtil.qvto file)

Any clarification on the above would be much appreciated!
Re: Calling Java from Xpand (QVTO variety) [message #483825 is a reply to message #483773] Thu, 03 September 2009 09:01 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello RefuX,

See org.eclipse.gmf.codegen as an example. Here is a definition of Java libraries
used there (from plugin.xml). You can search GMF templates for gmf::GenModelUtils
or gmf::EMFUtils to see how corresponding java classes are called from xpand
code. In general you need to create .java class, register it in plugin.xml,
import it to .xpt file and then you execute new instance of Eclipse you'll
see it working..

<extension point="org.eclipse.m2m.qvt.oml.javaBlackboxUnits">
<unit name="GenModelUtils" namespace="gmf">
<library class="org.eclipse.gmf.internal.codegen.util.GenModelUtils" >
<metamodel nsURI="http://www.eclipse.org/emf/2002/GenModel"/>
<metamodel nsURI="http://www.eclipse.org/emf/2002/Ecore"/>
</library>
</unit>
<unit name="EMFUtils" namespace="gmf">
<library class="org.eclipse.gmf.internal.codegen.util.EMFUtils">
<metamodel nsURI="http://www.eclipse.org/emf/2002/Ecore"/>
</library>
</unit>
<unit name="CodeGenerationUtils" namespace="gmf">
<library class="org.eclipse.gmf.internal.codegen.util.CodeGenerationUtils "/>
</unit>
<unit
description="GMF utulities to access EMF GenModels"
name="GenModelAccess"
namespace="gmf">
<library
class="org.eclipse.gmf.internal.codegen.util.GenModelAccessHelpers ">
<metamodel nsURI="http://www.eclipse.org/emf/2002/Ecore"/>
<metamodel nsURI="http://www.eclipse.org/emf/2002/GenModel"/>
</library>
</unit>
<unit
description="Access to GMF Xpand templates through QVTO"
name="XpandFacade"
namespace="xpt">
<library class="org.eclipse.gmf.internal.codegen.util.XpandFacadeAccess "/>
</unit>
</extension>

-----------------
Alex Shatalin
Re: Calling Java from Xpand (QVTO variety) [message #483957 is a reply to message #483825] Thu, 03 September 2009 18:17 Go to previous message
RefuX Zanzeebarr is currently offline RefuX ZanzeebarrFriend
Messages: 51
Registered: July 2009
Member
Perfect! Thanks much :)

Alex Shatalin wrote:
> Hello RefuX,
>
> See org.eclipse.gmf.codegen as an example. Here is a definition of Java
> libraries used there (from plugin.xml). You can search GMF templates for
> gmf::GenModelUtils or gmf::EMFUtils to see how corresponding java
> classes are called from xpand code. In general you need to create .java
> class, register it in plugin.xml, import it to .xpt file and then you
> execute new instance of Eclipse you'll see it working..
>
> <extension point="org.eclipse.m2m.qvt.oml.javaBlackboxUnits">
> <unit name="GenModelUtils" namespace="gmf">
> <library class="org.eclipse.gmf.internal.codegen.util.GenModelUtils" >
> <metamodel nsURI="http://www.eclipse.org/emf/2002/GenModel"/>
> <metamodel nsURI="http://www.eclipse.org/emf/2002/Ecore"/>
> </library>
> </unit>
> <unit name="EMFUtils" namespace="gmf">
> <library class="org.eclipse.gmf.internal.codegen.util.EMFUtils">
> <metamodel nsURI="http://www.eclipse.org/emf/2002/Ecore"/>
> </library>
> </unit>
> <unit name="CodeGenerationUtils" namespace="gmf">
> <library
> class="org.eclipse.gmf.internal.codegen.util.CodeGenerationUtils "/>
> </unit>
> <unit
> description="GMF utulities to access EMF GenModels"
> name="GenModelAccess"
> namespace="gmf">
> <library
>
> class="org.eclipse.gmf.internal.codegen.util.GenModelAccessHelpers ">
> <metamodel nsURI="http://www.eclipse.org/emf/2002/Ecore"/>
> <metamodel nsURI="http://www.eclipse.org/emf/2002/GenModel"/>
> </library>
> </unit>
> <unit
> description="Access to GMF Xpand templates through QVTO"
> name="XpandFacade"
> namespace="xpt">
> <library
> class="org.eclipse.gmf.internal.codegen.util.XpandFacadeAccess "/>
> </unit>
> </extension>
>
> -----------------
> Alex Shatalin
>
>
Previous Topic:Not that I title to put
Next Topic:hide the palette
Goto Forum:
  


Current Time: Tue Nov 20 13:11:51 GMT 2018

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

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

Back to the top