Skip to main content



      Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » code generation with JET2 and EMF
code generation with JET2 and EMF [message #54355] Fri, 29 September 2006 01:13 Go to next message
Eclipse UserFriend
Originally posted by: rasmusmodsat.hotmail.com

Hi,

I've been looking and looking but I simply can not find any simple examples
of using JET2 to generate code from an EMF model and a template?

I have created a HelloWorld EMF project, and now I would like a simple
GENERATE-action which can be triggered from the generated EMF editor. This
action should simply create a textfile with the name of the currently
selected node as its contents. What should I write in the run-method of my
action? And which other configuration steps are necessary?

Thanks,

HW
Re: code generation with JET2 and EMF [message #54500 is a reply to message #54355] Fri, 29 September 2006 09:11 Go to previous messageGo to next message
Eclipse UserFriend
Hi Hubertus,

All that you have to do is the following,

Inside the run method of the action class class execute the following ,

JET2Platform.runTransformXXX(.....) , please refer to the JET2 API
documentation for the various runTransformXXX(...) methods that suit
your needs .

Thanks.

Kamesh

Hubertus Wilder wrote:
> Hi,
>
> I've been looking and looking but I simply can not find any simple examples
> of using JET2 to generate code from an EMF model and a template?
>
> I have created a HelloWorld EMF project, and now I would like a simple
> GENERATE-action which can be triggered from the generated EMF editor. This
> action should simply create a textfile with the name of the currently
> selected node as its contents. What should I write in the run-method of my
> action? And which other configuration steps are necessary?
>
> Thanks,
>
> HW
>
>
>
>


--

Kamesh Sampath
Re: code generation with JET2 and EMF [message #54581 is a reply to message #54500] Fri, 29 September 2006 10:52 Go to previous messageGo to next message
Eclipse UserFriend
Hubertus:

For your action class, I suggest:

-----------------------------------------------
Map parameters = new HashMap();
// need to tell JET where to write the output, since we are not asking it to
load an IResource
parameters.put("outputFileContainer", "... the workspace relative path of
the container to hold the file ...");
// invoke a JET transform passing the already loaded EObject in as the
'source'. This become '.' in an XPath expression.
JET2Platform.runTransformOnObject( "...transform-id", selectedEObject,
parameters, ...progressmonitor...);
-----------------------------------------------

For your simple transform, I recommend the following templates:

templates/main.jet:
-----------------------------------------------
<%-- Most tag libraries are automaticly imported, but not the workspace
tags, since they only apply to main-like templates --%>
<%@taglib id="org.eclipse.jet.workspaceTags" prefix="ws"%>

<%-- create a variable picking up the object passed to the transform --%>
<c:setVariable var="selectedObject" select="."/>

<%-- write the text file --%>
<ws:file path="{$outputFileContiner}/selectedObjectInfo.txt"
template="templates/selectedObjectInfo.txt.jet"/>
-----------------------------------------------


templates/selectedObjectInfo.txt.jet:
-----------------------------------------------
Information on the selected object:
Attributes:
<c:iterate select="$selectedObject/@*" var="attr">
<c:get select="name($attr)"/> = <c:get select="$attr"/>
</c:iterate>
-----------------------------------------------

Note that the above template is completely generic. You can, of course, use
type specific expressions. If, for example, every EObject has a name
attribute, you could use

name = <c:get select="$selectedObject/@name"/>


Paul Elder
EMFT JET Lead


"Kamesh Sampath" <kamesh_sampath@msn.com> wrote in message
news:efj62b$d1f$1@utils.eclipse.org...
> Hi Hubertus,
>
> All that you have to do is the following,
>
> Inside the run method of the action class class execute the following ,
>
> JET2Platform.runTransformXXX(.....) , please refer to the JET2 API
> documentation for the various runTransformXXX(...) methods that suit
> your needs .
>
> Thanks.
>
> Kamesh
>
> Hubertus Wilder wrote:
>> Hi,
>>
>> I've been looking and looking but I simply can not find any simple
>> examples of using JET2 to generate code from an EMF model and a template?
>>
>> I have created a HelloWorld EMF project, and now I would like a simple
>> GENERATE-action which can be triggered from the generated EMF editor.
>> This action should simply create a textfile with the name of the
>> currently selected node as its contents. What should I write in the
>> run-method of my action? And which other configuration steps are
>> necessary?
>>
>> Thanks,
>>
>> HW
>>
>>
>>
>
>
> --
>
> Kamesh Sampath
Re: code generation with JET2 and EMF [message #54947 is a reply to message #54581] Fri, 29 September 2006 16:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rasmusmodsat.hotmail.com

Thanks Paul,

but when I run your code, I get the error below. I think that I am probably
missing some fundamental point. Where is this concept of "Transformation"
defined? If I add a transformation in my plugin.xml, I have to provide a
templateLoader? What is that?

Sorry, if these questions seem naive, but I don't really have any good
examples to learn from. Do you know of any places to look for examples of
creating and running transformations programmatically?

- HW


java.lang.NullPointerException

at
org.eclipse.emf.common.CommonPlugin$Implementation.loadClass (CommonPlugin.java:198)

at org.eclipse.emf.common.CommonPlugin.loadClass(CommonPlugin.j ava:98)

at
org.eclipse.emf.ecore.xmi.util.DefaultEcoreBuilder.<clinit>(DefaultEcoreBuilder.java:54)

at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createEcoreBuilder (XMLHandler.java:2799)

at org.eclipse.emf.ecore.xmi.impl.XMLHandler.<init>(XMLHandler.java:394)

at
org.eclipse.emf.ecore.xmi.impl.SAXXMLHandler.<init>(SAXXMLHandler.java:43)

at
org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.makeDefaultHandle r(XMLLoadImpl.java:310)

at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl. java:141)

at
org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLRes ourceImpl.java:179)

at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1089)

at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:895)

at
org.eclipse.jet.internal.runtime.model.EMFXMLModelLoader.loa d(EMFXMLModelLoader.java:126)

at
org.eclipse.jet.internal.runtime.model.EMFXMLModelLoader.loa d(EMFXMLModelLoader.java:106)

at
org.eclipse.jet.internal.extensionpoints.TransformDataFactor y.createTransformData(TransformDataFactory.java:140)

at
org.eclipse.jet.internal.runtime.DeployedJETBundleProvider.a ddTransforms(DeployedJETBundleProvider.java:165)

at
org.eclipse.jet.internal.runtime.DeployedJETBundleProvider.s tartup(DeployedJETBundleProvider.java:106)

at
org.eclipse.jet.internal.runtime.JETBundleManager.startup(JE TBundleManager.java:258)

at
org.eclipse.jet.internal.InternalJET2Platform.start(Internal JET2Platform.java:260)

at
org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:995)

