Home » Modeling » GMF (Graphical Modeling Framework) » GMF generated code throws UnsupportedOperationException?!?
GMF generated code throws UnsupportedOperationException?!? [message #156926] |
Wed, 24 October 2007 10:34 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Michael Moser![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=mmo%40zurich.ibm.com) Messages: 914 Registered: July 2009 |
Senior Member |
|
|
I generated a new GMF project using an existing set of .ecore, .gmftool,
..gmfgraph and .gmfmap files (BTW: this all used to work in a previous
version of GMF, but - burned by experience with GMF - I restarted from
scratch just migrating these mentioned files). These files describe a
very simple model that has "artifacts" and "processes" and connections
between them (processes can read and write artifacts/files, that's about
it). The graphical representations are rectangles and ovals and - of
course - lines/arrows for the connections. The entire thing is just a
toy example to get up and running with GMF.
I generated the .genmodel and created the model's source and the .edit
and .editor projects. Next I created the diagram editor .gmfgen file
from its three .gmf* input files and from that the .diagram project.
Everything compiles fine. So far, so good.
When I start these newly created plugins in a runtime workbench I can
create a new project and a new diagram with it (and the palette etc. all
look fine), but when I try to create any graphical object by selecting
the corresponding create tool and then clicking somewhere on the canvas,
absolutely nothing happens.
Instead, for each click on the canvas there is an exception on the
console:
--------------------------------------------
java.lang.UnsupportedOperationException
at
leonardo2.impl.LeonardoDiagramImpl.getArtifacts(LeonardoDiag ramImpl.java:99)
at leonardo2.impl.LeonardoDiagramImpl.eGet(LeonardoDiagramImpl. java:184)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjec tImpl.java:1002)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjec tImpl.java:994)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjec tImpl.java:989)
at
org.eclipse.emf.edit.provider.ItemProviderAdapter.getChildre n(ItemProviderAdapter.java:337)
at
org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvid er.getChildren(AdapterFactoryContentProvider.java:167)
at
leonardo2.diagram.navigator.Leonardo2DomainNavigatorContentP rovider.getChildren(Leonardo2DomainNavigatorContentProvider. java:204)
at
leonardo2.diagram.navigator.Leonardo2DomainNavigatorContentP rovider.hasChildren(Leonardo2DomainNavigatorContentProvider. java:239)
at
org.eclipse.ui.internal.navigator.extensions.SafeDelegateTre eContentProvider.hasChildren(SafeDelegateTreeContentProvider .java:107)
at
org.eclipse.ui.internal.navigator.extensions.SafeDelegateTre eContentProvider.hasChildren(SafeDelegateTreeContentProvider .java:292)
at
org.eclipse.ui.internal.navigator.NavigatorContentServiceCon tentProvider.hasChildren(NavigatorContentServiceContentProvi der.java:662)
at
org.eclipse.jface.viewers.AbstractTreeViewer.isExpandable(Ab stractTreeViewer.java:2014)
at
org.eclipse.jface.viewers.TreeViewer.isExpandable(TreeViewer .java:563)
at
org.eclipse.jface.viewers.AbstractTreeViewer.isExpandable(Ab stractTreeViewer.java:2044)
at
org.eclipse.jface.viewers.AbstractTreeViewer.updatePlus(Abst ractTreeViewer.java:2668)
at org.eclipse.jface.viewers.TreeViewer.updatePlus(TreeViewer.j ava:823)
at
org.eclipse.jface.viewers.AbstractTreeViewer.createTreeItem( AbstractTreeViewer.java:807)
at
org.eclipse.ui.navigator.CommonViewer.createTreeItem(CommonV iewer.java:150)
at
org.eclipse.jface.viewers.AbstractTreeViewer$1.run(AbstractT reeViewer.java:781)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:67)
at
org.eclipse.jface.viewers.AbstractTreeViewer.createChildren( AbstractTreeViewer.java:755)
at
org.eclipse.jface.viewers.TreeViewer.createChildren(TreeView er.java:615)
at
org.eclipse.jface.viewers.AbstractTreeViewer.handleTreeExpan d(AbstractTreeViewer.java:1407)
at
org.eclipse.jface.viewers.TreeViewer.handleTreeExpand(TreeVi ewer.java:906)
at
org.eclipse.jface.viewers.AbstractTreeViewer$4.treeExpanded( AbstractTreeViewer.java:1418)
at
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:125)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:962)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:947)
at org.eclipse.swt.widgets.Tree.wmNotifyChild(Tree.java:7053)
at org.eclipse.swt.widgets.Control.wmNotify(Control.java:4563)
at org.eclipse.swt.widgets.Composite.wmNotify(Composite.java:15 81)
at org.eclipse.swt.widgets.Control.WM_NOTIFY(Control.java:4216)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:3724 )
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4351 )
at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method)
at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:217 8)
at org.eclipse.swt.widgets.Tree.callWindowProc(Tree.java:1541)
at org.eclipse.swt.widgets.Tree.WM_LBUTTONDOWN(Tree.java:5798)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:3705 )
at org.eclipse.swt.widgets.Tree.windowProc(Tree.java:5370)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4364 )
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:22 64)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3291)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2389)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 19)
at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:289)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:461)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at
org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:106)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:153)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:106)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:76)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:363)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:176)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:64)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:615)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 504)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:443)
at org.eclipse.equinox.launcher.Main.run(Main.java:1169)
at org.eclipse.equinox.launcher.Main.main(Main.java:1144)
--------------------------------------------
If I check the LeonardoDiagramImpl.java file listed on top of the
stacktrace it reads:
--------------------------------------------
....
public EList<Artifact> getArtifacts()
{
// TODO: implement this method to return the 'Artifacts' containment
reference list
// Ensure that you remove @generated or mark it @generated NOT
// The list is expected to implement
org.eclipse.emf.ecore.util.InternalEList and
org.eclipse.emf.ecore.EStructuralFeature.Setting
// so it's likely that an appropriate subclass of
org.eclipse.emf.ecore.util.EcoreEList should be used.
throw new UnsupportedOperationException();
}
....
--------------------------------------------
In fact, in that file ALL methods are empty and throw
UnsupportedOperationException-s.
What's going on here? Isn't GMF supposed to generate all that code???
What am I missing here?
This is on Europa (base eclipse as well as GMF and all it's prereq's).
As I said: this example used to work with a previous GMF version (some
2.0 milestone, but I forgot, which one) using the exact same steps as
described above.
Michael
|
|
|
Re: GMF generated code throws UnsupportedOperationException?!? [message #156935 is a reply to message #156926] |
Wed, 24 October 2007 11:16 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Boris Blajer![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=boris.blajer%40gmail.com) Messages: 217 Registered: July 2009 |
Senior Member |
|
|
Hi Michael,
Actually, it's EMF, not GMF who is responsible for generation of this
part. Anyway, I believe this gets generated if the feature is declared
to be derived transient or volatile or something like that.
Best regards,
Boris
Michael Moser wrote:
> I generated a new GMF project using an existing set of .ecore, .gmftool,
> ..gmfgraph and .gmfmap files (BTW: this all used to work in a previous
> version of GMF, but - burned by experience with GMF - I restarted from
> scratch just migrating these mentioned files). These files describe a
> very simple model that has "artifacts" and "processes" and connections
> between them (processes can read and write artifacts/files, that's about
> it). The graphical representations are rectangles and ovals and - of
> course - lines/arrows for the connections. The entire thing is just a
> toy example to get up and running with GMF.
>
> I generated the .genmodel and created the model's source and the .edit
> and .editor projects. Next I created the diagram editor .gmfgen file
> from its three .gmf* input files and from that the .diagram project.
> Everything compiles fine. So far, so good.
>
> When I start these newly created plugins in a runtime workbench I can
> create a new project and a new diagram with it (and the palette etc. all
> look fine), but when I try to create any graphical object by selecting
> the corresponding create tool and then clicking somewhere on the canvas,
> absolutely nothing happens.
>
> Instead, for each click on the canvas there is an exception on the console:
> --------------------------------------------
> java.lang.UnsupportedOperationException
> at
> leonardo2.impl.LeonardoDiagramImpl.getArtifacts(LeonardoDiag ramImpl.java:99)
>
> at leonardo2.impl.LeonardoDiagramImpl.eGet(LeonardoDiagramImpl. java:184)
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjec tImpl.java:1002)
>
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjec tImpl.java:994)
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjec tImpl.java:989)
> at
> org.eclipse.emf.edit.provider.ItemProviderAdapter.getChildre n(ItemProviderAdapter.java:337)
>
> at
> org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvid er.getChildren(AdapterFactoryContentProvider.java:167)
>
> at
> leonardo2.diagram.navigator.Leonardo2DomainNavigatorContentP rovider.getChildren(Leonardo2DomainNavigatorContentProvider. java:204)
>
> at
> leonardo2.diagram.navigator.Leonardo2DomainNavigatorContentP rovider.hasChildren(Leonardo2DomainNavigatorContentProvider. java:239)
>
> at
> org.eclipse.ui.internal.navigator.extensions.SafeDelegateTre eContentProvider.hasChildren(SafeDelegateTreeContentProvider .java:107)
>
> at
> org.eclipse.ui.internal.navigator.extensions.SafeDelegateTre eContentProvider.hasChildren(SafeDelegateTreeContentProvider .java:292)
>
> at
> org.eclipse.ui.internal.navigator.NavigatorContentServiceCon tentProvider.hasChildren(NavigatorContentServiceContentProvi der.java:662)
>
> at
> org.eclipse.jface.viewers.AbstractTreeViewer.isExpandable(Ab stractTreeViewer.java:2014)
>
> at org.eclipse.jface.viewers.TreeViewer.isExpandable(TreeViewer .java:563)
> at
> org.eclipse.jface.viewers.AbstractTreeViewer.isExpandable(Ab stractTreeViewer.java:2044)
>
> at
> org.eclipse.jface.viewers.AbstractTreeViewer.updatePlus(Abst ractTreeViewer.java:2668)
>
> at org.eclipse.jface.viewers.TreeViewer.updatePlus(TreeViewer.j ava:823)
> at
> org.eclipse.jface.viewers.AbstractTreeViewer.createTreeItem( AbstractTreeViewer.java:807)
>
> at
> org.eclipse.ui.navigator.CommonViewer.createTreeItem(CommonV iewer.java:150)
> at
> org.eclipse.jface.viewers.AbstractTreeViewer$1.run(AbstractT reeViewer.java:781)
>
> at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:67)
> at
> org.eclipse.jface.viewers.AbstractTreeViewer.createChildren( AbstractTreeViewer.java:755)
>
> at org.eclipse.jface.viewers.TreeViewer.createChildren(TreeView er.java:615)
> at
> org.eclipse.jface.viewers.AbstractTreeViewer.handleTreeExpan d(AbstractTreeViewer.java:1407)
>
> at
> org.eclipse.jface.viewers.TreeViewer.handleTreeExpand(TreeVi ewer.java:906)
> at
> org.eclipse.jface.viewers.AbstractTreeViewer$4.treeExpanded( AbstractTreeViewer.java:1418)
>
> at
> org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:125)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:962)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:947)
> at org.eclipse.swt.widgets.Tree.wmNotifyChild(Tree.java:7053)
> at org.eclipse.swt.widgets.Control.wmNotify(Control.java:4563)
> at org.eclipse.swt.widgets.Composite.wmNotify(Composite.java:15 81)
> at org.eclipse.swt.widgets.Control.WM_NOTIFY(Control.java:4216)
> at org.eclipse.swt.widgets.Control.windowProc(Control.java:3724 )
> at org.eclipse.swt.widgets.Display.windowProc(Display.java:4351 )
> at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method)
> at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:217 8)
> at org.eclipse.swt.widgets.Tree.callWindowProc(Tree.java:1541)
> at org.eclipse.swt.widgets.Tree.WM_LBUTTONDOWN(Tree.java:5798)
> at org.eclipse.swt.widgets.Control.windowProc(Control.java:3705 )
> at org.eclipse.swt.widgets.Tree.windowProc(Tree.java:5370)
> at org.eclipse.swt.widgets.Display.windowProc(Display.java:4364 )
> at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
> at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:22 64)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3291)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2389)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 19)
> at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:289)
>
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:461)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
> at
> org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:106)
>
> at
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:153)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:106)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:76)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:363)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:176)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:64)
>
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:43)
>
> at java.lang.reflect.Method.invoke(Method.java:615)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 504)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:443)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1169)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1144)
> --------------------------------------------
>
> If I check the LeonardoDiagramImpl.java file listed on top of the
> stacktrace it reads:
>
> --------------------------------------------
> ....
> public EList<Artifact> getArtifacts()
> {
> // TODO: implement this method to return the 'Artifacts' containment
> reference list
> // Ensure that you remove @generated or mark it @generated NOT
> // The list is expected to implement
> org.eclipse.emf.ecore.util.InternalEList and
> org.eclipse.emf.ecore.EStructuralFeature.Setting
> // so it's likely that an appropriate subclass of
> org.eclipse.emf.ecore.util.EcoreEList should be used.
> throw new UnsupportedOperationException();
> }
> ....
> --------------------------------------------
>
>
> In fact, in that file ALL methods are empty and throw
> UnsupportedOperationException-s.
>
> What's going on here? Isn't GMF supposed to generate all that code???
> What am I missing here?
>
> This is on Europa (base eclipse as well as GMF and all it's prereq's).
> As I said: this example used to work with a previous GMF version (some
> 2.0 milestone, but I forgot, which one) using the exact same steps as
> described above.
>
> Michael
>
|
|
|
Re: GMF generated code throws UnsupportedOperationException?!? [message #156980 is a reply to message #156935] |
Wed, 24 October 2007 13:13 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: merks.ca.ibm.com
Boris,
That's right, if a feature is set to be volatile, then no variables are
allocated and all the accessor methods need to be implemented by hand.
Boris Blajer wrote:
> Hi Michael,
>
> Actually, it's EMF, not GMF who is responsible for generation of this
> part. Anyway, I believe this gets generated if the feature is declared
> to be derived transient or volatile or something like that.
>
> Best regards,
> Boris
>
>
> Michael Moser wrote:
>> I generated a new GMF project using an existing set of .ecore,
>> .gmftool, ..gmfgraph and .gmfmap files (BTW: this all used to work in
>> a previous version of GMF, but - burned by experience with GMF - I
>> restarted from scratch just migrating these mentioned files). These
>> files describe a very simple model that has "artifacts" and
>> "processes" and connections between them (processes can read and
>> write artifacts/files, that's about it). The graphical
>> representations are rectangles and ovals and - of course -
>> lines/arrows for the connections. The entire thing is just a toy
>> example to get up and running with GMF.
>>
>> I generated the .genmodel and created the model's source and the
>> .edit and .editor projects. Next I created the diagram editor .gmfgen
>> file from its three .gmf* input files and from that the .diagram
>> project. Everything compiles fine. So far, so good.
>>
>> When I start these newly created plugins in a runtime workbench I can
>> create a new project and a new diagram with it (and the palette etc.
>> all look fine), but when I try to create any graphical object by
>> selecting the corresponding create tool and then clicking somewhere
>> on the canvas, absolutely nothing happens.
>>
>> Instead, for each click on the canvas there is an exception on the
>> console:
>> --------------------------------------------
>> java.lang.UnsupportedOperationException
>> at
>> leonardo2.impl.LeonardoDiagramImpl.getArtifacts(LeonardoDiag ramImpl.java:99)
>>
>> at leonardo2.impl.LeonardoDiagramImpl.eGet(LeonardoDiagramImpl. java:184)
>> at
>> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjec tImpl.java:1002)
>>
>> at
>> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjec tImpl.java:994)
>>
>> at
>> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjec tImpl.java:989)
>>
>> at
>> org.eclipse.emf.edit.provider.ItemProviderAdapter.getChildre n(ItemProviderAdapter.java:337)
>>
>> at
>> org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvid er.getChildren(AdapterFactoryContentProvider.java:167)
>>
>> at
>> leonardo2.diagram.navigator.Leonardo2DomainNavigatorContentP rovider.getChildren(Leonardo2DomainNavigatorContentProvider. java:204)
>>
>> at
>> leonardo2.diagram.navigator.Leonardo2DomainNavigatorContentP rovider.hasChildren(Leonardo2DomainNavigatorContentProvider. java:239)
>>
>> at
>> org.eclipse.ui.internal.navigator.extensions.SafeDelegateTre eContentProvider.hasChildren(SafeDelegateTreeContentProvider .java:107)
>>
>> at
>> org.eclipse.ui.internal.navigator.extensions.SafeDelegateTre eContentProvider.hasChildren(SafeDelegateTreeContentProvider .java:292)
>>
>> at
>> org.eclipse.ui.internal.navigator.NavigatorContentServiceCon tentProvider.hasChildren(NavigatorContentServiceContentProvi der.java:662)
>>
>> at
>> org.eclipse.jface.viewers.AbstractTreeViewer.isExpandable(Ab stractTreeViewer.java:2014)
>>
>> at
>> org.eclipse.jface.viewers.TreeViewer.isExpandable(TreeViewer .java:563)
>> at
>> org.eclipse.jface.viewers.AbstractTreeViewer.isExpandable(Ab stractTreeViewer.java:2044)
>>
>> at
>> org.eclipse.jface.viewers.AbstractTreeViewer.updatePlus(Abst ractTreeViewer.java:2668)
>>
>> at org.eclipse.jface.viewers.TreeViewer.updatePlus(TreeViewer.j ava:823)
>> at
>> org.eclipse.jface.viewers.AbstractTreeViewer.createTreeItem( AbstractTreeViewer.java:807)
>>
>> at
>> org.eclipse.ui.navigator.CommonViewer.createTreeItem(CommonV iewer.java:150)
>>
>> at
>> org.eclipse.jface.viewers.AbstractTreeViewer$1.run(AbstractT reeViewer.java:781)
>>
>> at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:67)
>> at
>> org.eclipse.jface.viewers.AbstractTreeViewer.createChildren( AbstractTreeViewer.java:755)
>>
>> at
>> org.eclipse.jface.viewers.TreeViewer.createChildren(TreeView er.java:615)
>> at
>> org.eclipse.jface.viewers.AbstractTreeViewer.handleTreeExpan d(AbstractTreeViewer.java:1407)
>>
>> at
>> org.eclipse.jface.viewers.TreeViewer.handleTreeExpand(TreeVi ewer.java:906)
>>
>> at
>> org.eclipse.jface.viewers.AbstractTreeViewer$4.treeExpanded( AbstractTreeViewer.java:1418)
>>
>> at
>> org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:125)
>>
>> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
>> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
>> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:962)
>> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:947)
>> at org.eclipse.swt.widgets.Tree.wmNotifyChild(Tree.java:7053)
>> at org.eclipse.swt.widgets.Control.wmNotify(Control.java:4563)
>> at org.eclipse.swt.widgets.Composite.wmNotify(Composite.java:15 81)
>> at org.eclipse.swt.widgets.Control.WM_NOTIFY(Control.java:4216)
>> at org.eclipse.swt.widgets.Control.windowProc(Control.java:3724 )
>> at org.eclipse.swt.widgets.Display.windowProc(Display.java:4351 )
>> at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method)
>> at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:217 8)
>> at org.eclipse.swt.widgets.Tree.callWindowProc(Tree.java:1541)
>> at org.eclipse.swt.widgets.Tree.WM_LBUTTONDOWN(Tree.java:5798)
>> at org.eclipse.swt.widgets.Control.windowProc(Control.java:3705 )
>> at org.eclipse.swt.widgets.Tree.windowProc(Tree.java:5370)
>> at org.eclipse.swt.widgets.Display.windowProc(Display.java:4364 )
>> at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
>> at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:22 64)
>> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3291)
>> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2389)
>> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
>> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 19)
>> at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
>> at
>> org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:289)
>>
>> at
>> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:461)
>>
>> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
>> at
>> org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:106)
>>
>> at
>> org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:153)
>>
>> at
>> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:106)
>>
>> at
>> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:76)
>>
>> at
>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:363)
>>
>> at
>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:176)
>>
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:64)
>>
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:43)
>>
>> at java.lang.reflect.Method.invoke(Method.java:615)
>> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 504)
>> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:443)
>> at org.eclipse.equinox.launcher.Main.run(Main.java:1169)
>> at org.eclipse.equinox.launcher.Main.main(Main.java:1144)
>> --------------------------------------------
>>
>> If I check the LeonardoDiagramImpl.java file listed on top of the
>> stacktrace it reads:
>>
>> --------------------------------------------
>> ....
>> public EList<Artifact> getArtifacts()
>> {
>> // TODO: implement this method to return the 'Artifacts'
>> containment reference list
>> // Ensure that you remove @generated or mark it @generated NOT
>> // The list is expected to implement
>> org.eclipse.emf.ecore.util.InternalEList and
>> org.eclipse.emf.ecore.EStructuralFeature.Setting
>> // so it's likely that an appropriate subclass of
>> org.eclipse.emf.ecore.util.EcoreEList should be used.
>> throw new UnsupportedOperationException();
>> }
>> ....
>> --------------------------------------------
>>
>>
>> In fact, in that file ALL methods are empty and throw
>> UnsupportedOperationException-s.
>>
>> What's going on here? Isn't GMF supposed to generate all that code???
>> What am I missing here?
>>
>> This is on Europa (base eclipse as well as GMF and all it's
>> prereq's). As I said: this example used to work with a previous GMF
>> version (some 2.0 milestone, but I forgot, which one) using the exact
>> same steps as described above.
>>
>> Michael
>>
|
|
|
Re: GMF generated code throws UnsupportedOperationException?!? [message #156987 is a reply to message #156980] |
Wed, 24 October 2007 13:37 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Michael Moser![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=mmo%40zurich.ibm.com) Messages: 914 Registered: July 2009 |
Senior Member |
|
|
I first went through all .ecore elements and their attributes in the
..ecore model editor and couldn't find anything "volatile" nor
"transient". In the end I threw the .ecore file into my favorite text
editor and fair enough, there were four "eStructuralFeatures" that had
attributes '... volatile="true" transient="true"...', namely all the
node types that I had defined and the diagram root element.
So, no wonder: if this controls the code generation then I understand
that nothing was created. But how these attributes came into being or
rather, why and how and by whom they were ever set to true is beyond
me...
So, I'm apparently a little bit further now with my toy example, but for
some reason the connections aren't properly created. Some are, some are
not... I guess, you can expect another append soon.
Michael
Ed Merks wrote:
> Boris,
>
> That's right, if a feature is set to be volatile, then no variables
> are allocated and all the accessor methods need to be implemented by
> hand.
>
> Boris Blajer wrote:
>> Hi Michael,
>>
>> Actually, it's EMF, not GMF who is responsible for generation of this
>> part. Anyway, I believe this gets generated if the feature is
>> declared to be derived transient or volatile or something like that.
>>
>> Best regards,
>> Boris
>>
>>
>> Michael Moser wrote:
>>> I generated a new GMF project using an existing set of .ecore,
>>> .gmftool, ..gmfgraph and .gmfmap files (BTW: this all used to work
>>> in a previous version of GMF, but - burned by experience with GMF -
>>> I
>>> restarted from scratch just migrating these mentioned files). These
>>> files describe a very simple model that has "artifacts" and
>>> "processes" and connections between them (processes can read and
>>> write artifacts/files, that's about it). The graphical
>>> representations are rectangles and ovals and - of course -
>>> lines/arrows for the connections. The entire thing is just a toy
>>> example to get up and running with GMF.
>>>
>>> I generated the .genmodel and created the model's source and the
>>> .edit and .editor projects. Next I created the diagram editor
>>> .gmfgen file from its three .gmf* input files and from that the
>>> .diagram project. Everything compiles fine. So far, so good.
>>>
>>> When I start these newly created plugins in a runtime workbench I
>>> can create a new project and a new diagram with it (and the palette
>>> etc. all look fine), but when I try to create any graphical object
>>> by selecting the corresponding create tool and then clicking
>>> somewhere on the canvas, absolutely nothing happens.
>>>
>>> Instead, for each click on the canvas there is an exception on the
>>> console:
>>> --------------------------------------------
>>> java.lang.UnsupportedOperationException
>>> at
>>> leonardo2.impl.LeonardoDiagramImpl.getArtifacts(LeonardoDiag ramImpl.java:99)
>>>
>>> at
>>> leonardo2.impl.LeonardoDiagramImpl.eGet(LeonardoDiagramImpl. java:184)
>>> at
>>> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjec tImpl.java:1002)
>>>
>>> at
>>> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjec tImpl.java:994)
>>>
>>> at
>>> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjec tImpl.java:989)
>>>
>>> at
>>> org.eclipse.emf.edit.provider.ItemProviderAdapter.getChildre n(ItemProviderAdapter.java:337)
>>>
>>> at
>>> org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvid er.getChildren(AdapterFactoryContentProvider.java:167)
>>>
>>> at
>>> leonardo2.diagram.navigator.Leonardo2DomainNavigatorContentP rovider.getChildren(Leonardo2DomainNavigatorContentProvider. java:204)
>>>
>>> at
>>> leonardo2.diagram.navigator.Leonardo2DomainNavigatorContentP rovider.hasChildren(Leonardo2DomainNavigatorContentProvider. java:239)
>>>
>>> at
>>> org.eclipse.ui.internal.navigator.extensions.SafeDelegateTre eContentProvider.hasChildren(SafeDelegateTreeContentProvider .java:107)
>>>
>>> at
>>> org.eclipse.ui.internal.navigator.extensions.SafeDelegateTre eContentProvider.hasChildren(SafeDelegateTreeContentProvider .java:292)
>>>
>>> at
>>> org.eclipse.ui.internal.navigator.NavigatorContentServiceCon tentProvider.hasChildren(NavigatorContentServiceContentProvi der.java:662)
>>>
>>> at
>>> org.eclipse.jface.viewers.AbstractTreeViewer.isExpandable(Ab stractTreeViewer.java:2014)
>>>
>>> at
>>> org.eclipse.jface.viewers.TreeViewer.isExpandable(TreeViewer .java:563)
>>> at
>>> org.eclipse.jface.viewers.AbstractTreeViewer.isExpandable(Ab stractTreeViewer.java:2044)
>>>
>>> at
>>> org.eclipse.jface.viewers.AbstractTreeViewer.updatePlus(Abst ractTreeViewer.java:2668)
>>>
>>> at
>>> org.eclipse.jface.viewers.TreeViewer.updatePlus(TreeViewer.j ava:823)
>>> at
>>> org.eclipse.jface.viewers.AbstractTreeViewer.createTreeItem( AbstractTreeViewer.java:807)
>>>
>>> at
>>> org.eclipse.ui.navigator.CommonViewer.createTreeItem(CommonV iewer.java:150)
>>>
>>> at
>>> org.eclipse.jface.viewers.AbstractTreeViewer$1.run(AbstractT reeViewer.java:781)
>>>
>>> at
>>> org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:67)
>>> at
>>> org.eclipse.jface.viewers.AbstractTreeViewer.createChildren( AbstractTreeViewer.java:755)
>>>
>>> at
>>> org.eclipse.jface.viewers.TreeViewer.createChildren(TreeView er.java:615)
>>> at
>>> org.eclipse.jface.viewers.AbstractTreeViewer.handleTreeExpan d(AbstractTreeViewer.java:1407)
>>>
>>> at
>>> org.eclipse.jface.viewers.TreeViewer.handleTreeExpand(TreeVi ewer.java:906)
>>>
>>> at
>>> org.eclipse.jface.viewers.AbstractTreeViewer$4.treeExpanded( AbstractTreeViewer.java:1418)
>>>
>>> at
>>> org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:125)
>>>
>>> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
>>> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
>>> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:962)
>>> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:947)
>>> at org.eclipse.swt.widgets.Tree.wmNotifyChild(Tree.java:7053)
>>> at org.eclipse.swt.widgets.Control.wmNotify(Control.java:4563)
>>> at org.eclipse.swt.widgets.Composite.wmNotify(Composite.java:15 81)
>>> at org.eclipse.swt.widgets.Control.WM_NOTIFY(Control.java:4216)
>>> at org.eclipse.swt.widgets.Control.windowProc(Control.java:3724 )
>>> at org.eclipse.swt.widgets.Display.windowProc(Display.java:4351 )
>>> at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method)
>>> at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:217 8)
>>> at org.eclipse.swt.widgets.Tree.callWindowProc(Tree.java:1541)
>>> at org.eclipse.swt.widgets.Tree.WM_LBUTTONDOWN(Tree.java:5798)
>>> at org.eclipse.swt.widgets.Control.windowProc(Control.java:3705 )
>>> at org.eclipse.swt.widgets.Tree.windowProc(Tree.java:5370)
>>> at org.eclipse.swt.widgets.Display.windowProc(Display.java:4364 )
>>> at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
>>> at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:22 64)
>>> at
>>> org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3291)
>>> at
>>> org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2389)
>>> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353) at
>>> org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 19)
>>> at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
>>> at
>>> org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:289)
>>>
>>> at
>>> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:461)
>>>
>>> at
>>> org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
>>> at
>>> org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:106)
>>>
>>> at
>>> org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:153)
>>>
>>> at
>>> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:106)
>>>
>>> at
>>> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:76)
>>>
>>> at
>>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:363)
>>>
>>> at
>>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:176)
>>>
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> at
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:64)
>>>
>>> at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:43)
>>>
>>> at java.lang.reflect.Method.invoke(Method.java:615)
>>> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 504)
>>> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:443)
>>> at org.eclipse.equinox.launcher.Main.run(Main.java:1169)
>>> at org.eclipse.equinox.launcher.Main.main(Main.java:1144)
>>> --------------------------------------------
>>>
>>> If I check the LeonardoDiagramImpl.java file listed on top of the
>>> stacktrace it reads:
>>>
>>> --------------------------------------------
>>> ....
>>> public EList<Artifact> getArtifacts()
>>> {
>>> // TODO: implement this method to return the 'Artifacts'
>>> containment reference list
>>> // Ensure that you remove @generated or mark it @generated NOT
>>> // The list is expected to implement
>>> org.eclipse.emf.ecore.util.InternalEList and
>>> org.eclipse.emf.ecore.EStructuralFeature.Setting
>>> // so it's likely that an appropriate subclass of
>>> org.eclipse.emf.ecore.util.EcoreEList should be used.
>>> throw new UnsupportedOperationException();
>>> }
>>> ....
>>> --------------------------------------------
>>>
>>>
>>> In fact, in that file ALL methods are empty and throw
>>> UnsupportedOperationException-s.
>>>
>>> What's going on here? Isn't GMF supposed to generate all that
>>> code??? What am I missing here?
>>>
>>> This is on Europa (base eclipse as well as GMF and all it's
>>> prereq's). As I said: this example used to work with a previous GMF
>>> version (some 2.0 milestone, but I forgot, which one) using the
>>> exact same steps as described above.
>>>
>>> Michael
|
|
|
Goto Forum:
Current Time: Sat Aug 17 02:33:22 GMT 2024
Powered by FUDForum. Page generated in 0.03953 seconds
|