Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Is there a reason that there isn't an EMFObservableValueEditingSupport class?
Is there a reason that there isn't an EMFObservableValueEditingSupport class? [message #524139] Tue, 30 March 2010 21:59 Go to next message
Ryan is currently offline RyanFriend
Messages: 74
Registered: July 2009
Location: Indiana
Member
I asked about ObservableValueEditingSupport.create() here:
http://www.eclipse.org/forums/index.php?t=msg&th=165442& amp; amp;start=0&

I ran into an issue today; I had a tableviewer bound to emf objects that have integer fields. The default ObservableValueEditingSupport creates a generic UpdateValueStrategy and as such, edits to an int field in the table fail becuase of a check eType.isInstance(class) (not sure if that's the correct sig). Basically, the default converter returns a string and EMF is expecting an int.

I was able to get this to work by copying the full class ObservableValueEditingSupport and changing the bindValue() call in createBinding() to create an EMFUpdateValueStrategy. The tableviewer then works fine afterwards.

Am I missing something, or did I do the correct thing here? It seems like there should be an EMFObservableValueEditingSupport in the emf databinding plugin. Either that, or my custom class could have been avoided if the default ObservableValueEditingSupport had a second create method that accepted the UpdateValueStrategies.

[Updated on: Tue, 30 March 2010 22:00]

Report message to a moderator

Re: Is there a reason that there isn't an EMFObservableValueEditingSupport class? [message #524145 is a reply to message #524139] Tue, 30 March 2010 22:37 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
Ryan,

If something looks wrong, create a test case and open a bugzilla
illustrating the problem. EMF does have specialized value converters so
I'm not sure from the tiny bit of context you've provided if that's
being used.


Ryan wrote:
> I asked about ObservableValueEditingSupport.create() here:
> http://www.eclipse.org/forums/index.php?t=msg&th=165442& amp;start=0&
>
> I ran into an issue today; I had a tableviewer bound to emf objects
> that have integer fields. The default ObservableValueEditingSupport
> creates a generic UpdateValueStrategy and as such, edits to an int
> field in the table fail becuase of a check eType.isInstance(class)
> (not sure if that's the correct sig). Basically, the default
> converter returns a string and EMF is expecting an int.
>
> I was able to get this to work by copying the full class
> ObservableValueEditingSupport and changing the bindValue() call in
> createBinding() to create an EMFUpdateValueStrategy. The tableviewer
> then works fine afterwards.
> Am I missing something, or did I do the correct thing here? It seems
> like there should be an EMFObservableValueEditingSupport in the emf
> databinding plugin.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Is there a reason that there isn't an EMFObservableValueEditingSupport class? [message #524158 is a reply to message #524139] Wed, 31 March 2010 00:46 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Yes because this is a pure UI-thing and we are only providing EMF-Model
integration yet. IMHO the ObservableValueEditingSupport should be
enhanced to specify the UpdateValueStrategy.

Tom

Am 30.03.10 23:59, schrieb Ryan:
> I asked about ObservableValueEditingSupport.create() here:
> http://www.eclipse.org/forums/index.php?t=msg&th=165442& amp;start=0&
>
> I ran into an issue today; I had a tableviewer bound to emf objects that
> have integer fields. The default ObservableValueEditingSupport creates
> a generic UpdateValueStrategy and as such, edits to an int field in the
> table fail becuase of a check eType.isInstance(class) (not sure if
> that's the correct sig). Basically, the default converter returns a
> string and EMF is expecting an int.
>
> I was able to get this to work by copying the full class
> ObservableValueEditingSupport and changing the bindValue() call in
> createBinding() to create an EMFUpdateValueStrategy. The tableviewer
> then works fine afterwards.
> Am I missing something, or did I do the correct thing here? It seems
> like there should be an EMFObservableValueEditingSupport in the emf
> databinding plugin.
Re: Is there a reason that there isn't an EMFObservableValueEditingSupport class? [message #524304 is a reply to message #524145] Wed, 31 March 2010 13:31 Go to previous messageGo to next message
Ryan is currently offline RyanFriend
Messages: 74
Registered: July 2009
Location: Indiana
Member
Ed Merks wrote on Tue, 30 March 2010 18:37
Ryan,

If something looks wrong, create a test case and open a bugzilla
illustrating the problem. EMF does have specialized value converters so
I'm not sure from the tiny bit of context you've provided if that's
being used.


Ed,
The main problem is that the standard ObservableValueEditingSupport class internally creates the binding:
protected Binding createBinding(IObservableValue target,
			IObservableValue model) {
		dirty = false;
		Binding binding = dbc.bindValue(target, model, new UpdateValueStrategy(
				UpdateValueStrategy.POLICY_CONVERT), null);
		target.addChangeListener(new IChangeListener() {
			public void handleChange(ChangeEvent event) {
				dirty = true;
			}
		});
		return binding;
	}


As you can see, it creates an UpdateValueStrategy. The first set of EMF objects I tried this with worked, because the objects just had string properties, and apparently, the standard converters that get created in the UpdateValueStrategy work. The problem is when one of the columns in the table I'm binding is an EInt, the standard UVS tries to create a converter, but fails. Hence, I copied the code for this class, and implemented my own createBinding method that creates an EMFUpdateValueStrategy, which then works fine.

Binding binding = dbc.bindValue(target, model, new EMFUpdateValueStrategy(
				UpdateValueStrategy.POLICY_CONVERT), null);

Tom Schindl wrote on Tue, 30 March 2010 20:46
Yes because this is a pure UI-thing and we are only providing EMF-Model
integration yet. IMHO the ObservableValueEditingSupport should be
enhanced to specify the UpdateValueStrategy.

Tom


Tom, that does make the most sense, that the standard OVES should be updated. I'll look for a bug report and create one if I don't find one. Have you bound EMF objects to a jface table with a column bound to an EInt property of an EObject? If so, how did you go about doing it?

Thanks,
Ryan
Re: Is there a reason that there isn't an EMFObservableValueEditingSupport class? [message #524836 is a reply to message #524139] Fri, 02 April 2010 20:14 Go to previous messageGo to next message
Ryan is currently offline RyanFriend
Messages: 74
Registered: July 2009
Location: Indiana
Member
I created a bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=308010

It would still be nice to have an EMFObservableValueEditingSupport, just as a convience class.
Re: Is there a reason that there isn't an EMFObservableValueEditingSupport class? [message #524923 is a reply to message #524836] Sun, 04 April 2010 02:16 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Hi,

Would you mind filing a bug? I guess we could add a new Bundle which
holds UI-Specific code (e.g. I have some reuseable LabelProviders who
use EMF, ...).

Ed any opinions on this?

Tom

Am 02.04.10 22:14, schrieb Ryan:
> I created a bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=308010
>
> It would still be nice to have an EMFObservableValueEditingSupport, just
> as a convience class.
Re: Is there a reason that there isn't an EMFObservableValueEditingSupport class? [message #524934 is a reply to message #524923] Sun, 04 April 2010 12:15 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------030704080005040205070902
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Tom,

A UI specific EMF data binding bundle seems reasonable.


Tom Schindl wrote:
> Hi,
>
> Would you mind filing a bug? I guess we could add a new Bundle which
> holds UI-Specific code (e.g. I have some reuseable LabelProviders who
> use EMF, ...).
>
> Ed any opinions on this?
>
> Tom
>
> Am 02.04.10 22:14, schrieb Ryan:
>
>> I created a bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=308010
>>
>> It would still be nice to have an EMFObservableValueEditingSupport, just
>> as a convience class.
>>
>
>

--------------030704080005040205070902
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Tom,<br>
<br>
A UI specific EMF data binding bundle seems reasonable.<br>
<br>
<br>
Tom Schindl wrote:
<blockquote cite="mid:hp9dku$8lq$1@build.eclipse.org" type="cite">
<pre wrap="">Hi,

Would you mind filing a bug? I guess we could add a new Bundle which
holds UI-Specific code (e.g. I have some reuseable LabelProviders who
use EMF, ...).

Ed any opinions on this?

Tom

Am 02.04.10 22:14, schrieb Ryan:
</pre>
<blockquote type="cite">
<pre wrap="">I created a bug <a class="moz-txt-link-freetext" href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=308010">https://bugs.eclipse.org/bugs/show_bug.cgi?id=308010</a>

It would still be nice to have an EMFObservableValueEditingSupport, just
as a convience class.
</pre>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
</body>
</html>

--------------030704080005040205070902--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Is there a reason that there isn't an EMFObservableValueEditingSupport class? [message #639276 is a reply to message #524934] Mon, 15 November 2010 21:19 Go to previous messageGo to next message
Ryan is currently offline RyanFriend
Messages: 74
Registered: July 2009
Location: Indiana
Member
Ed, Tom,
I know it has been a while; I just created my own class and has worked just fine. Do you still want me to file a bug report requesting a UI specific convenience bundle?

Also Tom, you mentioned "(e.g. I have some reuseable LabelProviders who use EMF, ...)". Are these classes posted anywhere on the net that I could take a look at them to see if they'd be useful for me?

Thanks,
Ryan

[Updated on: Mon, 15 November 2010 21:22]

Report message to a moderator

Re: Is there a reason that there isn't an EMFObservableValueEditingSupport class? [message #639331 is a reply to message #639276] Tue, 16 November 2010 07:31 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Yes - please do and if you want/are allowed you could contribute your
class to it :-)

Tom

Am 15.11.10 22:20, schrieb Ryan:
> Ed, Tom,
> I know it has been a while; I just created my own class and has worked
> just fine. Do you still want me to file a bug report requesting a UI
> specific convenience bundle?
Re: Is there a reason that there isn't an EMFObservableValueEditingSupport class? [message #639450 is a reply to message #639331] Tue, 16 November 2010 15:42 Go to previous message
Ryan is currently offline RyanFriend
Messages: 74
Registered: July 2009
Location: Indiana
Member
Feature request (not sure I put it in the right spot in the eclipse bug database):
https://bugs.eclipse.org/bugs/show_bug.cgi?id=330369
Previous Topic:[CDO] generating dawn genmodel
Next Topic:[CDO] java.io.StreamCorruptedException: invalid stream header during CDO server startup when reading
Goto Forum:
  


Current Time: Tue Apr 16 21:38:49 GMT 2024

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

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

Back to the top