at java.security.AccessController.doPrivileged(Native Method)

at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:989)

at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:970)

at
org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:317)

at
org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:256)

at
org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter .preFindLocalClass(EclipseLazyStarter.java:86)

at
org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLoc alClass(ClasspathManager.java:409)

at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.fin dLocalClass(DefaultClassLoader.java:188)

at
org.eclipse.osgi.framework.internal.core.BundleLoader.findLo calClass(BundleLoader.java:339)

at
org.eclipse.osgi.framework.internal.core.SingleSourcePackage .loadClass(SingleSourcePackage.java:37)

at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:388)

at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:352)

at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa dClass(DefaultClassLoader.java:83)

at java.lang.ClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClassInternal(Unknown Source)

at
helloworld.presentation.HelloworldActionBarContributorImpl$1 .run(HelloworldActionBarContributorImpl.java:41)

at org.eclipse.jface.action.Action.runWithEvent(Action.java:499 )

at
org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:539)

at
org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:488)

at
org.eclipse.jface.action.ActionContributionItem$5.handleEven t(ActionContributionItem.java:400)

at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)

at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)

at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3348)

at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2968)

at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1914)

at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)

at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:419)

at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)

at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:95)

at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:78)

at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)

at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)

at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)

at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 )

at org.eclipse.core.launcher.Main.basicRun(Main.java:280)

at org.eclipse.core.launcher.Main.run(Main.java:977)

at org.eclipse.core.launcher.Main.main(Main.java:952)

status: Status ERROR: org.eclipse.jet code=0 Could not find transformation
with id "myTransform" null
Re: code generation with JET2 and EMF [message #55107 is a reply to message #54947] Sat, 30 September 2006 03:01 Go to previous messageGo to next message
Eclipse UserFriend
Hi Hubertus,

You need to keep in the following points in mind when using JET2 ,

I take an assumption that you have created an JET Transformation Project
and defined your templates,

1. Export the Project as Plugins and Deployable Fragments and make a jar
out of it, say xyz.jar

2. Import the xyz.jar in to the Plugin project from where you are
calling the JET2Transformation via Action

3 .The plugin from where you are calling the JET2 transform need to
add an extension point called "org.eclipse.jet.deployedTransforms", to
the extension point please do add an deployedTransform , make the
"bundle" property of the deployedTransform point to the xyz.jar

There are two default modelLoaders for JET2Transformation EMF and XML
(default) . If you want to make your modelLoader to be EMF based then
set the 'modelLoader' property of the transformation to org.eclipse.jet.emf

Please refer to the JET2 documentation if you get any further errors or
just post it on the newsgroup .

A point to mention you can refer to the newsgroup thread between me and
Paul Elder about various errors and solutions on JET2 Transformation.

I hope this helps you. :-)

