Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » GWT EMF reflective editor
GWT EMF reflective editor [message #1243107] Mon, 10 February 2014 14:27 Go to next message
Bartek K is currently offline Bartek KFriend
Messages: 9
Registered: February 2014
Junior Member
Hello,

I'm new to both EMF and GWT. I've followed the EMF/GWT tutorial and managed to get it working.

Now my question is - is it possible to run a reflective EMF Editor in GWT?

Thanks!
Re: GWT EMF reflective editor [message #1243218 is a reply to message #1243107] Mon, 10 February 2014 17:31 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Bartek,

Isn't that exactly what you end up with at the end?

On 10/02/2014 4:14 PM, Bartek K wrote:
> Hello,
>
> I'm new to both EMF and GWT. I've followed the
> https://wiki.eclipse.org/EMF/GWT and managed to get it working.
>
> Now my question is - is it possible to run a reflective EMF Editor in
> GWT?
>
> Thanks!


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: GWT EMF reflective editor [message #1249758 is a reply to message #1243218] Tue, 18 February 2014 15:40 Go to previous messageGo to next message
Bartek K is currently offline Bartek KFriend
Messages: 9
Registered: February 2014
Junior Member
Hi Ed,

Thank you for your quick reply and sorry about taking so long to follow up.

Sorry, I was not specific enough. I would like to have an editor that would work with any model (that I could pick) instead of just the generated one that was used in the tutorial. I was wondering if it's available out of the box or would I have to edit the code on my own to make it work?
Re: GWT EMF reflective editor [message #1249763 is a reply to message #1249758] Tue, 18 February 2014 15:47 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Bartek,

The editor used for GWT is completely generic, i.e., it is a reflective
editor.


On 18/02/2014 4:40 PM, Bartek K wrote:
> Hi Ed,
>
> Thank you for your quick reply and sorry about taking so long to
> follow up.
>
> Sorry, I was not specific enough. I would like to have an editor that
> would work with any model (that I could pick) instead of just the
> generated one that was used in the tutorial. I was wondering if it's
> available out of the box or would I have to edit the code on my own to
> make it work?


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: GWT EMF reflective editor [message #1250866 is a reply to message #1249763] Wed, 19 February 2014 17:27 Go to previous messageGo to next message
Bartek K is currently offline Bartek KFriend
Messages: 9
Registered: February 2014
Junior Member
Ed,

OK, I understand, thanks.

I have one more question, then. The tutorial talks about generating an editor plug-in for a given model. However I would like to be able to create new metamodels using the editor in GWT - how would I go about it?
Re: GWT EMF reflective editor [message #1250912 is a reply to message #1250866] Wed, 19 February 2014 18:28 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Bartek,

Comments below.

On 19/02/2014 6:27 PM, Bartek K wrote:
> Ed,
>
> OK, I understand, thanks.
>
> I have one more question, then. The tutorial talks about generating an
> editor plug-in for a given model.
Yes, that just has some registrations in it... Have you looked closely
at the contents of what's generated?
> However I would like to be able to create new metamodels using the
> editor in GWT - how would I go about it?
What do you mean by "new metamodels"? You're not just talking about
using the editor to create and edit instances of some Ecore model you
already have?


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: GWT EMF reflective editor [message #1250932 is a reply to message #1250912] Wed, 19 February 2014 18:55 Go to previous messageGo to next message
Bartek K is currently offline Bartek KFriend
Messages: 9
Registered: February 2014
Junior Member
Ed,

I've added comments below.

Ed Merks wrote on Wed, 19 February 2014 13:28
>Bartek,
>
>Comments below.
>
>On 19/02/2014 6:27 PM, Bartek K wrote:
>> Ed,
>>
>> OK, I understand, thanks.
>>
>> I have one more question, then. The tutorial talks about generating an
>> editor plug-in for a given model.
>Yes, that just has some registrations in it... Have you looked closely
>at the contents of what's generated?

Yes, I've had a look at what's generated - there's not much but from what I understand the Ecore model is registered (as you just said).

>> However I would like to be able to create new metamodels using the
>> editor in GWT - how would I go about it?
>What do you mean by "new metamodels"? You're not just talking about
>using the editor to create and edit instances of some Ecore model you
>already have?

Yes, that's it. I'm wondering if it's possible to create a new Ecore model using the EMF editor and GWT.
Re: GWT EMF reflective editor [message #1250982 is a reply to message #1250932] Wed, 19 February 2014 20:09 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Bartek,

The reflective editor should work for Ecore as well.

On 19/02/2014 7:55 PM, Bartek K wrote:
> Ed,
>
> I've added comments below.
>
> Ed Merks wrote on Wed, 19 February 2014 13:28
>> Bartek,
>>
>> Comments below.
>>
>> On 19/02/2014 6:27 PM, Bartek K wrote:
>>> Ed,
>>>
>>> OK, I understand, thanks.
>>>
>>> I have one more question, then. The tutorial talks about generating
>>> an editor plug-in for a given model.
>> Yes, that just has some registrations in it... Have you looked
>> closely at the contents of what's generated?
>
> Yes, I've had a look at what's generated - there's not much but from
> what I understand the Ecore model is registered (as you just said).
>
>>> However I would like to be able to create new metamodels using the
>>> editor in GWT - how would I go about it?
>> What do you mean by "new metamodels"? You're not just talking about
>> using the editor to create and edit instances of some Ecore model you
>> already have?
>
> Yes, that's it. I'm wondering if it's possible to create a new Ecore
> model using the EMF editor and GWT.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: GWT EMF reflective editor [message #1254651 is a reply to message #1250982] Sun, 23 February 2014 17:01 Go to previous messageGo to next message
Bartek K is currently offline Bartek KFriend
Messages: 9
Registered: February 2014
Junior Member
Hi Ed,

I've tried the following two approaches.

1. I followed the tutorial and used platform:/plugin/org.eclipse.emf.ecore/model/Ecore.xsd as the path for the model. That was fine until I generated the model, edit and editor plugins - after that there are over a hundred errors in the model and editor plugins. Using Ecore.ecore makes it better but there are still 18 errors that don't seem straightforward to solve.

Have you ever attempted this approach? Did it work previously?

2. I followed the tutorial and edited the LibraryEditorEntryPoint.java file in the editor plugin to use the EcorePackage and EcoreAdapterFactory (also tried ReflectiveItemProviderAdapterFactory). This looks promising though there are a few glitches.
The main one is an "Uncaught exception escaped" which happens when I click on (select) an instance of EAttribute, EClass, EDataType, EEnum or EReference. Due to that the properties part of the display is not rendered correctly.

16:36:57.838 [ERROR] [org.eclipse.example.library.LibraryEditor] Uncaught exception escaped
com.google.gwt.event.shared.UmbrellaException: Exception caught: null
    at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:129)
    at com.google.gwt.view.client.SelectionModel$AbstractSelectionModel.fireEvent(SelectionModel.java:72)
    at com.google.gwt.view.client.SelectionChangeEvent.fire(SelectionChangeEvent.java:70)
    at com.google.gwt.view.client.SingleSelectionModel.resolveChanges(SingleSelectionModel.java:140)
    at com.google.gwt.view.client.SingleSelectionModel.isSelected(SingleSelectionModel.java:82)
    at com.google.gwt.user.cellview.client.HasDataPresenter.resolvePendingState(HasDataPresenter.java:1221)
    at com.google.gwt.user.cellview.client.HasDataPresenter.access$3(HasDataPresenter.java:1062)
    at com.google.gwt.user.cellview.client.HasDataPresenter$2.execute(HasDataPresenter.java:984)
    at com.google.gwt.core.client.impl.SchedulerImpl$Task$.executeScheduled$(SchedulerImpl.java:50)
    at com.google.gwt.core.client.impl.SchedulerImpl.runScheduledTasks(SchedulerImpl.java:180)
    at com.google.gwt.core.client.impl.SchedulerImpl.flushFinallyCommands(SchedulerImpl.java:279)
    at com.google.gwt.core.client.impl.Impl.exit(Impl.java:266)
    at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:257)
    at sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
    at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
    at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.NullPointerException: null
    at org.eclipse.emf.ecore.impl.EFactoryImpl.convertToString(EFactoryImpl.java:689)
    at org.eclipse.emf.ecore.impl.EcoreFactoryImpl.convertEJavaObjectToString(EcoreFactoryImpl.java:886)
    at org.eclipse.emf.ecore.impl.EcoreFactoryImpl.convertToString(EcoreFactoryImpl.java:195)
    at org.eclipse.emf.ecore.util.EcoreUtil.convertToString(EcoreUtil.java:3350)
    at org.eclipse.emf.edit.ui.EditorEntryPoint$10$16.run(EditorEntryPoint.java:1011)
    at org.eclipse.emf.edit.ui.EditorEntryPoint$10.onSelectionChange(EditorEntryPoint.java:1018)
    at com.google.gwt.view.client.SelectionChangeEvent.dispatch(SelectionChangeEvent.java:99)
    at com.google.gwt.view.client.SelectionChangeEvent.dispatch(SelectionChangeEvent.java:1)
    at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
    at com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40)
    at com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193)
    at com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:88)
    at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:127)
    at com.google.gwt.view.client.SelectionModel$AbstractSelectionModel.fireEvent(SelectionModel.java:72)
    at com.google.gwt.view.client.SelectionChangeEvent.fire(SelectionChangeEvent.java:70)
    at com.google.gwt.view.client.SingleSelectionModel.resolveChanges(SingleSelectionModel.java:140)
    at com.google.gwt.view.client.SingleSelectionModel.isSelected(SingleSelectionModel.java:82)
    at com.google.gwt.user.cellview.client.HasDataPresenter.resolvePendingState(HasDataPresenter.java:1221)
    at com.google.gwt.user.cellview.client.HasDataPresenter.access$3(HasDataPresenter.java:1062)
    at com.google.gwt.user.cellview.client.HasDataPresenter$2.execute(HasDataPresenter.java:984)
    at com.google.gwt.core.client.impl.SchedulerImpl$Task$.executeScheduled$(SchedulerImpl.java:50)
    at com.google.gwt.core.client.impl.SchedulerImpl.runScheduledTasks(SchedulerImpl.java:180)
    at com.google.gwt.core.client.impl.SchedulerImpl.flushFinallyCommands(SchedulerImpl.java:279)
    at com.google.gwt.core.client.impl.Impl.exit(Impl.java:266)
    at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:257)
    at sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
    at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
    at java.lang.Thread.run(Thread.java:744)

When one of the above objects is created the following error is printed
16:55:41.250 [ERROR] [org.eclipse.example.library.LibraryEditor] Uncaught exception escaped
com.google.gwt.event.shared.UmbrellaException: Exception caught: null
    at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:129)
    at com.google.gwt.view.client.SelectionModel$AbstractSelectionModel.fireEvent(SelectionModel.java:72)
    at com.google.gwt.view.client.SelectionChangeEvent.fire(SelectionChangeEvent.java:70)
    at com.google.gwt.view.client.SingleSelectionModel.resolveChanges(SingleSelectionModel.java:140)
    at com.google.gwt.view.client.SingleSelectionModel.isSelected(SingleSelectionModel.java:82)
    at com.google.gwt.user.cellview.client.HasDataPresenter.resolvePendingState(HasDataPresenter.java:1221)
    at com.google.gwt.user.cellview.client.HasDataPresenter.access$3(HasDataPresenter.java:1062)
    at com.google.gwt.user.cellview.client.HasDataPresenter$2.execute(HasDataPresenter.java:984)
    at com.google.gwt.core.client.impl.SchedulerImpl$Task$.executeScheduled$(SchedulerImpl.java:50)
    at com.google.gwt.core.client.impl.SchedulerImpl.runScheduledTasks(SchedulerImpl.java:180)
    at com.google.gwt.core.client.impl.SchedulerImpl.flushFinallyCommands(SchedulerImpl.java:279)
    at com.google.gwt.core.client.impl.Impl.exit(Impl.java:266)
    at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:257)
    at sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
    at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
    at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.NullPointerException: null
    at org.eclipse.emf.ecore.impl.EFactoryImpl.convertToString(EFactoryImpl.java:689)
    at org.eclipse.emf.ecore.impl.EcoreFactoryImpl.convertEJavaObjectToString(EcoreFactoryImpl.java:886)
    at org.eclipse.emf.ecore.impl.EcoreFactoryImpl.convertToString(EcoreFactoryImpl.java:195)
    at org.eclipse.emf.ecore.util.EcoreUtil.convertToString(EcoreUtil.java:3350)
    at org.eclipse.emf.edit.ui.EditorEntryPoint$10$16.run(EditorEntryPoint.java:1011)
    at org.eclipse.emf.edit.ui.EditorEntryPoint$10.onSelectionChange(EditorEntryPoint.java:1018)
    at com.google.gwt.view.client.SelectionChangeEvent.dispatch(SelectionChangeEvent.java:99)
    at com.google.gwt.view.client.SelectionChangeEvent.dispatch(SelectionChangeEvent.java:1)
    at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
    at com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40)
    at com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193)
    at com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:88)
    at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:127)
    at com.google.gwt.view.client.SelectionModel$AbstractSelectionModel.fireEvent(SelectionModel.java:72)
    at com.google.gwt.view.client.SelectionChangeEvent.fire(SelectionChangeEvent.java:70)
    at com.google.gwt.view.client.SingleSelectionModel.resolveChanges(SingleSelectionModel.java:140)
    at com.google.gwt.view.client.SingleSelectionModel.isSelected(SingleSelectionModel.java:82)
    at com.google.gwt.user.cellview.client.HasDataPresenter.resolvePendingState(HasDataPresenter.java:1221)
    at com.google.gwt.user.cellview.client.HasDataPresenter.access$3(HasDataPresenter.java:1062)
    at com.google.gwt.user.cellview.client.HasDataPresenter$2.execute(HasDataPresenter.java:984)
    at com.google.gwt.core.client.impl.SchedulerImpl$Task$.executeScheduled$(SchedulerImpl.java:50)
    at com.google.gwt.core.client.impl.SchedulerImpl.runScheduledTasks(SchedulerImpl.java:180)
    at com.google.gwt.core.client.impl.SchedulerImpl.flushFinallyCommands(SchedulerImpl.java:279)
    at com.google.gwt.core.client.impl.Impl.exit(Impl.java:266)
    at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:257)
    at sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
    at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
    at java.lang.Thread.run(Thread.java:744)

