Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMF Forms] Instance model changes in e4
[EMF Forms] Instance model changes in e4 [message #1753313] Fri, 03 February 2017 17:42 Go to next message
Thorsten Arendt is currently offline Thorsten ArendtFriend
Messages: 18
Registered: June 2013
Junior Member
Hi.
After having integrated an EMF Forms view in my e4 RCP application, I wonder how to set this part as DIRTY when editing and how to PROPAGATE the CHANGES made in the view/editor. Can anybody help? Code snippets or examples would be great.
Thanks, Thorsten
Re: [EMF Forms] Instance model changes in e4 [message #1753419 is a reply to message #1753313] Mon, 06 February 2017 09:13 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 111
Registered: September 2016
Senior Member
Hi,

a simple way of controlling the dirty state would be to enable the dirty state tracking on the resource, which is opened in your editor. Ressource.setModificationTracking(true);
You can then attach an EDapater to the resource to be notified about a call to isModified.
If you already have another EContentAdapter attached to your model, I would rather integrate the dirty tracking there to avoid multiple adapters.

Best regards
Jonas

--
Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/


--
Jonas Helming
Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Re: [EMF Forms] Instance model changes in e4 [message #1753440 is a reply to message #1753419] Mon, 06 February 2017 13:52 Go to previous messageGo to next message
Thorsten Arendt is currently offline Thorsten ArendtFriend
Messages: 18
Registered: June 2013
Junior Member
Hi Jonas.

Thank you for your post. I added the following code to set the dirty flag:

resource.setTrackingModification(true);
EContentAdapter adapter = new EContentAdapter() {
	public void notifyChanged(Notification notification) {
                super.notifyChanged(notification);
                 System.out.println("The object has changed!");
                 dirty.setDirty(true);
        }
};
myEObj.eAdapters().add(adapter);
ECPSWTViewRenderer.INSTANCE.render(content, myEObj);
content.layout();


However, changes in the EMF Forms view/editor to myEObj are not notified! Did I miss something?

Regards, Thorsten
Re: [EMF Forms] Instance model changes in e4 [message #1753509 is a reply to message #1753440] Tue, 07 February 2017 10:55 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 111
Registered: September 2016
Senior Member
Can you set a break point in the Setter in the model of the attribute that you wish to change? Could it be that databinding is set to "on focus out" and that you do not focus out?
About your code: you should use either the resource tracking OR a custom content Adapter. I assume you just added both for testing?

--
Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/


--
Jonas Helming
Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Re: [EMF Forms] Instance model changes in e4 [message #1753522 is a reply to message #1753509] Tue, 07 February 2017 12:41 Go to previous messageGo to next message
Thorsten Arendt is currently offline Thorsten ArendtFriend
Messages: 18
Registered: June 2013
Junior Member
Hi Jonas.

1. Setting the breakpoint verified that the getter is not called when editing the attribute (it is called only during loading the instance).
2. I do not exactly understand what you mean by the databinding advice. As far as I know provides EMF Forms the data binding implicitly when using 'ECPSWTViewRenderer.INSTANCE.render(content, myEObj)', so I did not implement a data binding explicitly.
3. Yes, adding both variants was for testing purposes.
4. The console says the following; maybe it's important:

!ENTRY org.eclipse.equinox.ds 1 0 2017-02-07 13:29:59.501
!MESSAGE Could not bind a reference of component org.eclipse.emfforms.swt.core.rendererfactory. The reference is: Reference[name = EMFFormsAdditionalRendererService, interface = org.eclipse.emfforms.spi.swt.core.EMFFormsAdditionalRendererService, policy = dynamic, cardinality = 0..n, target = null, bind = addEMFFormsAdditionalRendererService, unbind = removeEMFFormsAdditionalRendererService]

!ENTRY org.eclipse.equinox.ds 1 0 2017-02-07 13:29:59.524
!MESSAGE Could not bind a reference of component EMFFormsViewService. The reference is: Reference[name = Provider, interface = org.eclipse.emf.ecp.view.spi.provider.IViewProvider, policy = dynamic, cardinality = 0..n, target = null, bind = addProvider, unbind = removeProvider]


Thorsten
Re: [EMF Forms] Instance model changes in e4 [message #1753626 is a reply to message #1753522] Wed, 08 February 2017 09:39 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 111
Registered: September 2016
Senior Member
Yes, EMF Forms will do the databinding for you. The default trigger is focus out. So in case of a text field, you need to focus out to trigger the change. Have you done that?
Besides that, could you provide a minimal example reproducing this? Data binding is a core feature and usually works out of the box.

--
Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/


--
Jonas Helming
Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Re: [EMF Forms] Instance model changes in e4 [message #1753666 is a reply to message #1753626] Wed, 08 February 2017 16:19 Go to previous message
Thorsten Arendt is currently offline Thorsten ArendtFriend
Messages: 18
Registered: June 2013
Junior Member
Hi Jonas.

I finally solved the problem. There were some missing dependencies/plugins (...emfforms.core.services.databinding...).

Thank you for wasting your time!
Thorsten
Previous Topic:[EMF Forms] Render asynchronously
Next Topic:Genmodel Dynamic Template Empty Class File
Goto Forum:
  


Current Time: Fri Apr 19 20:15:52 GMT 2024

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

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

Back to the top