Thanks.

Kamesh





Hubertus Wilder wrote:
> Thanks Paul,
>
> but when I run your code, I get the error below. I think that I am probably
> missing some fundamental point. Where is this concept of "Transformation"
> defined? If I add a transformation in my plugin.xml, I have to provide a
> templateLoader? What is that?
>
> Sorry, if these questions seem naive, but I don't really have any good
> examples to learn from. Do you know of any places to look for examples of
> creating and running transformations programmatically?
>
> - HW
>
>
> java.lang.NullPointerException
>
> at
> org.eclipse.emf.common.CommonPlugin$Implementation.loadClass (CommonPlugin.java:198)
>
> at org.eclipse.emf.common.CommonPlugin.loadClass(CommonPlugin.j ava:98)
>
> at
> org.eclipse.emf.ecore.xmi.util.DefaultEcoreBuilder.<clinit>(DefaultEcoreBuilder.java:54)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.createEcoreBuilder (XMLHandler.java:2799)
>
> at org.eclipse.emf.ecore.xmi.impl.XMLHandler.<init>(XMLHandler.java:394)
>
> at
> org.eclipse.emf.ecore.xmi.impl.SAXXMLHandler.<init>(SAXXMLHandler.java:43)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.makeDefaultHandle r(XMLLoadImpl.java:310)
>
> at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl. java:141)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLRes ourceImpl.java:179)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1089)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:895)
>
> at
> org.eclipse.jet.internal.runtime.model.EMFXMLModelLoader.loa d(EMFXMLModelLoader.java:126)
>
> at
> org.eclipse.jet.internal.runtime.model.EMFXMLModelLoader.loa d(EMFXMLModelLoader.java:106)
>
> at
> org.eclipse.jet.internal.extensionpoints.TransformDataFactor y.createTransformData(TransformDataFactory.java:140)
>
> at
> org.eclipse.jet.internal.runtime.DeployedJETBundleProvider.a ddTransforms(DeployedJETBundleProvider.java:165)
>
> at
> org.eclipse.jet.internal.runtime.DeployedJETBundleProvider.s tartup(DeployedJETBundleProvider.java:106)
>
> at
> org.eclipse.jet.internal.runtime.JETBundleManager.startup(JE TBundleManager.java:258)
>
> at
> org.eclipse.jet.internal.InternalJET2Platform.start(Internal JET2Platform.java:260)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:995)
>
> at java.security.AccessController.doPrivileged(Native Method)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:989)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:970)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:317)
>
> at
> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:256)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter .preFindLocalClass(EclipseLazyStarter.java:86)
>
> at
> org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLoc alClass(ClasspathManager.java:409)
>
> at
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.fin dLocalClass(DefaultClassLoader.java:188)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findLo calClass(BundleLoader.java:339)
>
> at
> org.eclipse.osgi.framework.internal.core.SingleSourcePackage .loadClass(SingleSourcePackage.java:37)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:388)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:352)
>
> at
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa dClass(DefaultClassLoader.java:83)
>
> at java.lang.ClassLoader.loadClass(Unknown Source)
>
> at java.lang.ClassLoader.loadClassInternal(Unknown Source)
>
> at
> helloworld.presentation.HelloworldActionBarContributorImpl$1 .run(HelloworldActionBarContributorImpl.java:41)
>
> at org.eclipse.jface.action.Action.runWithEvent(Action.java:499 )
>
> at
> org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:539)
>
> at
> org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:488)
>
> at
> org.eclipse.jface.action.ActionContributionItem$5.handleEven t(ActionContributionItem.java:400)
>
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
>
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
>
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3348)
>
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2968)
>
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1914)
>
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
>
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:419)
>
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
>
> at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:95)
>
> at
> org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:78)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>
> at java.lang.reflect.Method.invoke(Unknown Source)
>
> at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 )
>
> at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
>
> at org.eclipse.core.launcher.Main.run(Main.java:977)
>
> at org.eclipse.core.launcher.Main.main(Main.java:952)
>
> status: Status ERROR: org.eclipse.jet code=0 Could not find transformation
> with id "myTransform" null
>
>
>
>


--