Do you know what the underlying cause is? I'd be grateful if you could point me in the right direction.

Thanks,
Bartek
Re: GWT EMF reflective editor [message #1255160 is a reply to message #1254651] Mon, 24 February 2014 06:28 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Bartek,

Comments below.

On 23/02/2014 6:01 PM, Bartek K wrote:
> Hi Ed,
>
> I've tried the following two approaches.
>
> 1. I followed the tutorial and used
> platform:/plugin/org.eclipse.emf.ecore/model/Ecore.xsd as the path for
> the model. That was fine until I generated the model, edit and editor
> plugins - after that there are over a hundred errors in the model and
> editor plugins. Using Ecore.ecore makes it better but there are still
> 18 errors that don't seem straightforward to solve.
The Ecore model already exists, so you should use the existing model and
edit bundles.
>
> Have you ever attempted this approach? Did it work previously?
>
> 2. I followed the tutorial and edited the LibraryEditorEntryPoint.java
> file in the editor plugin to use the EcorePackage and
> EcoreAdapterFactory (also tried ReflectiveItemProviderAdapterFactory).
> This looks promising though there are a few glitches.
That makes more sense.
> The main one is an "Uncaught exception escaped" which happens when I
> click on (select) an instance of EAttribute, EClass, EDataType, EEnum
> or EReference. Due to that the properties part of the display is not
> rendered correctly.
>
> 16:36:57.838 [ERROR] [org.eclipse.example.library.LibraryEditor]
> Uncaught exception escaped
> com.google.gwt.event.shared.UmbrellaException: Exception caught: null
> at
> com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:129)
> at
> com.google.gwt.view.client.SelectionModel$AbstractSelectionModel.fireEvent(SelectionModel.java:72)
> at
> com.google.gwt.view.client.SelectionChangeEvent.fire(SelectionChangeEvent.java:70)
> at
> com.google.gwt.view.client.SingleSelectionModel.resolveChanges(SingleSelectionModel.java:140)
> at
> com.google.gwt.view.client.SingleSelectionModel.isSelected(SingleSelectionModel.java:82)
> at
> com.google.gwt.user.cellview.client.HasDataPresenter.resolvePendingState(HasDataPresenter.java:1221)
> at
> com.google.gwt.user.cellview.client.HasDataPresenter.access$3(HasDataPresenter.java:1062)
> at
> com.google.gwt.user.cellview.client.HasDataPresenter$2.execute(HasDataPresenter.java:984)
> at
> com.google.gwt.core.client.impl.SchedulerImpl$Task$.executeScheduled$(SchedulerImpl.java:50)
> at
> com.google.gwt.core.client.impl.SchedulerImpl.runScheduledTasks(SchedulerImpl.java:180)
> at
> com.google.gwt.core.client.impl.SchedulerImpl.flushFinallyCommands(SchedulerImpl.java:279)
> at com.google.gwt.core.client.impl.Impl.exit(Impl.java:266)
> at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:257)
> at sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:606)
> at
> com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
> at
> com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
> at
> com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
> at
> com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293)
> at
> com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)
> at
> com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
> at java.lang.Thread.run(Thread.java:744)
> Caused by: java.lang.NullPointerException: null
> at
> org.eclipse.emf.ecore.impl.EFactoryImpl.convertToString(EFactoryImpl.java:689)
> at
> org.eclipse.emf.ecore.impl.EcoreFactoryImpl.convertEJavaObjectToString(EcoreFactoryImpl.java:886)
> at
> org.eclipse.emf.ecore.impl.EcoreFactoryImpl.convertToString(EcoreFactoryImpl.java:195)
> at
> org.eclipse.emf.ecore.util.EcoreUtil.convertToString(EcoreUtil.java:3350)
> at
> org.eclipse.emf.edit.ui.EditorEntryPoint$10$16.run(EditorEntryPoint.java:1011)
> at
> org.eclipse.emf.edit.ui.EditorEntryPoint$10.onSelectionChange(EditorEntryPoint.java:1018)
> at
> com.google.gwt.view.client.SelectionChangeEvent.dispatch(SelectionChangeEvent.java:99)
> at
> com.google.gwt.view.client.SelectionChangeEvent.dispatch(SelectionChangeEvent.java:1)
> at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
> at
> com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40)
> at
> com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193)
> at
> com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:88)
> at
> com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:127)
> at
> com.google.gwt.view.client.SelectionModel$AbstractSelectionModel.fireEvent(SelectionModel.java:72)
> at
> com.google.gwt.view.client.SelectionChangeEvent.fire(SelectionChangeEvent.java:70)
> at
> com.google.gwt.view.client.SingleSelectionModel.resolveChanges(SingleSelectionModel.java:140)
> at
> com.google.gwt.view.client.SingleSelectionModel.isSelected(SingleSelectionModel.java:82)
> at
> com.google.gwt.user.cellview.client.HasDataPresenter.resolvePendingState(HasDataPresenter.java:1221)
> at
> com.google.gwt.user.cellview.client.HasDataPresenter.access$3(HasDataPresenter.java:1062)
> at
> com.google.gwt.user.cellview.client.HasDataPresenter$2.execute(HasDataPresenter.java:984)
> at
> com.google.gwt.core.client.impl.SchedulerImpl$Task$.executeScheduled$(SchedulerImpl.java:50)
> at
> com.google.gwt.core.client.impl.SchedulerImpl.runScheduledTasks(SchedulerImpl.java:180)
> at
> com.google.gwt.core.client.impl.SchedulerImpl.flushFinallyCommands(SchedulerImpl.java:279)
> at com.google.gwt.core.client.impl.Impl.exit(Impl.java:266)
> at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:257)
> at sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:606)
> at
> com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
> at
> com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
> at
> com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
> at
> com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293)
> at
> com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)
> at
> com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
> at java.lang.Thread.run(Thread.java:744)
> When one of the above objects is created the following error is printed
> 16:55:41.250 [ERROR] [org.eclipse.example.library.LibraryEditor]
> Uncaught exception escaped
> com.google.gwt.event.shared.UmbrellaException: Exception caught: null
> at
> com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:129)
> at
> com.google.gwt.view.client.SelectionModel$AbstractSelectionModel.fireEvent(SelectionModel.java:72)
> at
> com.google.gwt.view.client.SelectionChangeEvent.fire(SelectionChangeEvent.java:70)
> at
> com.google.gwt.view.client.SingleSelectionModel.resolveChanges(SingleSelectionModel.java:140)
> at
> com.google.gwt.view.client.SingleSelectionModel.isSelected(SingleSelectionModel.java:82)
> at
> com.google.gwt.user.cellview.client.HasDataPresenter.resolvePendingState(HasDataPresenter.java:1221)
> at
> com.google.gwt.user.cellview.client.HasDataPresenter.access$3(HasDataPresenter.java:1062)
> at
> com.google.gwt.user.cellview.client.HasDataPresenter$2.execute(HasDataPresenter.java:984)
> at
> com.google.gwt.core.client.impl.SchedulerImpl$Task$.executeScheduled$(SchedulerImpl.java:50)
> at
> com.google.gwt.core.client.impl.SchedulerImpl.runScheduledTasks(SchedulerImpl.java:180)
> at
> com.google.gwt.core.client.impl.SchedulerImpl.flushFinallyCommands(SchedulerImpl.java:279)
> at com.google.gwt.core.client.impl.Impl.exit(Impl.java:266)
> at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:257)
> at sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:606)
> at
> com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
> at
> com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
> at
> com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
> at
> com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293)
> at
> com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)
> at
> com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
> at java.lang.Thread.run(Thread.java:744)
> Caused by: java.lang.NullPointerException: null
> at
> org.eclipse.emf.ecore.impl.EFactoryImpl.convertToString(EFactoryImpl.java:689)
> at
> org.eclipse.emf.ecore.impl.EcoreFactoryImpl.convertEJavaObjectToString(EcoreFactoryImpl.java:886)
> at
> org.eclipse.emf.ecore.impl.EcoreFactoryImpl.convertToString(EcoreFactoryImpl.java:195)
> at
> org.eclipse.emf.ecore.util.EcoreUtil.convertToString(EcoreUtil.java:3350)
> at
> org.eclipse.emf.edit.ui.EditorEntryPoint$10$16.run(EditorEntryPoint.java:1011)
> at
> org.eclipse.emf.edit.ui.EditorEntryPoint$10.onSelectionChange(EditorEntryPoint.java:1018)
> at
> com.google.gwt.view.client.SelectionChangeEvent.dispatch(SelectionChangeEvent.java:99)
> at
> com.google.gwt.view.client.SelectionChangeEvent.dispatch(SelectionChangeEvent.java:1)
> at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
> at
> com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40)
> at
> com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193)
> at
> com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:88)
> at
> com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:127)
> at
> com.google.gwt.view.client.SelectionModel$AbstractSelectionModel.fireEvent(SelectionModel.java:72)
> at
> com.google.gwt.view.client.SelectionChangeEvent.fire(SelectionChangeEvent.java:70)
> at
> com.google.gwt.view.client.SingleSelectionModel.resolveChanges(SingleSelectionModel.java:140)
> at
> com.google.gwt.view.client.SingleSelectionModel.isSelected(SingleSelectionModel.java:82)
> at
> com.google.gwt.user.cellview.client.HasDataPresenter.resolvePendingState(HasDataPresenter.java:1221)
> at
> com.google.gwt.user.cellview.client.HasDataPresenter.access$3(HasDataPresenter.java:1062)
> at
> com.google.gwt.user.cellview.client.HasDataPresenter$2.execute(HasDataPresenter.java:984)
> at
> com.google.gwt.core.client.impl.SchedulerImpl$Task$.executeScheduled$(SchedulerImpl.java:50)
> at
> com.google.gwt.core.client.impl.SchedulerImpl.runScheduledTasks(SchedulerImpl.java:180)
> at
> com.google.gwt.core.client.impl.SchedulerImpl.flushFinallyCommands(SchedulerImpl.java:279)
> at com.google.gwt.core.client.impl.Impl.exit(Impl.java:266)
> at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:257)
> at sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:606)
> at
> com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
> at
> com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
> at
> com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
> at
> com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293)
> at
> com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)
> at
> com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
> at java.lang.Thread.run(Thread.java:744)
> Do you know what the underlying cause is?
I never figured out a way to support serializing arbitrary Java objects;
the hacked "TODO" code doesn't handle null well. There are no property
descriptor for the Ecore feature's that use EJavaObject, and those
features are transient, so I'm surprised this situation arises...
> I'd be grateful if you could point me in the right direction.
Are you sure that the specialized generated Ecore item providers are
being used, and not the general ReflectiveItemProvider?
>
> Thanks,
> Bartek


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: GWT EMF reflective editor [message #1255382 is a reply to message #1255160] Mon, 24 February 2014 11:30 Go to previous messageGo to next message
Bartek K is currently offline Bartek KFriend
Messages: 9
Registered: February 2014
Junior Member
Ed,

In org.eclipse.emf.edit.ui.EditorEntryPoint.class there is the following line at the very start of the onModuleLoad() method
composedAdapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
so I assume this may be the culprit. However I'm not sure how to go about editing the source code of the plugin. I tried importing it into my workspace but then I it contained numerous errors. Do I have to follow the instructions from the wiki article Setting up a development environment or is there an easier way? I realise this may be a trivial issue but I couldn't find an answer. In the future I will also want to edit further plugin files (I'd like to change the way the instantiated models are stored), not sure if that affects the approach.
Re: GWT EMF reflective editor [message #1255390 is a reply to message #1255382] Mon, 24 February 2014 11:42 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Bartek,

So you mean this code:

public void onModuleLoad()
{
ComposedAdapterFactory composedAdapterFactory = new
ComposedAdapterFactory();
composedAdapterFactory.addAdapterFactory(new
ResourceItemProviderAdapterFactory());
configureItemProviderAdapterFactories(composedAdapterFactory);
composedAdapterFactory.addAdapterFactory(new
ReflectiveItemProviderAdapterFactory());

If you create a derived class, you can specialize
org.eclipse.emf.edit.ui.EditorEntryPoint.configureItemProviderAdapterFactories(ComposedAdapterFactory)
so that it adds the EcoreItemProviderAdapterFactory before the
reflective one, which should result in that being used instead of the
reflective one, which in turn should ensure that there are no property
descriptors for features of type EJavaObject.


On 24/02/2014 12:30 PM, Bartek K wrote:
> Ed,
>
> In org.eclipse.emf.edit.ui.EditorEntryPoint.class there is the
> following line at the very start of the onModuleLoad() method
> composedAdapterFactory.addAdapterFactory(new
> ReflectiveItemProviderAdapterFactory());so I assume this may be the
> culprit. However I'm not sure how to go about editing the source code
> of the plugin. I tried importing it into my workspace but then I it
> contained numerous errors. Do I have to follow the instructions from
> the wiki article
> https://wiki.eclipse.org/EMF/Setting_up_a_development_environment or
> is there an easier way? I realise this may be a trivial issue but I
> couldn't find an answer. In the future I will also want to edit
> further plugin files (I'd like to change the way the instantiated
> models are stored), not sure if that affects the approach.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: GWT EMF reflective editor [message #1255461 is a reply to message #1255390] Mon, 24 February 2014 13:13 Go to previous messageGo to next message
Bartek K is currently offline Bartek KFriend
Messages: 9
Registered: February 2014
Junior Member
Ed,

Yes (I should've included those lines as well).

You're right, there's no need to edit the plugin, I got a little confused.

I already have a derived class and at the moment I add the EcoreAdapterFactory which may explain why the errors described in the previous post arise.
public class LibraryEditorEntryPoint extends EditorEntryPoint {
	
	@Override
	public void onModuleLoad() {
		super.onModuleLoad();
	}

	@Override
	protected void registerPackages(EPackage.Registry packageRegistry) {
		packageRegistry.put(EcorePackage.eNS_URI, EcorePackage.eINSTANCE);
	}

	@Override
	protected void configureItemProviderAdapterFactories(ComposedAdapterFactory adapterFactory) {
		adapterFactory.addAdapterFactory(new EcoreAdapterFactory());
	}

	@Override
	protected String getApplicationTitle() {
		return "Ecore Application";
	}
}

I don't seem to be able to use EcoreItemProviderAdapterFactory. I can't find it in the list of types that implement org.eclipse.emf.common.notify.impl.AdapterFactoryImpl.

I searched for it and the documentation for 2.9.0 is empty whereas documentation for 2.8.0 has all the methods described. Further Grepcode search confirmed my doubts - EcoreItemProviderAdapterFactory does not seem to be present in 2.9.0.

I changed my target platform to use the 2.8 release site but it did not help - I am still unable to use EcoreItemProviderAdapterFactory (it cannot be resolved to a type).
Re: GWT EMF reflective editor [message #1255543 is a reply to message #1255461] Mon, 24 February 2014 15:01 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Bartek,

Comments below.

On 24/02/2014 2:13 PM, Bartek K wrote:
> Ed,
>
> Yes (I should've included those lines as well).
>
> You're right, there's no need to edit the plugin, I got a little
> confused.
>
> I already have a derived class and at the moment I add the
> EcoreAdapterFactory which may explain why the errors described in the
> previous post arise.public class LibraryEditorEntryPoint extends
> EditorEntryPoint {
>
> @Override
> public void onModuleLoad() {
> super.onModuleLoad();
> }
>
> @Override
> protected void registerPackages(EPackage.Registry packageRegistry) {
> packageRegistry.put(EcorePackage.eNS_URI,
> EcorePackage.eINSTANCE);
> }
>
> @Override
> protected void
> configureItemProviderAdapterFactories(ComposedAdapterFactory
> adapterFactory) {
> adapterFactory.addAdapterFactory(new EcoreAdapterFactory());
It has to be EcoreItemProviderAdapterFactory...
> }
>
> @Override
> protected String getApplicationTitle() {
> return "Ecore Application";
> }
> }
> I don't seem to be able to use EcoreItemProviderAdapterFactory. I
> can't find it in the list of types that implement
> org.eclipse.emf.common.notify.impl.AdapterFactoryImpl.
Probably because you've not added a dependency on that plugin to any
project in your workspace. If you add org.eclipse.emf.gwt.ecore.edit as
a dependency in the MANIFEST.MF of your editor bundle, you should be
able to use the classes it provided.
>
> I searched for it and the
> http://download.eclipse.org/modeling/emf/emf/javadoc/2.9.0/org/eclipse/emf/ecore/provider/EcoreItemProviderAdapterFactory.html
> is empty whereas documentation for 2.8.0 has all the methods
> described. Further
> http://grepcode.com/search?query=EcoreItemProviderAdapterFactory&n=
> confirmed my doubts - EcoreItemProviderAdapterFactory does not seem to
> be present in 2.9.0.
That's strange.
>
> I changed my target platform to use the 2.8 release site but it did
> not help - I am still unable to use EcoreItemProviderAdapterFactory
> (it cannot be resolved to a type).
Another useful trick is to show the Plug-ins view, select all the
plugins, and then, from the context menu, invoke "Add to Java Search".
Then Ctrl-Shift-T will find any class in any plugin, including in
plugins you don't have any dependencies on yet. It will also show a
more complete type hierarchy to include the classes in those plugins.
It definitely should be there. Be sure to use the versions with "gwt"
in the bundle IDs.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: GWT EMF reflective editor [message #1255668 is a reply to message #1255543] Mon, 24 February 2014 17:54 Go to previous messageGo to next message
Bartek K is currently offline Bartek KFriend
Messages: 9
Registered: February 2014
Junior Member
Ed,

Thank you for your help. I've sorted out dependencies now and adding the plugin classes to Java search was really useful.

Unfortunately, using EcoreItemProviderAdapterFactory did not help - the uncaught exception is still there. On top of that, a new problem was introduced.
Namely, when I select a resource and try to create a new object, there are either no class names or "null"s (i.e. "new ", "new null()", "new null" etc). It doesn't happen, though, when an object is selected first.

This is the code that adds items to the list of objects that can be created when a resource is selected (org.eclipse.emf.edit.ui.EditorEntryPoint.class, lines 1204-1225)
final Resource resource = (Resource)selection;
final DialogBox dialogBox = new DialogBox();
dialogBox.setText("Create Object");
final ListBox listBox = new ListBox();
listBox.setVisibleItemCount(1);
Registry packageRegistry = resourceSet.getPackageRegistry();
for (String nsURI : packageRegistry.keySet())
{
  EPackage ePackage = packageRegistry.getEPackage(nsURI);
  for (EClassifier eClassifier : ePackage.getEClassifiers())
  {
    if (eClassifier instanceof EClass)
    {
      EClass eClass = (EClass)eClassifier;
      if (!eClass.isAbstract())
      {
        EObject eObject = EcoreUtil.create(eClass);
        listBox.addItem("New " + itemDelegator.getText(eObject), EcoreUtil.getURI(eClass).toString());
      }
    }
  }
}
Re: GWT EMF reflective editor [message #1255679 is a reply to message #1255668] Mon, 24 February 2014 18:08 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Bartek,

Comments below.

On 24/02/2014 6:54 PM, Bartek K wrote:
> Ed,
>
> Thank you for your help. I've sorted out dependencies now and adding
> the plugin classes to Java search was really useful.
>
> Unfortunately, using EcoreItemProviderAdapterFactory did not help -
> the uncaught exception is still there.
I assume you're sure you picked the GWT version of that bundle...

It's been so long since I've set up a functional GWT environment I'm not
in a good position to test this myself... The best I can suggest is
setting breakpoints to ensure that the proper delegation is
happening. I.e., in
org.eclipse.emf.edit.ui.EditorEntryPoint.onModuleLoad().new Handler()
{...}.onSelectionChange(SelectionChangeEvent) see what's happening in
the following logic in the debugger

List<IItemPropertyDescriptor> propertyDescriptors =
itemDelegator.getPropertyDescriptors(object);

It should end up in a method like
org.eclipse.emf.ecore.provider.EAttributeItemProvider.getPropertyDescriptors(Object),
assuming you've selected an EAttribute.

> On top of that, a new problem was introduced.
> Namely, when I select a resource and try to create a new object, there
> are either no class names or "null"s (i.e. "new ", "new null()", "new
> null" etc). It doesn't happen, though, when an object is selected first.
>
> This is the code that adds items to the list of objects that can be
> created when a resource is selected
> (org.eclipse.emf.edit.ui.EditorEntryPoint.class, lines 1204-1225)
> final Resource resource = (Resource)selection;
> final DialogBox dialogBox = new DialogBox();
> dialogBox.setText("Create Object");
> final ListBox listBox = new ListBox();
> listBox.setVisibleItemCount(1);
> Registry packageRegistry = resourceSet.getPackageRegistry();
> for (String nsURI : packageRegistry.keySet())
> {
> EPackage ePackage = packageRegistry.getEPackage(nsURI);
> for (EClassifier eClassifier : ePackage.getEClassifiers())
> {
> if (eClassifier instanceof EClass)
> {
> EClass eClass = (EClass)eClassifier;
> if (!eClass.isAbstract())
> {
> EObject eObject = EcoreUtil.create(eClass);
> listBox.addItem("New " + itemDelegator.getText(eObject),
> EcoreUtil.getURI(eClass).toString());
Hmmm. This should still end up delegating to the reflective item
provider as before.
> }
> }
> }
> }


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: GWT EMF reflective editor [message #1256484 is a reply to message #1255679] Tue, 25 February 2014 13:34 Go to previous message
Bartek K is currently offline Bartek KFriend
Messages: 9
Registered: February 2014
Junior Member
Ed Merks wrote on Mon, 24 February 2014 13:08
I assume you're sure you picked the GWT version of that bundle...

Yes. In my target platform there are only the GWT versions of the plugins.

Ed Merks wrote on Mon, 24 February 2014 13:08
It's been so long since I've set up a functional GWT environment I'm not
in a good position to test this myself... The best I can suggest is
setting breakpoints to ensure that the proper delegation is
happening. I.e., in
org.eclipse.emf.edit.ui.EditorEntryPoint.onModuleLoad().new Handler()
{...}.onSelectionChange(SelectionChangeEvent) see what's happening in
the following logic in the debugger

List<IItemPropertyDescriptor> propertyDescriptors =
itemDelegator.getPropertyDescriptors(object);

It should end up in a method like
org.eclipse.emf.ecore.provider.EAttributeItemProvider.getPropertyDescriptors(Object),
assuming you've selected an EAttribute.

I've traced the calls and delegation works properly. When I select an EAttribute, a call to org.eclipse.emf.ecore.provider.EAttributeItemProvider.getPropertyDescriptors(Object) is made. When I select an EClass, a call to org.eclipse.emf.ecore.provider.EClassItemProvider.getPropertyDescriptors(Object) is made etc.

The exception only happens when an object has a "default value" feature. Its eDataType is EJAVA_OBJECT as opposed to ESTRING for the other features. In consequence, the null value is used in "instanceValue.toString()" which obviously throws a NullPointerException. ESTRINGs are cast to String which is fine.

I don't really know where to go from here, though.
Previous Topic:Loading twice the same xmi file
Next Topic:Merging metamodel and metadata
Goto Forum:
  


Current Time: Thu Apr 25 05:53:50 GMT 2024

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

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

Back to the top