Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [Databinding API] Path over multi-valued features
[Databinding API] Path over multi-valued features [message #431519] Wed, 15 July 2009 08:48 Go to next message
Henning Groenda is currently offline Henning GroendaFriend
Messages: 11
Registered: July 2009
Junior Member
If i have the following model:
X {
List<Y> y;
}
Y {
List<Z> z;
}
the EMFObersvables.list(FeaturePath.fromList(MyPackage.Literals. X__y,
MyPackage.Literals.Y__z)) is not working as y is a multi-valued feature.
How can i manage to get list of all z's for a given instance of X?

Thanks for your help,
Henning
Re: [Databinding API] Path over multi-valued features [message #431538 is a reply to message #431519] Wed, 15 July 2009 13:55 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
It looks like you opened
https://bugs.eclipse.org/bugs/show_bug.cgi?id=283498

Henning Groenda wrote:
> If i have the following model:
> X {
> List<Y> y;
> }
> Y {
> List<Z> z;
> }
> the EMFObersvables.list(FeaturePath.fromList(MyPackage.Literals. X__y,
> MyPackage.Literals.Y__z)) is not working as y is a multi-valued
> feature. How can i manage to get list of all z's for a given instance
> of X?
>
> Thanks for your help,
> Henning
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [Databinding API] Path over multi-valued features [message #431539 is a reply to message #431519] Wed, 15 July 2009 14:02 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Hi,

I hacked up something to which uses but I need to discuss with Matt Hall
to find out if some hidden magic stuff in Eclipse-Databinding could help.

---------8<-------------
> new ComputedList() {
> private IObservableList l = EMFProperties.list(MyPackage.Literals.X__y).observe(target);
>
> private Map<Y, IObservableList> listMap = new HashMap<Y, IObservableList>();
>
> {
> l.addListChangeListener(new IListChangeListener() {
>
> @Override
> public void handleListChange(ListChangeEvent event) {
> event.diff.accept(new ListDiffVisitor() {
>
> @Override
> public void handleRemove(int index, Object element) {
> listMap.remove(element).dispose();
> }
>
> @Override
> public void handleAdd(int index, Object element) {
>
> }
> });
> }
> });
> }
>
> @Override
> protected List<?> calculate() {
> List<Object> rv = new ArrayList<Object>();
> for( Object o : l ) {
> IObservableList list = listMap.get(o);
> if( list != null ) {
> rv.addAll(list);
> } else {
> IObservableList obsList = EMFProperties.list(MyPackage.Literals.Y__z).observe(o);
> listMap.put((Y) o, obsList);
> rv.addAll(obsList);
> }
> }
> return rv;
> }
> };
---------8<-------------

What we'd like to have in the end is a MultiList where sublists can be
added and removed. The above is a 5 minute hack but from my tests it
looks like it is working as expected.

Tom

Henning Groenda schrieb:
> If i have the following model:
> X {
> List<Y> y;
> }
> Y {
> List<Z> z;
> }
> the EMFObersvables.list(FeaturePath.fromList(MyPackage.Literals. X__y,
> MyPackage.Literals.Y__z)) is not working as y is a multi-valued feature.
> How can i manage to get list of all z's for a given instance of X?
>
> Thanks for your help,
> Henning
>
Re: [Databinding API] Path over multi-valued features [message #431540 is a reply to message #431539] Wed, 15 July 2009 15:09 Go to previous messageGo to next message
Matthew Hall is currently offline Matthew HallFriend
Messages: 368
Registered: July 2009
Senior Member
Tom Schindl wrote:
> Hi,
>
> I hacked up something to which uses but I need to discuss with Matt Hall
> to find out if some hidden magic stuff in Eclipse-Databinding could help.

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

Matthew
Re: [Databinding API] Path over multi-valued features [message #431541 is a reply to message #431540] Wed, 15 July 2009 15:22 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Ha - I was so sure you've something like this in your queue :-)

Tom

Matthew Hall schrieb:
> Tom Schindl wrote:
>> Hi,
>>
>> I hacked up something to which uses but I need to discuss with Matt Hall
>> to find out if some hidden magic stuff in Eclipse-Databinding could help.
>
> See https://bugs.eclipse.org/bugs/show_bug.cgi?id=263714
>
> Matthew
Re: [Databinding API] Path over multi-valued features [message #431562 is a reply to message #431539] Thu, 16 July 2009 16:43 Go to previous messageGo to next message
Henning Groenda is currently offline Henning GroendaFriend
Messages: 11
Registered: July 2009
Junior Member
Hi Tom,

thanks for your quick solution. It also seems to work fine for me :)

Best regards,
Henning
Re: [Databinding API] Path over multi-valued features [message #431563 is a reply to message #431538] Thu, 16 July 2009 16:47 Go to previous message
Henning Groenda is currently offline Henning GroendaFriend
Messages: 11
Registered: July 2009
Junior Member
Hi Ed,

> It looks like you opened
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=283498
that's true. The bug was aimed to document the behaviour in JavaDoc. I
assumed that it will take longer to develop the wanted functionality. But
i still wanted to ask you for advice on a temporary solution.

Best regards,
Henning
Previous Topic:[CDO] Derby drivers
Next Topic:edit FeatureMap Text feature from text field in a form
Goto Forum:
  


Current Time: Fri Apr 19 20:59:24 GMT 2024

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

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

Back to the top