Kamesh Sampath
Re: code generation with JET2 and EMF [message #55621 is a reply to message #54947] Mon, 02 October 2006 08:50 Go to previous message
Eclipse UserFriend
Hubertus:

Here's the most useful bit from the stack trace:

> status: Status ERROR: org.eclipse.jet code=0 Could not find transformation
> with id "myTransform" null

Replace the string "myTransform" with the id of the EMFT JET transformation
project containing your templates. If you're not certain, open the
plugin.xml or META-INF/MANIFEST.MF file with the Plug-in Manifest Editor,
and check the ID field on the Overview tab.

The stack trace itself is misinformation. JET uses EMF's XMLResourceImpl to
parse a few XML documents on startup. In turn, XMLResourceImpl looks for the
plug-in org.eclipse.xsd. If it doesn't find it, EMF prints the stack trace,
but continues to parse the XML documents. Easiest way to eliminate this is
to install org.eclipse.xsd.

Paul

"Hubertus Wilder" <rasmusmodsat@hotmail.com> wrote in message
news:efjuvd$lvs$1@utils.eclipse.org...
> Thanks Paul,
>
> but when I run your code, I get the error below. I think that I am
> probably missing some fundamental point. Where is this concept of
> "Transformation" defined? If I add a transformation in my plugin.xml, I
> have to provide a templateLoader? What is that?
>
> Sorry, if these questions seem naive, but I don't really have any good
> examples to learn from. Do you know of any places to look for examples of
> creating and running transformations programmatically?
>
> - HW
>
>
> java.lang.NullPointerException
>
> at
> org.eclipse.emf.common.CommonPlugin$Implementation.loadClass (CommonPlugin.java:198)
>
> at org.eclipse.emf.common.CommonPlugin.loadClass(CommonPlugin.j ava:98)
>
> at
> org.eclipse.emf.ecore.xmi.util.DefaultEcoreBuilder.<clinit>(DefaultEcoreBuilder.java:54)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.createEcoreBuilder (XMLHandler.java:2799)
>
> at org.eclipse.emf.ecore.xmi.impl.XMLHandler.<init>(XMLHandler.java:394)
>
> at
> org.eclipse.emf.ecore.xmi.impl.SAXXMLHandler.<init>(SAXXMLHandler.java:43)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.makeDefaultHandle r(XMLLoadImpl.java:310)
>
> at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl. java:141)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLRes ourceImpl.java:179)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1089)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:895)
>
> at
> org.eclipse.jet.internal.runtime.model.EMFXMLModelLoader.loa d(EMFXMLModelLoader.java:126)
>
> at
> org.eclipse.jet.internal.runtime.model.EMFXMLModelLoader.loa d(EMFXMLModelLoader.java:106)
>
> at
> org.eclipse.jet.internal.extensionpoints.TransformDataFactor y.createTransformData(TransformDataFactory.java:140)
>
> at
> org.eclipse.jet.internal.runtime.DeployedJETBundleProvider.a ddTransforms(DeployedJETBundleProvider.java:165)
>
> at
> org.eclipse.jet.internal.runtime.DeployedJETBundleProvider.s tartup(DeployedJETBundleProvider.java:106)
>
> at
> org.eclipse.jet.internal.runtime.JETBundleManager.startup(JE TBundleManager.java:258)
>
> at
> org.eclipse.jet.internal.InternalJET2Platform.start(Internal JET2Platform.java:260)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:995)
>
> at java.security.AccessController.doPrivileged(Native Method)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:989)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:970)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:317)
>
> at
> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:256)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter .preFindLocalClass(EclipseLazyStarter.java:86)
>
> at
> org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLoc alClass(ClasspathManager.java:409)
>
> at
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.fin dLocalClass(DefaultClassLoader.java:188)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findLo calClass(BundleLoader.java:339)
>
> at
> org.eclipse.osgi.framework.internal.core.SingleSourcePackage .loadClass(SingleSourcePackage.java:37)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:388)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:352)
>
> at
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa dClass(DefaultClassLoader.java:83)
>
> at java.lang.ClassLoader.loadClass(Unknown Source)
>
> at java.lang.ClassLoader.loadClassInternal(Unknown Source)
>
> at
> helloworld.presentation.HelloworldActionBarContributorImpl$1 .run(HelloworldActionBarContributorImpl.java:41)
>
> at org.eclipse.jface.action.Action.runWithEvent(Action.java:499 )
>
> at
> org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:539)
>
> at
> org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:488)
>
> at
> org.eclipse.jface.action.ActionContributionItem$5.handleEven t(ActionContributionItem.java:400)
>
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
>
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
>
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3348)
>
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2968)
>
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1914)
>
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
>
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:419)
>
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
>
> at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:95)
>
> at
> org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:78)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>
> at java.lang.reflect.Method.invoke(Unknown Source)
>
> at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 )
>
> at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
>
> at org.eclipse.core.launcher.Main.run(Main.java:977)
>
> at org.eclipse.core.launcher.Main.main(Main.java:952)
>
> status: Status ERROR: org.eclipse.jet code=0 Could not find transformation
> with id "myTransform" null
>
>
>
Re: code generation with JET2 and EMF [message #592704 is a reply to message #54355] Fri, 29 September 2006 09:11 Go to previous message
Eclipse UserFriend
Hi Hubertus,

All that you have to do is the following,

Inside the run method of the action class class execute the following ,

JET2Platform.runTransformXXX(.....) , please refer to the JET2 API
documentation for the various runTransformXXX(...) methods that suit
your needs .

Thanks.

Kamesh

Hubertus Wilder wrote:
> Hi,
>
> I've been looking and looking but I simply can not find any simple examples
> of using JET2 to generate code from an EMF model and a template?
>
> I have created a HelloWorld EMF project, and now I would like a simple
> GENERATE-action which can be triggered from the generated EMF editor. This
> action should simply create a textfile with the name of the currently
> selected node as its contents. What should I write in the run-method of my
> action? And which other configuration steps are necessary?
>
> Thanks,
>
> HW
>
>
>
>


--

Kamesh Sampath
Re: code generation with JET2 and EMF [message #592735 is a reply to message #54500] Fri, 29 September 2006 10:52 Go to previous message
Eclipse UserFriend
Hubertus:

For your action class, I suggest:

-----------------------------------------------
Map parameters = new HashMap();
// need to tell JET where to write the output, since we are not asking it to
load an IResource
parameters.put("outputFileContainer", "... the workspace relative path of
the container to hold the file ...");
// invoke a JET transform passing the already loaded EObject in as the
'source'. This become '.' in an XPath expression.
JET2Platform.runTransformOnObject( "...transform-id", selectedEObject,
parameters, ...progressmonitor...);
-----------------------------------------------

For your simple transform, I recommend the following templates:

templates/main.jet:
-----------------------------------------------
<%-- Most tag libraries are automaticly imported, but not the workspace
tags, since they only apply to main-like templates --%>
<%@taglib id="org.eclipse.jet.workspaceTags" prefix="ws"%>

<%-- create a variable picking up the object passed to the transform --%>
<c:setVariable var="selectedObject" select="."/>

<%-- write the text file --%>
<ws:file path="{$outputFileContiner}/selectedObjectInfo.txt"
template="templates/selectedObjectInfo.txt.jet"/>
-----------------------------------------------


templates/selectedObjectInfo.txt.jet:
-----------------------------------------------
Information on the selected object:
Attributes:
<c:iterate select="$selectedObject/@*" var="attr">
<c:get select="name($attr)"/> = <c:get select="$attr"/>
</c:iterate>
-----------------------------------------------

Note that the above template is completely generic. You can, of course, use
type specific expressions. If, for example, every EObject has a name
attribute, you could use

name = <c:get select="$selectedObject/@name"/>


Paul Elder
EMFT JET Lead


"Kamesh Sampath" <kamesh_sampath@msn.com> wrote in message
news:efj62b$d1f$1@utils.eclipse.org...
> Hi Hubertus,
>
> All that you have to do is the following,
>
> Inside the run method of the action class class execute the following ,
>
> JET2Platform.runTransformXXX(.....) , please refer to the JET2 API
> documentation for the various runTransformXXX(...) methods that suit
> your needs .
>
> Thanks.
>
> Kamesh
>
> Hubertus Wilder wrote:
>> Hi,
>>
>> I've been looking and looking but I simply can not find any simple
>> examples of using JET2 to generate code from an EMF model and a template?
>>
>> I have created a HelloWorld EMF project, and now I would like a simple
>> GENERATE-action which can be triggered from the generated EMF editor.
>> This action should simply create a textfile with the name of the
>> currently selected node as its contents. What should I write in the
>> run-method of my action? And which other configuration steps are
>> necessary?
>>
>> Thanks,
>>
>> HW
>>
>>
>>
>
>
> --
>
> Kamesh Sampath
Re: code generation with JET2 and EMF [message #592915 is a reply to message #54581] Fri, 29 September 2006 16:16 Go to previous message
Eclipse UserFriend
Originally posted by: rasmusmodsat.hotmail.com

Thanks Paul,

but when I run your code, I get the error below. I think that I am probably
missing some fundamental point. Where is this concept of "Transformation"
defined? If I add a transformation in my plugin.xml, I have to provide a
templateLoader? What is that?

Sorry, if these questions seem naive, but I don't really have any good
examples to learn from. Do you know of any places to look for examples of
creating and running transformations programmatically?

- HW


java.lang.NullPointerException

at
org.eclipse.emf.common.CommonPlugin$Implementation.loadClass (CommonPlugin.java:198)

at org.eclipse.emf.common.CommonPlugin.loadClass(CommonPlugin.j ava:98)

at
org.eclipse.emf.ecore.xmi.util.DefaultEcoreBuilder.<clinit>(DefaultEcoreBuilder.java:54)

at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createEcoreBuilder (XMLHandler.java:2799)

at org.eclipse.emf.ecore.xmi.impl.XMLHandler.<init>(XMLHandler.java:394)

at
org.eclipse.emf.ecore.xmi.impl.SAXXMLHandler.<init>(SAXXMLHandler.java:43)

at
org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.makeDefaultHandle r(XMLLoadImpl.java:310)

at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl. java:141)

at
org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLRes ourceImpl.java:179)

at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1089)

at
org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:895)

