Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMF Forms] Text field to property binding issue on Mac OSX / Cocoa
[EMF Forms] Text field to property binding issue on Mac OSX / Cocoa [message #1718745] Tue, 29 December 2015 16:50 Go to next message
Erwin De Ley is currently offline Erwin De LeyFriend
Messages: 52
Registered: August 2013
Member
I have integrated EMF Forms with a Graphiti graphical editor, to provide configuration dialogs for diagram elements, or more correctly for the backing business/domain objects.

Versions are from Mars.1.

This works nicely on MS Windows, CentOS etc.

But on Mac OSX with SWT Cocoa, the binding from changed values in a text field towards the underlying EMF model properties is not working in the case of a form with just 1 text field, wrapped in a dialog with a close button.

While debugging on windows, we noticed that the property update is applied ( via a call to eSet() etc) based on a focus event triggered on the text field, when clicking on the dialog's close button, or navigating to it with a TAB-click.

On OSX we don't see this focus event being triggered at that moment. But when clicking outside of the RCP GUI it does happen.

Also when the form has multiple text fields (properties), the focus lost event gets triggered when jumping to the next field and the property update is done.

Is this a known issue with button focus events in EMF Forms? Or in SWT underneath?

I searched for problems for SWT and EMF Forms on OSX, but could not find something similar.

I am now considering triggering the update from the dialog closure for such cases, but that would be annoying as it would force me to develop exception logic for 1-field forms...

thanks
erwin
Re: [EMF Forms] Text field to property binding issue on Mac OSX / Cocoa [message #1718773 is a reply to message #1718745] Wed, 30 December 2015 05:11 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 31151
Registered: July 2009
Senior Member
Erwin,

Although perhaps not directly related, the problem reminds me of this bug:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=383750

On 29/12/2015 5:50 PM, erwin de ley wrote:
> I have integrated EMF Forms with a Graphiti graphical editor, to
> provide configuration dialogs for diagram elements, or more correctly
> for the backing business/domain objects.
>
> Versions are from Mars.1.
>
> This works nicely on MS Windows, CentOS etc.
> But on Mac OSX with SWT Cocoa, the binding from changed values in a
> text field towards the underlying EMF model properties is not working
> in the case of a form with just 1 text field, wrapped in a dialog with
> a close button.
>
> While debugging on windows, we noticed that the property update is
> applied ( via a call to eSet() etc) based on a focus event triggered
> on the text field, when clicking on the dialog's close button, or
> navigating to it with a TAB-click.
>
> On OSX we don't see this focus event being triggered at that moment.
> But when clicking outside of the RCP GUI it does happen.
>
> Also when the form has multiple text fields (properties), the focus
> lost event gets triggered when jumping to the next field and the
> property update is done.
>
> Is this a known issue with button focus events in EMF Forms? Or in SWT
> underneath?
> I searched for problems for SWT and EMF Forms on OSX, but could not
> find something similar.
>
> I am now considering triggering the update from the dialog closure for
> such cases, but that would be annoying as it would force me to develop
> exception logic for 1-field forms...
>
> thanks
> erwin
Re: [EMF Forms] Text field to property binding issue on Mac OSX / Cocoa [message #1718782 is a reply to message #1718773] Wed, 30 December 2015 09:12 Go to previous messageGo to next message
Erwin De Ley is currently offline Erwin De LeyFriend
Messages: 52
Registered: August 2013
Member
Ed,

Wow that's a nasty one indeed...
In the meantime I also found https://www.eclipse.org/forums/index.php/t/696778/
That one seems closer to what we're experiencing.

When switching on the "Tab to move focus between all controls"-behaviour with the system settings mentioned there, the EMF form triggers the property update when TABbing to the dialog's close button. But it still fails when directly clicking on the button.

With these two issues, it would seem that RCP form/text handling is in a bad shape on OSX Cocoa, most probably due to SWT issues with focus event handling on/in Cocoa. I find it difficult to believe that the bugzilla issue you mention stays open for > 3 yrs...

Is this a known situation, impacting EMF Forms usage on Eclipse Mars? Are there known workarounds?

thanks
erwin
Re: [EMF Forms] Text field to property binding issue on Mac OSX / Cocoa [message #1718865 is a reply to message #1718782] Thu, 31 December 2015 10:25 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 699
Registered: July 2009
Senior Member
Hi Erwin,

I agree with you and Ed that this issue is most probably causes by the
Mac SWT implementation. Except for fixing SWT itself, the only work
around I can come up with is: You implement a custom databinding
service. This service is used by controls to create the bindings and it
has the databinding context under control. When you click on OK in your
dialog, you trigger a manual update on this databinding service. It is
still a work around, but it keeps all manual things out of the forms,
meaning they are abstracted in your custom service.
If you are interested, I could come back next week with a more detailled
description on how to do that.
Best regards

Jonas



Am 30.12.2015 um 10:12 schrieb erwin de ley:
> Ed,
>
> Wow that's a nasty one indeed...
> In the meantime I also found
> https://www.eclipse.org/forums/index.php/t/696778/
> That one seems closer to what we're experiencing.
> When switching on the "Tab to move focus between all controls"-behaviour
> with the system settings mentioned there, the EMF form triggers the
> property update when TABbing to the dialog's close button. But it still
> fails when directly clicking on the button.
>
> With these two issues, it would seem that RCP form/text handling is in a
> bad shape on OSX Cocoa, most probably due to SWT issues with focus event
> handling on/in Cocoa. I find it difficult to believe that the bugzilla
> issue you mention stays open for > 3 yrs...
>
> Is this a known situation, impacting EMF Forms usage on Eclipse Mars?
> Are there known workarounds?
>
> thanks
> erwin


--
--

Jonas Helming

Get professional Eclipse developer support:

http://eclipsesource.com/en/services/developer-support/
Re: [EMF Forms] Text field to property binding issue on Mac OSX / Cocoa [message #1719170 is a reply to message #1718865] Tue, 05 January 2016 18:46 Go to previous messageGo to next message
Erwin De Ley is currently offline Erwin De LeyFriend
Messages: 52
Registered: August 2013
Member
Thanks Jonas, that seems to be the best option indeed.

So I would definitely be interested to get some more info on implementing a custom DataBindingService.

regards
erwin
Re: [EMF Forms] Text field to property binding issue on Mac OSX / Cocoa [message #1719245 is a reply to message #1719170] Wed, 06 January 2016 14:30 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 699
Registered: July 2009
Senior Member
Hi Erwin,

we will post more details on Monday. Sorry for the delay, but we are
still in holiday mode :-)

Best regards

Jonas


Am 05.01.2016 um 19:46 schrieb erwin de ley:
> Thanks Jonas, that seems to be the best option indeed.
>
> So I would definitely be interested to get some more info on
> implementing a custom DataBindingService.
>
> regards
> erwin


--
--

Jonas Helming

Get professional Eclipse developer support:

http://eclipsesource.com/en/services/developer-support/
Re: [EMF Forms] Text field to property binding issue on Mac OSX / Cocoa [message #1719402 is a reply to message #1719245] Thu, 07 January 2016 16:24 Go to previous messageGo to next message
Erwin De Ley is currently offline Erwin De LeyFriend
Messages: 52
Registered: August 2013
Member
Thanks Jonas, next week is fine.

I just need enough time to get it working for EclipseCon NA! Wink

cheers
erwin
Re: [EMF Forms] Text field to property binding issue on Mac OSX / Cocoa [message #1720421 is a reply to message #1719402] Mon, 18 January 2016 14:52 Go to previous messageGo to next message
Eugen Neufeld is currently offline Eugen NeufeldFriend
Messages: 159
Registered: May 2015
Senior Member
Hi Erwin,
as far as I understand the main problem is, that the focus out event is not fired on the rendered control and thus the databinding doesn't trigger.
In this message here it is said that the focus can be set on a button.
So I would suggest to try to set the focus manually on the button when you click it.
eg: mybutton.setFocus()

This should at least trigger the focus out event on the form control and thus trigger the databinding.

Could you try this out?

Cheers,
Eugen


--
Eugen Neufeld

Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Re: [EMF Forms] Text field to property binding issue on Mac OSX / Cocoa [message #1720691 is a reply to message #1720421] Wed, 20 January 2016 10:07 Go to previous messageGo to next message
Erwin De Ley is currently offline Erwin De LeyFriend
Messages: 52
Registered: August 2013
Member
Hi Eugen,

We did try that out, to check our hypothesis on the root cause of the problem.
But this is not the right solution for us, as we would like the application to behave in the "normal" way without requiring OS customizations.

So I would prefer to go for the alternative DataBinding approach, once Jonas provides the info on how to do this.

Still, I would imagine that users of EMF Forms in general are impacted by this and would be interested to know if someone is considering integrating a default fix for this.

cheers
erwin
Re: [EMF Forms] Text field to property binding issue on Mac OSX / Cocoa [message #1720723 is a reply to message #1720691] Wed, 20 January 2016 14:26 Go to previous messageGo to next message
Eugen Neufeld is currently offline Eugen NeufeldFriend
Messages: 159
Registered: May 2015
Senior Member
Hi Erwin,
there is obviously a different behavior of focus event on macos. If you add the setFocus call on the button, then everything should work on linux and windows systems as well, because the focus out event would already have occurred on the text control and the additional setFocus call would be ignored by swt as there would be no focus change.
An alternative databinding approach is nothing else as an OS customization as you will build a workaround for the macos behavior.
Jonas suggested to call the update by hand when pressing the button, he called this a workaround himself. I don't see the difference.

Furthermore it is not possible to trigger the update by hand without providing custom controls as the databindingcontext is created per control and not provided by a service.

The problem is, that when you switch the focus from a text control to not a text control or list control , eg a button, the focus out event is not fired. I don't see how a default fix could look for this. We could change the databinding trigger to modify instead of focus out but this will lead to performance issues especially with rap.
I agree that there is a problem on macos but currently I don't see a solution except making the databinding trigger customizable without providing custom controls.
We are happy to accept contributions.

Cheers,
Eugen


--
Eugen Neufeld

Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Re: [EMF Forms] Text field to property binding issue on Mac OSX / Cocoa [message #1720768 is a reply to message #1720723] Wed, 20 January 2016 19:45 Go to previous message
Erwin De Ley is currently offline Erwin De LeyFriend
Messages: 52
Registered: August 2013
Member
Hmmmm, I guess you're right!
I'll follow that path for now.

Then I still need to figure out how to use EMF transactions (I guess) to commit on the Ok button and rollback the model changes with a Cancel button-click.

thanks for the detailed feedback,

erwin
Previous Topic:XSD1.1 to EMF : How could i simulate XSD Conditional Type Assignment
Next Topic:[solved][Teneo] Persistence mapping builder looking for everything
Goto Forum:
  


Current Time: Tue May 26 13:59:45 GMT 2020

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

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

Back to the top