Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » emf forms observable updates across threads(modifying emf model observed in two tabs of RAP workbench view)
emf forms observable updates across threads [message #1749187] Fri, 02 December 2016 20:11 Go to next message
Jay Norwood is currently offline Jay NorwoodFriend
Messages: 155
Registered: July 2009
Senior Member
I'm seeing a null pointer exception in SetCommand.java:362 in org.eclipse.emf.edit.command.SetCommand.create, if I use the emf forms editor to change an attribute in a model instance that is being viewed in two tabs. This is in a RAP workbench application.

What is interesting is that when using the programming api, the values are updated in both views without the exception.

I see in some descriptions that these TAB views are each in their own UI thread in RAP. Is that correct?

If so, then this error suggests to me that emf forms observable updates need to be delayed until their individual UI is active. That's just my guess. I'll attach the stack unwind at the exception:

  • Attachment: err.txt
    (Size: 5.11KB, Downloaded 61 times)

[Updated on: Fri, 02 December 2016 20:17]

Report message to a moderator

Re: emf forms observable updates across threads [message #1749283 is a reply to message #1749187] Mon, 05 December 2016 08:26 Go to previous messageGo to next message
Eugen Neufeld is currently offline Eugen NeufeldFriend
Messages: 147
Registered: May 2015
Senior Member
Hi Jay,
How do you create the input data that you pass to emf forms?
For me it looks like your editingdomain is null.

Cheers,
Eugen


--
Eugen Neufeld

Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Re: emf forms observable updates across threads [message #1749438 is a reply to message #1749283] Tue, 06 December 2016 18:07 Go to previous messageGo to next message
Jay Norwood is currently offline Jay NorwoodFriend
Messages: 155
Registered: July 2009
Senior Member
The model instance is loaded from an xmi file.

dsloaded = (Dsense) resource.getContents().get(0);


The list being displayed is cleared, then repopulated. I've tried repopulating the list both directly via emf api calls, or by executing a command to add a list of new items, such as below:

EditingDomain editingDomain = AdapterFactoryEditingDomain.getEditingDomainFor(cameraRecordings);

Command command = AddCommand.create(editingDomain, cameraRecordings, cameraRecordings.getRecordings(),crn.getRecordings());
editingDomain.getCommandStack().execute(command);

These api accesses seem to work ok to modify the model, and the values are updated in the various views with an error.

I get an error, though, if I try to manually edit the class attributes using the emf forms editing dialogs.

However, if I create a copy of the full model for each tab view, using ECoreUtil.copy, then the emf forms dialog editing works without error.

dsense = EcoreUtil.copy(DemoWorkbench.getDsenseInstance());

So, does EcoreUtil.copy have some side-effect wrt the editing domain that would enable the emf forms operation? I was guessing that the problem was that listeners in the other UI threads (per tab) were being notified by the emf forms databinding while the threads were not active.

I'll attempt to make some small example.


Re: emf forms observable updates across threads [message #1749572 is a reply to message #1749438] Thu, 08 December 2016 09:36 Go to previous messageGo to next message
Eugen Neufeld is currently offline Eugen NeufeldFriend
Messages: 147
Registered: May 2015
Senior Member
Hi Jay,
a small example would be great. Could you attach it to a bug report please.
Thank you.

Cheers,
Eugen


--
Eugen Neufeld

Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Re: emf forms observable updates across threads [message #1752454 is a reply to message #1749572] Tue, 24 January 2017 03:02 Go to previous message
Jay Norwood is currently offline Jay NorwoodFriend
Messages: 155
Registered: July 2009
Senior Member
There is info on this type of emf problem here. A couple of solutions were proposed. One using cdo, the other using transactions all within a display thread.

https://javahacks.net/2016/07/13/emf-thread-safety/
Previous Topic:[EMF Client Platform] Building a standalone product out of EMF CP?
Next Topic:[EDapt] Windows filenames are not URIs
Goto Forum:
  


Current Time: Sun Sep 23 08:13:03 GMT 2018

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

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

Back to the top