at
org.eclipse.jet.internal.runtime.model.EMFXMLModelLoader.loa d(EMFXMLModelLoader.java:126)

at
org.eclipse.jet.internal.runtime.model.EMFXMLModelLoader.loa d(EMFXMLModelLoader.java:106)

at
org.eclipse.jet.internal.extensionpoints.TransformDataFactor y.createTransformData(TransformDataFactory.java:140)

at
org.eclipse.jet.internal.runtime.DeployedJETBundleProvider.a ddTransforms(DeployedJETBundleProvider.java:165)

at
org.eclipse.jet.internal.runtime.DeployedJETBundleProvider.s tartup(DeployedJETBundleProvider.java:106)

at
org.eclipse.jet.internal.runtime.JETBundleManager.startup(JE TBundleManager.java:258)

at
org.eclipse.jet.internal.InternalJET2Platform.start(Internal JET2Platform.java:260)

at
org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:995)

at java.security.AccessController.doPrivileged(Native Method)

at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:989)

at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:970)

at
org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:317)

at
org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:256)

at
org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter .preFindLocalClass(EclipseLazyStarter.java:86)

at
org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLoc alClass(ClasspathManager.java:409)

at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.fin dLocalClass(DefaultClassLoader.java:188)

at
org.eclipse.osgi.framework.internal.core.BundleLoader.findLo calClass(BundleLoader.java:339)

