Skip to main content



      Home
Home » Modeling » EMF » [DataBinding] FeaturePath for "many" features?
[DataBinding] FeaturePath for "many" features? [message #512232] Thu, 04 February 2010 08:14
Eclipse UserFriend
Hi all,

My model an "A" EClass which has an EReference "BList" (1..*). "A" has
also an EAttribute "AttrA". The "B" EClass has an EAttribute "AttrB".

A --> B -> AttrB
|-> B -> AttrB
`-> B -> AttrB
A --> B -> AttrB
|-> B -> AttrB
`-> B -> AttrB

Now I display all "A -> AttrA" in a TableViewer with an image in front
of each row. So far so good, the code below works perfectly.

....

IObservableSet set= cp.getKnownElements();

IObservableMap[] map= new IObservableMap[]{
EMFProperties.value(Package.Literals.A__ATTRA)
.observeDetail(set),
};

_viewer.setLabelProvider(new MyObservableMapLabelProvider(map));

....

Now I need to decorate the image a bit. The decoration depends on the
value of "B -> AttrB". My label provider receives an instance of "A",
iterates over the "BList", looks at "AttrB" and can return the right
decoration.

The problem is that my label provider should be notified when either
"BList" or "AttrB" change. I have try to use FeaturePath (see below) but
it does not work because "BList" is multi-valued.

....

IObservableSet set= cp.getKnownElements();

IObservableMap[] map= new IObservableMap[]{
EMFProperties.value(Package.Literals.A__ATTRA)
.observeDetail(set),
EMFProperties.value(FeaturePath.fromList(
Package.Literals.A__BLIST,
Package.Literals.B__ATTRB))
.observeDetail(set)
};

_viewer.setLabelProvider(new MyObservableMapLabelProvider(map));

....

I also try something like:

IObservableList list= EMFProperties.list(Package.Literals.A__BLIST)
.observeDetail(set /* does not compile */);
IObservableValue value = EMFProperties.value(Package.Literals.B__ATTRB)
.observeDetail(list);

But IEMFListProperty can only observe an IObservableValue and not e.g.
IObservableSet (would that make sense?).

I don't see any simple solutions to this but as I'm new to all these
things, I may have missed something. Any suggestions?

Thank you.
Cyril
Re: [DataBinding] FeaturePath for "many" features? [message #512319 is a reply to message #512232] Thu, 04 February 2010 06:40 Go to previous message
Eclipse UserFriend
> The problem is that my label provider should be notified when either
> "BList" or "AttrB" change. I have try to use FeaturePath (see below) but
> it does not work because "BList" is multi-valued.
>

There is already a bug about this:

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

I will give this a try:

http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg4 2457.html

Cyril
Previous Topic:EMF serialize custom xml
Next Topic:DataBinding + Validation Framework
Goto Forum:
  


Current Time: Sun Jul 13 09:49:08 EDT 2025

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

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

Back to the top