Home » Modeling » EMF » Re: [JFace Databinding] Bind EMap value to Text
| |
Re: [JFace Databinding] Bind EMap value to Text [message #427377 is a reply to message #427376] |
Mon, 16 February 2009 09:00 |
Thomas Schindl Messages: 6651 Registered: July 2009 |
Senior Member |
|
|
Hi Kai,
What one would need to write is an ObservableValue implementation for a
Map-Entry (as the current EMFObservables.observeMap() is for multi
valued features).
I'll take a look into how EMap-works and how it fires events so that one
could write an ObservableValue implementation for a specific key.
Something like this:
EMFObservables#observeMapEntry(
EObject obj,
EStructuralFeature feature,
String key)
I've never used EMap before but does it fire events on map changes?
The properties API I mentioned before isn't a solution and when using
EMF you could not use it because I'm still working on the EMF-port [1]
or if you prefer a workspace setup of the appropriate modules (I had to
patch the databinding.core which I need to recode soon) and see example
usage[2].
Tom
[1]https://bugs.eclipse.org/bugs/show_bug.cgi?id=262160
[2] http://github.com/tomsontom/emf-databinding-example/tree/mas ter
Kai Schlamp schrieb:
> Comments below.
>
> Tom Schindl schrieb:
>> Hi Kai,
>>
>> I don't think there's direct support for this currently. The only
>> possibility i see currently is to create a volatile transient feature
>> (height) whenever the height changes you fire a notification for the
>> height feature.
>
> This won't be an option as there are quite many entries in my map that I
> want to bind Text's to.
>
>> If you have further question please we should discuss on the
>> EMF-Newsgroup - I think with the 3.5 properties API one can also observe
>> map-attributes but I'm not 100% sure.
>
> Does someone have a clue how to do that? I am not aware of the 3.5
> properties API (althought I am using the current 3.5 milestone release).
>
>>
>> Tom
>>
>> Kai Schlamp schrieb:
>>> Hello.
>>>
>>> I want to observe a map (better to say a specific value belonging to a
>>> specific key) that is a child of an EMF EObject.
>>>
>>> Example (Pseudocode):
>>>
>>> Datastructure:
>>>
>>> class Building extends EObject {
>>> EMap properties
>>> }
>>>
>>> Binding:
>>>
>>> bindingContext.bindValue(SWTObservables.observeText(myTextFi eld,
>>> SWT.Modify), EMFObservables.observe???(myBuilding???, ???), null, null);
>>>
>>> So how do I bind, let's say myBuilding.getProperties.get("height") to
>>> myTextField?
>>>
>>> Best regards,
>>> Kai
>>>
>>>
>>
>>
--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
|
|
|
Re: [JFace Databinding] Bind EMap value to Text [message #427381 is a reply to message #427377] |
Mon, 16 February 2009 12:13 |
Ed Merks Messages: 33213 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------010005070204030908040903
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Guys,
An EMap is effectively just a list of EObjects that implement
Map.Entry. There's no generated API/interface for the map entry EClass,
but the usual meta data for it exists in the generated package and such
an EClass will always have a "key" and a "value" feature. So you should
be able to observe the one entry in the usual way. You could use
eMap.indexOf(key) and then eMap.get(index) to get the Map.Entry and then
you could cast it to EObject...
Tom Schindl wrote:
> Hi Kai,
>
> What one would need to write is an ObservableValue implementation for a
> Map-Entry (as the current EMFObservables.observeMap() is for multi
> valued features).
>
> I'll take a look into how EMap-works and how it fires events so that one
> could write an ObservableValue implementation for a specific key.
>
> Something like this:
>
> EMFObservables#observeMapEntry(
> EObject obj,
> EStructuralFeature feature,
> String key)
>
>
> I've never used EMap before but does it fire events on map changes?
>
> The properties API I mentioned before isn't a solution and when using
> EMF you could not use it because I'm still working on the EMF-port [1]
> or if you prefer a workspace setup of the appropriate modules (I had to
> patch the databinding.core which I need to recode soon) and see example
> usage[2].
>
> Tom
>
> [1]https://bugs.eclipse.org/bugs/show_bug.cgi?id=262160
> [2] http://github.com/tomsontom/emf-databinding-example/tree/mas ter
>
> Kai Schlamp schrieb:
>
>> Comments below.
>>
>> Tom Schindl schrieb:
>>
>>> Hi Kai,
>>>
>>> I don't think there's direct support for this currently. The only
>>> possibility i see currently is to create a volatile transient feature
>>> (height) whenever the height changes you fire a notification for the
>>> height feature.
>>>
>> This won't be an option as there are quite many entries in my map that I
>> want to bind Text's to.
>>
>>
>>> If you have further question please we should discuss on the
>>> EMF-Newsgroup - I think with the 3.5 properties API one can also observe
>>> map-attributes but I'm not 100% sure.
>>>
>> Does someone have a clue how to do that? I am not aware of the 3.5
>> properties API (althought I am using the current 3.5 milestone release).
>>
>>
>>> Tom
>>>
>>> Kai Schlamp schrieb:
>>>
>>>> Hello.
>>>>
>>>> I want to observe a map (better to say a specific value belonging to a
>>>> specific key) that is a child of an EMF EObject.
>>>>
>>>> Example (Pseudocode):
>>>>
>>>> Datastructure:
>>>>
>>>> class Building extends EObject {
>>>> EMap properties
>>>> }
>>>>
>>>> Binding:
>>>>
>>>> bindingContext.bindValue(SWTObservables.observeText(myTextFi eld,
>>>> SWT.Modify), EMFObservables.observe???(myBuilding???, ???), null, null);
>>>>
>>>> So how do I bind, let's say myBuilding.getProperties.get("height") to
>>>> myTextField?
>>>>
>>>> Best regards,
>>>> Kai
>>>>
>>>>
>>>>
>>>
>
>
>
--------------010005070204030908040903
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Guys,<br>
<br>
An EMap is effectively just a list of EObjects that implement
Map.Entry.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: [JFace Databinding] Bind EMap value to Text [message #427402 is a reply to message #427381] |
Mon, 16 February 2009 22:01 |
Kai Schlamp Messages: 344 Registered: July 2009 |
Senior Member |
|
|
Thanks for the explanations, Ed.
Do you have a simple example when using a bindingContext?
Lets assume the simple data structure from my first posting:
class Building extends EObject {
EMap props
}
and now I need the IObservableValue of myBuilding.getProps.get("height")
for example to bind it to a text.
EMFObservables.observeValue(myBuilding.getProps, ???)
Thanks,
Kai
Ed Merks schrieb:
> Guys,
>
> An EMap is effectively just a list of EObjects that implement
> Map.Entry. There's no generated API/interface for the map entry EClass,
> but the usual meta data for it exists in the generated package and such
> an EClass will always have a "key" and a "value" feature. So you should
> be able to observe the one entry in the usual way. You could use
> eMap.indexOf(key) and then eMap.get(index) to get the Map.Entry and then
> you could cast it to EObject...
>
>
> Tom Schindl wrote:
>> Hi Kai,
>>
>> What one would need to write is an ObservableValue implementation for a
>> Map-Entry (as the current EMFObservables.observeMap() is for multi
>> valued features).
>>
>> I'll take a look into how EMap-works and how it fires events so that one
>> could write an ObservableValue implementation for a specific key.
>>
>> Something like this:
>>
>> EMFObservables#observeMapEntry(
>> EObject obj,
>> EStructuralFeature feature,
>> String key)
>>
>>
>> I've never used EMap before but does it fire events on map changes?
>>
>> The properties API I mentioned before isn't a solution and when using
>> EMF you could not use it because I'm still working on the EMF-port [1]
>> or if you prefer a workspace setup of the appropriate modules (I had to
>> patch the databinding.core which I need to recode soon) and see example
>> usage[2].
>>
>> Tom
>>
>> [1]https://bugs.eclipse.org/bugs/show_bug.cgi?id=262160
>> [2] http://github.com/tomsontom/emf-databinding-example/tree/mas ter
>>
>> Kai Schlamp schrieb:
>>
>>> Comments below.
>>>
>>> Tom Schindl schrieb:
>>>
>>>> Hi Kai,
>>>>
>>>> I don't think there's direct support for this currently. The only
>>>> possibility i see currently is to create a volatile transient feature
>>>> (height) whenever the height changes you fire a notification for the
>>>> height feature.
>>>>
>>> This won't be an option as there are quite many entries in my map that I
>>> want to bind Text's to.
>>>
>>>
>>>> If you have further question please we should discuss on the
>>>> EMF-Newsgroup - I think with the 3.5 properties API one can also observe
>>>> map-attributes but I'm not 100% sure.
>>>>
>>> Does someone have a clue how to do that? I am not aware of the 3.5
>>> properties API (althought I am using the current 3.5 milestone release).
>>>
>>>
>>>> Tom
>>>>
>>>> Kai Schlamp schrieb:
>>>>
>>>>> Hello.
>>>>>
>>>>> I want to observe a map (better to say a specific value belonging to a
>>>>> specific key) that is a child of an EMF EObject.
>>>>>
>>>>> Example (Pseudocode):
>>>>>
>>>>> Datastructure:
>>>>>
>>>>> class Building extends EObject {
>>>>> EMap properties
>>>>> }
>>>>>
>>>>> Binding:
>>>>>
>>>>> bindingContext.bindValue(SWTObservables.observeText(myTextFi eld,
>>>>> SWT.Modify), EMFObservables.observe???(myBuilding???, ???), null, null);
>>>>>
>>>>> So how do I bind, let's say myBuilding.getProperties.get("height") to
>>>>> myTextField?
>>>>>
>>>>> Best regards,
>>>>> Kai
>>>>>
>>>>>
>>>>>
>>>>
>>
>>
>>
|
|
|
Re: [JFace Databinding] Bind EMap value to Text [message #427403 is a reply to message #427381] |
Mon, 16 February 2009 23:29 |
Thomas Schindl Messages: 6651 Registered: July 2009 |
Senior Member |
|
|
Hi Ed,
I just looked how an feature modeled as an EMap works and I'm sorry but
I think I don't get it. An EMap is an ordinary java.util.Map and it
doesn't fire events. Do you by change talk about an EFeatureMap?
So I don't see a chance to provide an ObservableValue implementation for
an entry in the map.
Tom
Ed Merks schrieb:
> Guys,
>
> An EMap is effectively just a list of EObjects that implement
> Map.Entry. There's no generated API/interface for the map entry EClass,
> but the usual meta data for it exists in the generated package and such
> an EClass will always have a "key" and a "value" feature. So you should
> be able to observe the one entry in the usual way. You could use
> eMap.indexOf(key) and then eMap.get(index) to get the Map.Entry and then
> you could cast it to EObject...
>
>
> Tom Schindl wrote:
>> Hi Kai,
>>
>> What one would need to write is an ObservableValue implementation for a
>> Map-Entry (as the current EMFObservables.observeMap() is for multi
>> valued features).
>>
>> I'll take a look into how EMap-works and how it fires events so that one
>> could write an ObservableValue implementation for a specific key.
>>
>> Something like this:
>>
>> EMFObservables#observeMapEntry(
>> EObject obj,
>> EStructuralFeature feature,
>> String key)
>>
>>
>> I've never used EMap before but does it fire events on map changes?
>>
>> The properties API I mentioned before isn't a solution and when using
>> EMF you could not use it because I'm still working on the EMF-port [1]
>> or if you prefer a workspace setup of the appropriate modules (I had to
>> patch the databinding.core which I need to recode soon) and see example
>> usage[2].
>>
>> Tom
>>
>> [1]https://bugs.eclipse.org/bugs/show_bug.cgi?id=262160
>> [2] http://github.com/tomsontom/emf-databinding-example/tree/mas ter
>>
>> Kai Schlamp schrieb:
>>
>>> Comments below.
>>>
>>> Tom Schindl schrieb:
>>>
>>>> Hi Kai,
>>>>
>>>> I don't think there's direct support for this currently. The only
>>>> possibility i see currently is to create a volatile transient feature
>>>> (height) whenever the height changes you fire a notification for the
>>>> height feature.
>>>>
>>> This won't be an option as there are quite many entries in my map that I
>>> want to bind Text's to.
>>>
>>>
>>>> If you have further question please we should discuss on the
>>>> EMF-Newsgroup - I think with the 3.5 properties API one can also observe
>>>> map-attributes but I'm not 100% sure.
>>>>
>>> Does someone have a clue how to do that? I am not aware of the 3.5
>>> properties API (althought I am using the current 3.5 milestone release).
>>>
>>>
>>>> Tom
>>>>
>>>> Kai Schlamp schrieb:
>>>>
>>>>> Hello.
>>>>>
>>>>> I want to observe a map (better to say a specific value belonging to a
>>>>> specific key) that is a child of an EMF EObject.
>>>>>
>>>>> Example (Pseudocode):
>>>>>
>>>>> Datastructure:
>>>>>
>>>>> class Building extends EObject {
>>>>> EMap properties
>>>>> }
>>>>>
>>>>> Binding:
>>>>>
>>>>> bindingContext.bindValue(SWTObservables.observeText(myTextFi eld,
>>>>> SWT.Modify), EMFObservables.observe???(myBuilding???, ???), null, null);
>>>>>
>>>>> So how do I bind, let's say myBuilding.getProperties.get("height") to
>>>>> myTextField?
>>>>>
>>>>> Best regards,
>>>>> Kai
>>>>>
>>>>>
>>>>>
>>>>
>>
>>
>>
--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
|
|
|
Re: [JFace Databinding] Bind EMap value to Text [message #427416 is a reply to message #427402] |
Tue, 17 February 2009 16:20 |
Ed Merks Messages: 33213 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------010701050905050605080100
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Kai,
Comments below.
Kai Schlamp wrote:
> Thanks for the explanations, Ed.
> Do you have a simple example when using a bindingContext?
Unfortunately not.
>
> Lets assume the simple data structure from my first posting:
>
> class Building extends EObject {
> EMap props
> }
>
> and now I need the IObservableValue of
> myBuilding.getProps.get("height") for example to bind it to a text.
This should yield you an EObject you can observe like all the other
examples:
(EObject)myBuilding.getProps().get(getProps().indexOfKey("height "))
Presumably there is a XyzPackage.Literals.STRING_TO_ABC_MAP__VALUE
feature for that map entry...
>
> EMFObservables.observeValue(myBuilding.getProps, ???)
>
> Thanks,
> Kai
>
> Ed Merks schrieb:
>> Guys,
>>
>> An EMap is effectively just a list of EObjects that implement
>> Map.Entry. There's no generated API/interface for the map entry
>> EClass, but the usual meta data for it exists in the generated
>> package and such an EClass will always have a "key" and a "value"
>> feature. So you should be able to observe the one entry in the usual
>> way. You could use eMap.indexOf(key) and then eMap.get(index) to get
>> the Map.Entry and then you could cast it to EObject...
>>
>>
>> Tom Schindl wrote:
>>> Hi Kai,
>>>
>>> What one would need to write is an ObservableValue implementation for a
>>> Map-Entry (as the current EMFObservables.observeMap() is for multi
>>> valued features).
>>>
>>> I'll take a look into how EMap-works and how it fires events so that
>>> one
>>> could write an ObservableValue implementation for a specific key.
>>>
>>> Something like this:
>>>
>>> EMFObservables#observeMapEntry(
>>> EObject obj,
>>> EStructuralFeature feature,
>>> String key)
>>>
>>>
>>> I've never used EMap before but does it fire events on map changes?
>>>
>>> The properties API I mentioned before isn't a solution and when using
>>> EMF you could not use it because I'm still working on the EMF-port [1]
>>> or if you prefer a workspace setup of the appropriate modules (I had to
>>> patch the databinding.core which I need to recode soon) and see example
>>> usage[2].
>>>
>>> Tom
>>>
>>> [1]https://bugs.eclipse.org/bugs/show_bug.cgi?id=262160
>>> [2] http://github.com/tomsontom/emf-databinding-example/tree/mas ter
>>>
>>> Kai Schlamp schrieb:
>>>
>>>> Comments below.
>>>>
>>>> Tom Schindl schrieb:
>>>>
>>>>> Hi Kai,
>>>>>
>>>>> I don't think there's direct support for this currently. The only
>>>>> possibility i see currently is to create a volatile transient feature
>>>>> (height) whenever the height changes you fire a notification for the
>>>>> height feature.
>>>>>
>>>> This won't be an option as there are quite many entries in my map
>>>> that I
>>>> want to bind Text's to.
>>>>
>>>>
>>>>> If you have further question please we should discuss on the
>>>>> EMF-Newsgroup - I think with the 3.5 properties API one can also
>>>>> observe
>>>>> map-attributes but I'm not 100% sure.
>>>>>
>>>> Does someone have a clue how to do that? I am not aware of the 3.5
>>>> properties API (althought I am using the current 3.5 milestone
>>>> release).
>>>>
>>>>
>>>>> Tom
>>>>>
>>>>> Kai Schlamp schrieb:
>>>>>
>>>>>> Hello.
>>>>>>
>>>>>> I want to observe a map (better to say a specific value belonging
>>>>>> to a
>>>>>> specific key) that is a child of an EMF EObject.
>>>>>>
>>>>>> Example (Pseudocode):
>>>>>>
>>>>>> Datastructure:
>>>>>>
>>>>>> class Building extends EObject {
>>>>>> EMap properties
>>>>>> }
>>>>>>
>>>>>> Binding:
>>>>>>
>>>>>> bindingContext.bindValue(SWTObservables.observeText(myTextFi eld,
>>>>>> SWT.Modify), EMFObservables.observe???(myBuilding???, ???), null,
>>>>>> null);
>>>>>>
>>>>>> So how do I bind, let's say
>>>>>> myBuilding.getProperties.get("height") to
>>>>>> myTextField?
>>>>>>
>>>>>> Best regards,
>>>>>> Kai
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>
>>>
>>>
--------------010701050905050605080100
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Kai,<br>
<br>
Comments below.<br>
<br>
Kai Schlamp wrote:
<blockquote cite="mid:gncno2$jco$1@build.eclipse.org" type="cite">Thanks
for the explanations, Ed.
<br>
Do you have a simple example when using a bindingContext?
<br>
</blockquote>
Unfortunately not.<br>
<blockquote cite="mid:gncno2$jco$1@build.eclipse.org" type="cite"><br>
Lets assume the simple data structure from my first posting:
<br>
<br>
class Building extends EObject {
<br>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: [JFace Databinding] Bind EMap value to Text [message #427417 is a reply to message #427403] |
Tue, 17 February 2009 16:22 |
Ed Merks Messages: 33213 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------010903070500010801010803
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Tom,
Comments below.
Tom Schindl wrote:
> Hi Ed,
>
> I just looked how an feature modeled as an EMap works and I'm sorry but
> I think I don't get it.
I thought it was totally self-evident. :-P
> An EMap is an ordinary java.util.Map and it
> doesn't fire events.
No, it's not. It's a containment EList with all the other methods on a
java.util.Map, and you can get a Map view of it.
> Do you by change talk about an EFeatureMap?
>
FeatureMap is a different thing. No one asked about that yet I don't think.
> So I don't see a chance to provide an ObservableValue implementation for
> an entry in the map.
>
Yes because the Map.Entry instances implement EObject (because the EMap
is just a containment list).
>
> Tom
>
>
> Ed Merks schrieb:
>
>> Guys,
>>
>> An EMap is effectively just a list of EObjects that implement
>> Map.Entry. There's no generated API/interface for the map entry EClass,
>> but the usual meta data for it exists in the generated package and such
>> an EClass will always have a "key" and a "value" feature. So you should
>> be able to observe the one entry in the usual way. You could use
>> eMap.indexOf(key) and then eMap.get(index) to get the Map.Entry and then
>> you could cast it to EObject...
>>
>>
>> Tom Schindl wrote:
>>
>>> Hi Kai,
>>>
>>> What one would need to write is an ObservableValue implementation for a
>>> Map-Entry (as the current EMFObservables.observeMap() is for multi
>>> valued features).
>>>
>>> I'll take a look into how EMap-works and how it fires events so that one
>>> could write an ObservableValue implementation for a specific key.
>>>
>>> Something like this:
>>>
>>> EMFObservables#observeMapEntry(
>>> EObject obj,
>>> EStructuralFeature feature,
>>> String key)
>>>
>>>
>>> I've never used EMap before but does it fire events on map changes?
>>>
>>> The properties API I mentioned before isn't a solution and when using
>>> EMF you could not use it because I'm still working on the EMF-port [1]
>>> or if you prefer a workspace setup of the appropriate modules (I had to
>>> patch the databinding.core which I need to recode soon) and see example
>>> usage[2].
>>>
>>> Tom
>>>
>>> [1]https://bugs.eclipse.org/bugs/show_bug.cgi?id=262160
>>> [2] http://github.com/tomsontom/emf-databinding-example/tree/mas ter
>>>
>>> Kai Schlamp schrieb:
>>>
>>>
>>>> Comments below.
>>>>
>>>> Tom Schindl schrieb:
>>>>
>>>>
>>>>> Hi Kai,
>>>>>
>>>>> I don't think there's direct support for this currently. The only
>>>>> possibility i see currently is to create a volatile transient feature
>>>>> (height) whenever the height changes you fire a notification for the
>>>>> height feature.
>>>>>
>>>>>
>>>> This won't be an option as there are quite many entries in my map that I
>>>> want to bind Text's to.
>>>>
>>>>
>>>>
>>>>> If you have further question please we should discuss on the
>>>>> EMF-Newsgroup - I think with the 3.5 properties API one can also observe
>>>>> map-attributes but I'm not 100% sure.
>>>>>
>>>>>
>>>> Does someone have a clue how to do that? I am not aware of the 3.5
>>>> properties API (althought I am using the current 3.5 milestone release).
>>>>
>>>>
>>>>
>>>>> Tom
>>>>>
>>>>> Kai Schlamp schrieb:
>>>>>
>>>>>
>>>>>> Hello.
>>>>>>
>>>>>> I want to observe a map (better to say a specific value belonging to a
>>>>>> specific key) that is a child of an EMF EObject.
>>>>>>
>>>>>> Example (Pseudocode):
>>>>>>
>>>>>> Datastructure:
>>>>>>
>>>>>> class Building extends EObject {
>>>>>> EMap properties
>>>>>> }
>>>>>>
>>>>>> Binding:
>>>>>>
>>>>>> bindingContext.bindValue(SWTObservables.observeText(myTextFi eld,
>>>>>> SWT.Modify), EMFObservables.observe???(myBuilding???, ???), null, null);
>>>>>>
>>>>>> So how do I bind, let's say myBuilding.getProperties.get("height") to
>>>>>> myTextField?
>>>>>>
>>>>>> Best regards,
>>>>>> Kai
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>
>>>
>
>
>
--------------010903070500010801010803
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Tom,<br>
<br>
Comments below.<br>
<br>
Tom Schindl wrote:
<blockquote cite="mid:gncsse$67u$1@build.eclipse.org" type="cite">
<pre wrap="">Hi Ed,
I just looked how an feature modeled as an EMap works and I'm sorry but
I think I don't get it.</pre>
</blockquote>
I thought it was totally self-evident. :-P<br>
<blockquote cite="mid:gncsse$67u$1@build.eclipse.org" type="cite">
<pre wrap=""> An EMap is an ordinary java.util.Map and it
doesn't fire events.</pre>
</blockquote>
No, it's not.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: [JFace Databinding] Bind EMap value to Text [message #427426 is a reply to message #427417] |
Tue, 17 February 2009 18:30 |
Thomas Schindl Messages: 6651 Registered: July 2009 |
Senior Member |
|
|
Hi,
Could you guys please provide me with a simple .ecore so that I generate
the code and write an ObservableValue implementation which should be
quite easy?
Tom
Ed Merks schrieb:
> Tom,
>
> Comments below.
>
> Tom Schindl wrote:
>> Hi Ed,
>>
>> I just looked how an feature modeled as an EMap works and I'm sorry but
>> I think I don't get it.
> I thought it was totally self-evident. :-P
>> An EMap is an ordinary java.util.Map and it
>> doesn't fire events.
> No, it's not. It's a containment EList with all the other methods on a
> java.util.Map, and you can get a Map view of it.
>> Do you by change talk about an EFeatureMap?
>>
> FeatureMap is a different thing. No one asked about that yet I don't think.
>> So I don't see a chance to provide an ObservableValue implementation for
>> an entry in the map.
>>
> Yes because the Map.Entry instances implement EObject (because the EMap
> is just a containment list).
>>
>> Tom
>>
>>
>> Ed Merks schrieb:
>>
>>> Guys,
>>>
>>> An EMap is effectively just a list of EObjects that implement
>>> Map.Entry. There's no generated API/interface for the map entry EClass,
>>> but the usual meta data for it exists in the generated package and such
>>> an EClass will always have a "key" and a "value" feature. So you should
>>> be able to observe the one entry in the usual way. You could use
>>> eMap.indexOf(key) and then eMap.get(index) to get the Map.Entry and then
>>> you could cast it to EObject...
>>>
>>>
>>> Tom Schindl wrote:
>>>
>>>> Hi Kai,
>>>>
>>>> What one would need to write is an ObservableValue implementation for a
>>>> Map-Entry (as the current EMFObservables.observeMap() is for multi
>>>> valued features).
>>>>
>>>> I'll take a look into how EMap-works and how it fires events so that one
>>>> could write an ObservableValue implementation for a specific key.
>>>>
>>>> Something like this:
>>>>
>>>> EMFObservables#observeMapEntry(
>>>> EObject obj,
>>>> EStructuralFeature feature,
>>>> String key)
>>>>
>>>>
>>>> I've never used EMap before but does it fire events on map changes?
>>>>
>>>> The properties API I mentioned before isn't a solution and when using
>>>> EMF you could not use it because I'm still working on the EMF-port [1]
>>>> or if you prefer a workspace setup of the appropriate modules (I had to
>>>> patch the databinding.core which I need to recode soon) and see example
>>>> usage[2].
>>>>
>>>> Tom
>>>>
>>>> [1]https://bugs.eclipse.org/bugs/show_bug.cgi?id=262160
>>>> [2] http://github.com/tomsontom/emf-databinding-example/tree/mas ter
>>>>
>>>> Kai Schlamp schrieb:
>>>>
>>>>
>>>>> Comments below.
>>>>>
>>>>> Tom Schindl schrieb:
>>>>>
>>>>>
>>>>>> Hi Kai,
>>>>>>
>>>>>> I don't think there's direct support for this currently. The only
>>>>>> possibility i see currently is to create a volatile transient feature
>>>>>> (height) whenever the height changes you fire a notification for the
>>>>>> height feature.
>>>>>>
>>>>>>
>>>>> This won't be an option as there are quite many entries in my map that I
>>>>> want to bind Text's to.
>>>>>
>>>>>
>>>>>
>>>>>> If you have further question please we should discuss on the
>>>>>> EMF-Newsgroup - I think with the 3.5 properties API one can also observe
>>>>>> map-attributes but I'm not 100% sure.
>>>>>>
>>>>>>
>>>>> Does someone have a clue how to do that? I am not aware of the 3.5
>>>>> properties API (althought I am using the current 3.5 milestone release).
>>>>>
>>>>>
>>>>>
>>>>>> Tom
>>>>>>
>>>>>> Kai Schlamp schrieb:
>>>>>>
>>>>>>
>>>>>>> Hello.
>>>>>>>
>>>>>>> I want to observe a map (better to say a specific value belonging to a
>>>>>>> specific key) that is a child of an EMF EObject.
>>>>>>>
>>>>>>> Example (Pseudocode):
>>>>>>>
>>>>>>> Datastructure:
>>>>>>>
>>>>>>> class Building extends EObject {
>>>>>>> EMap properties
>>>>>>> }
>>>>>>>
>>>>>>> Binding:
>>>>>>>
>>>>>>> bindingContext.bindValue(SWTObservables.observeText(myTextFi eld,
>>>>>>> SWT.Modify), EMFObservables.observe???(myBuilding???, ???), null, null);
>>>>>>>
>>>>>>> So how do I bind, let's say myBuilding.getProperties.get("height") to
>>>>>>> myTextField?
>>>>>>>
>>>>>>> Best regards,
>>>>>>> Kai
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>
>>>>
>>
>>
>>
--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
|
|
|
Re: [JFace Databinding] Bind EMap value to Text [message #427427 is a reply to message #427426] |
Tue, 17 February 2009 19:24 |
Ed Merks Messages: 33213 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------020502050807080607090901
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Tom,
Ecore.ecore has EAnnotation.details so you can do this directly with the
Ecore model. I'm not sure that anything that doesn't already exist is
needed...
Tom Schindl wrote:
> Hi,
>
> Could you guys please provide me with a simple .ecore so that I generate
> the code and write an ObservableValue implementation which should be
> quite easy?
>
> Tom
>
> Ed Merks schrieb:
>
>> Tom,
>>
>> Comments below.
>>
>> Tom Schindl wrote:
>>
>>> Hi Ed,
>>>
>>> I just looked how an feature modeled as an EMap works and I'm sorry but
>>> I think I don't get it.
>>>
>> I thought it was totally self-evident. :-P
>>
>>> An EMap is an ordinary java.util.Map and it
>>> doesn't fire events.
>>>
>> No, it's not. It's a containment EList with all the other methods on a
>> java.util.Map, and you can get a Map view of it.
>>
>>> Do you by change talk about an EFeatureMap?
>>>
>>>
>> FeatureMap is a different thing. No one asked about that yet I don't think.
>>
>>> So I don't see a chance to provide an ObservableValue implementation for
>>> an entry in the map.
>>>
>>>
>> Yes because the Map.Entry instances implement EObject (because the EMap
>> is just a containment list).
>>
>>> Tom
>>>
>>>
>>> Ed Merks schrieb:
>>>
>>>
>>>> Guys,
>>>>
>>>> An EMap is effectively just a list of EObjects that implement
>>>> Map.Entry. There's no generated API/interface for the map entry EClass,
>>>> but the usual meta data for it exists in the generated package and such
>>>> an EClass will always have a "key" and a "value" feature. So you should
>>>> be able to observe the one entry in the usual way. You could use
>>>> eMap.indexOf(key) and then eMap.get(index) to get the Map.Entry and then
>>>> you could cast it to EObject...
>>>>
>>>>
>>>> Tom Schindl wrote:
>>>>
>>>>
>>>>> Hi Kai,
>>>>>
>>>>> What one would need to write is an ObservableValue implementation for a
>>>>> Map-Entry (as the current EMFObservables.observeMap() is for multi
>>>>> valued features).
>>>>>
>>>>> I'll take a look into how EMap-works and how it fires events so that one
>>>>> could write an ObservableValue implementation for a specific key.
>>>>>
>>>>> Something like this:
>>>>>
>>>>> EMFObservables#observeMapEntry(
>>>>> EObject obj,
>>>>> EStructuralFeature feature,
>>>>> String key)
>>>>>
>>>>>
>>>>> I've never used EMap before but does it fire events on map changes?
>>>>>
>>>>> The properties API I mentioned before isn't a solution and when using
>>>>> EMF you could not use it because I'm still working on the EMF-port [1]
>>>>> or if you prefer a workspace setup of the appropriate modules (I had to
>>>>> patch the databinding.core which I need to recode soon) and see example
>>>>> usage[2].
>>>>>
>>>>> Tom
>>>>>
>>>>> [1]https://bugs.eclipse.org/bugs/show_bug.cgi?id=262160
>>>>> [2] http://github.com/tomsontom/emf-databinding-example/tree/mas ter
>>>>>
>>>>> Kai Schlamp schrieb:
>>>>>
>>>>>
>>>>>
>>>>>> Comments below.
>>>>>>
>>>>>> Tom Schindl schrieb:
>>>>>>
>>>>>>
>>>>>>
>>>>>>> Hi Kai,
>>>>>>>
>>>>>>> I don't think there's direct support for this currently. The only
>>>>>>> possibility i see currently is to create a volatile transient feature
>>>>>>> (height) whenever the height changes you fire a notification for the
>>>>>>> height feature.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> This won't be an option as there are quite many entries in my map that I
>>>>>> want to bind Text's to.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>> If you have further question please we should discuss on the
>>>>>>> EMF-Newsgroup - I think with the 3.5 properties API one can also observe
>>>>>>> map-attributes but I'm not 100% sure.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> Does someone have a clue how to do that? I am not aware of the 3.5
>>>>>> properties API (althought I am using the current 3.5 milestone release).
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>> Tom
>>>>>>>
>>>>>>> Kai Schlamp schrieb:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> Hello.
>>>>>>>>
>>>>>>>> I want to observe a map (better to say a specific value belonging to a
>>>>>>>> specific key) that is a child of an EMF EObject.
>>>>>>>>
>>>>>>>> Example (Pseudocode):
>>>>>>>>
>>>>>>>> Datastructure:
>>>>>>>>
>>>>>>>> class Building extends EObject {
>>>>>>>> EMap properties
>>>>>>>> }
>>>>>>>>
>>>>>>>> Binding:
>>>>>>>>
>>>>>>>> bindingContext.bindValue(SWTObservables.observeText(myTextFi eld,
>>>>>>>> SWT.Modify), EMFObservables.observe???(myBuilding???, ???), null, null);
>>>>>>>>
>>>>>>>> So how do I bind, let's say myBuilding.getProperties.get("height") to
>>>>>>>> myTextField?
>>>>>>>>
>>>>>>>> Best regards,
>>>>>>>> Kai
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>>
>
>
>
--------------020502050807080607090901
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Tom,<br>
<br>
Ecore.ecore has EAnnotation.details so you can do this directly with
the Ecore model.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
| | |
Re: [JFace Databinding] Bind EMap value to Text [message #427444 is a reply to message #427441] |
Wed, 18 February 2009 08:55 |
Thomas Schindl Messages: 6651 Registered: July 2009 |
Senior Member |
|
|
Hi,
I added a factory method to my current working branch of EMF-Databinding
[1] (where I mainly implement the IProperty-Interfaces of 3.5).
You can fetch the sources from my public git repo [2] which also
provides a nice RCP Example Application showing many (if not all aspects
of Eclipse-Databinding with EMF).
If you are interested in EMF-Technologies (Ecore, Teneo, CDO) and RCP
I'll present all those concepts at EclipseCon 2009 [3].
Tom
[1]https://bugs.eclipse.org/bugs/show_bug.cgi?id=262160
[2] http://github.com/tomsontom/emf-databinding-example/tree/mas ter
[3]Mixing Eclipse Technologies to create Enterprise Ready
Database-RCP-Frontends - http://www.eclipsecon.org/2009/sessions?id=446
Tom Schindl schrieb:
> Should we provide this as part of our EMFObservables-API?
>
> EMFObservables.observeMapValue(
> myBuilding,
> DocumentModelPackage.Literals.DOCUMENT_PROPERTY,
> "title",
> DocumentModelPackage.Literals.DOCUMENT_PROPERTY_MAP__VALUE
> )
>
>
> Tom
>
> Kai Schlamp schrieb:
>> Comment below
>>
>>> This should yield you an EObject you can observe like all the other
>>> examples:
>>>
>>> (EObject)myBuilding.getProps().get(getProps().indexOfKey("height "))
>>>
>>> Presumably there is a XyzPackage.Literals.STRING_TO_ABC_MAP__VALUE
>>> feature for that map entry...
>> Yes, this works fine.
>>
>> Here a little example of how a complete binding looks like:
>>
>> bindingContext.bindValue(SWTObservables.observeText(textFiel d),
>> EMFObservables.observeValue((EObject)
>> document.getProperties().get(document.getProperties().indexO fKey( "title")),
>> DocumentModelPackage.Literals.DOCUMENT_PROPERTY_MAP__VALUE), null, null);
>>
>> Thanks Ed.
>
>
--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
|
|
| |
Re: [JFace Databinding] Bind EMap value to Text [message #506276 is a reply to message #427444] |
Wed, 06 January 2010 18:18 |
Eclipse User |
|
|
|
Originally posted by: Thomas.Kowatsch.ruag.com
Hi Tom.
Do I miss something? I cannot find this method in the EMFObservable class.
--Thomas
Tom Schindl schrieb:
> Hi,
>
> I added a factory method to my current working branch of EMF-Databinding
> [1] (where I mainly implement the IProperty-Interfaces of 3.5).
>
> You can fetch the sources from my public git repo [2] which also
> provides a nice RCP Example Application showing many (if not all aspects
> of Eclipse-Databinding with EMF).
>
> If you are interested in EMF-Technologies (Ecore, Teneo, CDO) and RCP
> I'll present all those concepts at EclipseCon 2009 [3].
>
> Tom
>
> [1]https://bugs.eclipse.org/bugs/show_bug.cgi?id=262160
> [2] http://github.com/tomsontom/emf-databinding-example/tree/mas ter
> [3]Mixing Eclipse Technologies to create Enterprise Ready
> Database-RCP-Frontends - http://www.eclipsecon.org/2009/sessions?id=446
>
>
> Tom Schindl schrieb:
>> Should we provide this as part of our EMFObservables-API?
>>
>> EMFObservables.observeMapValue(
>> myBuilding,
>> DocumentModelPackage.Literals.DOCUMENT_PROPERTY,
>> "title",
>> DocumentModelPackage.Literals.DOCUMENT_PROPERTY_MAP__VALUE
>> )
>>
>>
>> Tom
>>
>> Kai Schlamp schrieb:
>>> Comment below
>>>
>>>> This should yield you an EObject you can observe like all the other
>>>> examples:
>>>>
>>>> (EObject)myBuilding.getProps().get(getProps().indexOfKey("height "))
>>>>
>>>> Presumably there is a XyzPackage.Literals.STRING_TO_ABC_MAP__VALUE
>>>> feature for that map entry...
>>> Yes, this works fine.
>>>
>>> Here a little example of how a complete binding looks like:
>>>
>>> bindingContext.bindValue(SWTObservables.observeText(textFiel d),
>>> EMFObservables.observeValue((EObject)
>>> document.getProperties().get(document.getProperties().indexO fKey( "title")),
>>> DocumentModelPackage.Literals.DOCUMENT_PROPERTY_MAP__VALUE), null, null);
>>>
>>> Thanks Ed.
>>
>
>
|
|
|
Re: [JFace Databinding] Bind EMap value to Text [message #506317 is a reply to message #506276] |
Wed, 06 January 2010 18:58 |
Thomas Schindl Messages: 6651 Registered: July 2009 |
Senior Member |
|
|
Probably I removed it in later iterations (I really can't even remember
this very discussion) :-(. I guess you are in need of such a method right?
If you need something file a bugzilla and CC me on the bug. I hope I can
find some time and motivation (I'm trying hard to remotivate myself but
didn't fully succeeded yet) to spend on EMF-Databinding .
Tom
Am 06.01.10 19:18, schrieb Thomas Kowatsch:
> Hi Tom.
> Do I miss something? I cannot find this method in the EMFObservable class.
> --Thomas
>
> Tom Schindl schrieb:
>> Hi,
>>
>> I added a factory method to my current working branch of EMF-Databinding
>> [1] (where I mainly implement the IProperty-Interfaces of 3.5).
>>
>> You can fetch the sources from my public git repo [2] which also
>> provides a nice RCP Example Application showing many (if not all aspects
>> of Eclipse-Databinding with EMF).
>>
>> If you are interested in EMF-Technologies (Ecore, Teneo, CDO) and RCP
>> I'll present all those concepts at EclipseCon 2009 [3].
>>
>> Tom
>>
>> [1]https://bugs.eclipse.org/bugs/show_bug.cgi?id=262160
>> [2] http://github.com/tomsontom/emf-databinding-example/tree/mas ter
>> [3]Mixing Eclipse Technologies to create Enterprise Ready
>> Database-RCP-Frontends - http://www.eclipsecon.org/2009/sessions?id=446
>>
>>
>> Tom Schindl schrieb:
>>> Should we provide this as part of our EMFObservables-API?
>>>
>>> EMFObservables.observeMapValue(
>>> myBuilding,
>>> DocumentModelPackage.Literals.DOCUMENT_PROPERTY,
>>> "title",
>>> DocumentModelPackage.Literals.DOCUMENT_PROPERTY_MAP__VALUE
>>> )
>>>
>>>
>>> Tom
>>>
>>> Kai Schlamp schrieb:
>>>> Comment below
>>>>
>>>>> This should yield you an EObject you can observe like all the other
>>>>> examples:
>>>>>
>>>>>
>>>>> (EObject)myBuilding.getProps().get(getProps().indexOfKey("height "))
>>>>>
>>>>> Presumably there is a XyzPackage.Literals.STRING_TO_ABC_MAP__VALUE
>>>>> feature for that map entry...
>>>> Yes, this works fine.
>>>>
>>>> Here a little example of how a complete binding looks like:
>>>>
>>>> bindingContext.bindValue(SWTObservables.observeText(textFiel d),
>>>> EMFObservables.observeValue((EObject)
>>>> document.getProperties().get(document.getProperties().indexO fKey( "title")),
>>>>
>>>> DocumentModelPackage.Literals.DOCUMENT_PROPERTY_MAP__VALUE), null,
>>>> null);
>>>>
>>>> Thanks Ed.
>>>
>>
>>
|
|
| | |
Goto Forum:
Current Time: Mon Sep 16 17:18:47 GMT 2024
Powered by FUDForum. Page generated in 0.05427 seconds
|