at
org.eclipse.osgi.framework.internal.core.SingleSourcePackage .loadClass(SingleSourcePackage.java:37)

at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:388)

at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:352)

at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa dClass(DefaultClassLoader.java:83)

at java.lang.ClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClassInternal(Unknown Source)

at
helloworld.presentation.HelloworldActionBarContributorImpl$1 .run(HelloworldActionBarContributorImpl.java:41)

at org.eclipse.jface.action.Action.runWithEvent(Action.java:499 )

at
org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:539)

at
org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:488)

at
org.eclipse.jface.action.ActionContributionItem$5.handleEven t(ActionContributionItem.java:400)

at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)

at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)

at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3348)

at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2968)

at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1914)

at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)

at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:419)

at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)

at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:95)

at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:78)

at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)

at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)

at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)

at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 )

at org.eclipse.core.launcher.Main.basicRun(Main.java:280)

at org.eclipse.core.launcher.Main.run(Main.java:977)

at org.eclipse.core.launcher.Main.main(Main.java:952)

status: Status ERROR: org.eclipse.jet code=0 Could not find transformation
with id "myTransform" null
Re: code generation with JET2 and EMF [message #592980 is a reply to message #54947] Sat, 30 September 2006 03:01 Go to previous message
Eclipse UserFriend
Hi Hubertus,

You need to keep in the following points in mind when using JET2 ,

I take an assumption that you have created an JET Transformation Project
and defined your templates,

1. Export the Project as Plugins and Deployable Fragments and make a jar
out of it, say xyz.jar

2. Import the xyz.jar in to the Plugin project from where you are
calling the JET2Transformation via Action

3 .The plugin from where you are calling the JET2 transform need to
add an extension point called "org.eclipse.jet.deployedTransforms", to
the extension point please do add an deployedTransform , make the
"bundle" property of the deployedTransform point to the xyz.jar

There are two default modelLoaders for JET2Transformation EMF and XML
(default) . If you want to make your modelLoader to be EMF based then
set the 'modelLoader' property of the transformation to org.eclipse.jet.emf

Please refer to the JET2 documentation if you get any further errors or
just post it on the newsgroup .

A point to mention you can refer to the newsgroup thread between me and
Paul Elder about various errors and solutions on JET2 Transformation.

I hope this helps you. :-)

Thanks.

Kamesh





Hubertus Wilder wrote:
> Thanks Paul,
>
> but when I run your code, I get the error below. I think that I am probably
> missing some fundamental point. Where is this concept of "Transformation"
> defined? If I add a transformation in my plugin.xml, I have to provide a
> templateLoader? What is that?
>
> Sorry, if these questions seem naive, but I don't really have any good
> examples to learn from. Do you know of any places to look for examples of
> creating and running transformations programmatically?
>
> - HW
>
>
> java.lang.NullPointerException
>
> at
> org.eclipse.emf.common.CommonPlugin$Implementation.loadClass (CommonPlugin.java:198)
>
> at org.eclipse.emf.common.CommonPlugin.loadClass(CommonPlugin.j ava:98)
>
> at
> org.eclipse.emf.ecore.xmi.util.DefaultEcoreBuilder.<clinit>(DefaultEcoreBuilder.java:54)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.createEcoreBuilder (XMLHandler.java:2799)
>
> at org.eclipse.emf.ecore.xmi.impl.XMLHandler.<init>(XMLHandler.java:394)
>
> at
> org.eclipse.emf.ecore.xmi.impl.SAXXMLHandler.<init>(SAXXMLHandler.java:43)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.makeDefaultHandle r(XMLLoadImpl.java:310)
>
> at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl. java:141)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLRes ourceImpl.java:179)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1089)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:895)
>
> at
> org.eclipse.jet.internal.runtime.model.EMFXMLModelLoader.loa d(EMFXMLModelLoader.java:126)
>
> at
> org.eclipse.jet.internal.runtime.model.EMFXMLModelLoader.loa d(EMFXMLModelLoader.java:106)
>
> at
> org.eclipse.jet.internal.extensionpoints.TransformDataFactor y.createTransformData(TransformDataFactory.java:140)
>
> at
> org.eclipse.jet.internal.runtime.DeployedJETBundleProvider.a ddTransforms(DeployedJETBundleProvider.java:165)
>
> at
> org.eclipse.jet.internal.runtime.DeployedJETBundleProvider.s tartup(DeployedJETBundleProvider.java:106)
>
> at
> org.eclipse.jet.internal.runtime.JETBundleManager.startup(JE TBundleManager.java:258)
>
> at
> org.eclipse.jet.internal.InternalJET2Platform.start(Internal JET2Platform.java:260)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:995)
>
> at java.security.AccessController.doPrivileged(Native Method)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:989)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:970)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:317)
>
> at
> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:256)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter .preFindLocalClass(EclipseLazyStarter.java:86)
>
> at
> org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLoc alClass(ClasspathManager.java:409)
>
> at
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.fin dLocalClass(DefaultClassLoader.java:188)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findLo calClass(BundleLoader.java:339)
>
> at
> org.eclipse.osgi.framework.internal.core.SingleSourcePackage .loadClass(SingleSourcePackage.java:37)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:388)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:352)
>
> at
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa dClass(DefaultClassLoader.java:83)
>
> at java.lang.ClassLoader.loadClass(Unknown Source)
>
> at java.lang.ClassLoader.loadClassInternal(Unknown Source)
>
> at
> helloworld.presentation.HelloworldActionBarContributorImpl$1 .run(HelloworldActionBarContributorImpl.java:41)
>
> at org.eclipse.jface.action.Action.runWithEvent(Action.java:499 )
>
> at
> org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:539)
>
> at
> org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:488)
>
> at
> org.eclipse.jface.action.ActionContributionItem$5.handleEven t(ActionContributionItem.java:400)
>
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
>
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
>
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3348)
>
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2968)
>
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1914)
>
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
>
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:419)
>
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
>
> at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:95)
>
> at
> org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:78)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>
> at java.lang.reflect.Method.invoke(Unknown Source)
>
> at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 )
>
> at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
>
> at org.eclipse.core.launcher.Main.run(Main.java:977)
>
> at org.eclipse.core.launcher.Main.main(Main.java:952)
>
> status: Status ERROR: org.eclipse.jet code=0 Could not find transformation
> with id "myTransform" null
>
>
>
>


--

Kamesh Sampath
Re: code generation with JET2 and EMF [message #593195 is a reply to message #54947] Mon, 02 October 2006 08:50 Go to previous message
Eclipse UserFriend
Hubertus:

Here's the most useful bit from the stack trace:

> status: Status ERROR: org.eclipse.jet code=0 Could not find transformation
> with id "myTransform" null

Replace the string "myTransform" with the id of the EMFT JET transformation
project containing your templates. If you're not certain, open the
plugin.xml or META-INF/MANIFEST.MF file with the Plug-in Manifest Editor,
and check the ID field on the Overview tab.

The stack trace itself is misinformation. JET uses EMF's XMLResourceImpl to
parse a few XML documents on startup. In turn, XMLResourceImpl looks for the
plug-in org.eclipse.xsd. If it doesn't find it, EMF prints the stack trace,
but continues to parse the XML documents. Easiest way to eliminate this is
to install org.eclipse.xsd.

Paul

"Hubertus Wilder" <rasmusmodsat@hotmail.com> wrote in message
news:efjuvd$lvs$1@utils.eclipse.org...
> Thanks Paul,
>
> but when I run your code, I get the error below. I think that I am
> probably missing some fundamental point. Where is this concept of
> "Transformation" defined? If I add a transformation in my plugin.xml, I
> have to provide a templateLoader? What is that?
>
> Sorry, if these questions seem naive, but I don't really have any good
> examples to learn from. Do you know of any places to look for examples of
> creating and running transformations programmatically?
>
> - HW
>
>
> java.lang.NullPointerException
>
> at
> org.eclipse.emf.common.CommonPlugin$Implementation.loadClass (CommonPlugin.java:198)
>
> at org.eclipse.emf.common.CommonPlugin.loadClass(CommonPlugin.j ava:98)
>
> at
> org.eclipse.emf.ecore.xmi.util.DefaultEcoreBuilder.<clinit>(DefaultEcoreBuilder.java:54)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.createEcoreBuilder (XMLHandler.java:2799)
>
> at org.eclipse.emf.ecore.xmi.impl.XMLHandler.<init>(XMLHandler.java:394)
>
> at
> org.eclipse.emf.ecore.xmi.impl.SAXXMLHandler.<init>(SAXXMLHandler.java:43)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.makeDefaultHandle r(XMLLoadImpl.java:310)
>
> at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl. java:141)
>
> at
> org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLRes ourceImpl.java:179)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1089)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:895)
>
> at
> org.eclipse.jet.internal.runtime.model.EMFXMLModelLoader.loa d(EMFXMLModelLoader.java:126)
>
> at
> org.eclipse.jet.internal.runtime.model.EMFXMLModelLoader.loa d(EMFXMLModelLoader.java:106)
>
> at
> org.eclipse.jet.internal.extensionpoints.TransformDataFactor y.createTransformData(TransformDataFactory.java:140)
>
> at
> org.eclipse.jet.internal.runtime.DeployedJETBundleProvider.a ddTransforms(DeployedJETBundleProvider.java:165)
>
> at
> org.eclipse.jet.internal.runtime.DeployedJETBundleProvider.s tartup(DeployedJETBundleProvider.java:106)
>
> at
> org.eclipse.jet.internal.runtime.JETBundleManager.startup(JE TBundleManager.java:258)
>
> at
> org.eclipse.jet.internal.InternalJET2Platform.start(Internal JET2Platform.java:260)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:995)
>
> at java.security.AccessController.doPrivileged(Native Method)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:989)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:970)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:317)
>
> at
> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:256)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter .preFindLocalClass(EclipseLazyStarter.java:86)
>
> at
> org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLoc alClass(ClasspathManager.java:409)
>
> at
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.fin dLocalClass(DefaultClassLoader.java:188)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findLo calClass(BundleLoader.java:339)
>
> at
> org.eclipse.osgi.framework.internal.core.SingleSourcePackage .loadClass(SingleSourcePackage.java:37)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:388)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:352)
>
> at
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa dClass(DefaultClassLoader.java:83)
>
> at java.lang.ClassLoader.loadClass(Unknown Source)
>
> at java.lang.ClassLoader.loadClassInternal(Unknown Source)
>
> at
> helloworld.presentation.HelloworldActionBarContributorImpl$1 .run(HelloworldActionBarContributorImpl.java:41)
>
> at org.eclipse.jface.action.Action.runWithEvent(Action.java:499 )
>
> at
> org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:539)
>
> at
> org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:488)
>
> at
> org.eclipse.jface.action.ActionContributionItem$5.handleEven t(ActionContributionItem.java:400)
>
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
>
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
>
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3348)
>
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2968)
>
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1914)
>
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
>
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:419)
>
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
>
> at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:95)
>
> at
> org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:78)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>
> at java.lang.reflect.Method.invoke(Unknown Source)
>
> at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 )
>
> at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
>
> at org.eclipse.core.launcher.Main.run(Main.java:977)
>
> at org.eclipse.core.launcher.Main.main(Main.java:952)
>
> status: Status ERROR: org.eclipse.jet code=0 Could not find transformation
> with id "myTransform" null
>
>
>
Previous Topic:Can I add my own class path entries to JETEmitter project
Next Topic:[Announce] EMFT JET 0.7.1 is available
Goto Forum:
  


Current Time: Mon Apr 28 02:43:14 EDT 2025

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

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

Back to the top