Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Binding: EMFProperties.list() with FeaturePath - Bug ?
Binding: EMFProperties.list() with FeaturePath - Bug ? [message #798111] Tue, 14 February 2012 09:11 Go to next message
Markus Jo is currently offline Markus JoFriend
Messages: 83
Registered: January 2012
Member
Hi,
I have the following Problem:


This version works:

IEMFListProperty lProp = EMFProperties.list(CoachgroupPackage.Literals.DISPOSITION_SEGMENTS__DISPOSITION_SEGMENT);
IEMFValueProperty vProp = lProp.value(new ListElementAccess<Object>()				{

            public int getReadValueIndex(List<Object> list)
            {
                return 0;
            }

            @Override
            public int getWriteValueIndex(List<Object> list)
            {
                return WriteData.NO_INDEX;
            }
        });

IEMFValueProperty detailValue = vProp.value(CoachgroupPackage.Literals.DISPOSITION_SEGMENT__FROM_STATION);
IObservableValue modelObsevable = detailValue.observe(((CoachGroup)getCurrentSelection()).getDispositionSegments());



But when I use an FeaturePath in the lProp and the observeDetail()-Call for the modelObservable instead....it does not work.
FeaturePath featurePath = FeaturePath.fromList(
				CoachgroupPackage.Literals.COACH_GROUP__DISPOSITION_SEGMENTS,
				CoachgroupPackage.Literals.DISPOSITION_SEGMENTS__DISPOSITION_SEGMENT);


IEMFListProperty lProp = EMFProperties.list(featurePath);
IEMFValueProperty vProp = lProp.value(new ListElementAccess<Object>()				{

            public int getReadValueIndex(List<Object> list)
            {
                return 0;
            }

            @Override
            public int getWriteValueIndex(List<Object> list)
            {
                return WriteData.NO_INDEX;
            }
        });

IEMFValueProperty detailValue = vProp.value(CoachgroupPackage.Literals.DISPOSITION_SEGMENT__FROM_STATION);
IObservableValue nightRoute1StartStationNumberModelObsevable = detailValue.observeDetail(masterTreeViewerObservable);







I get a "Cannot Cast Integer to List" because he does not parse the path....he always takes the root object delivered by the masterDetailObservalbe and not the elements down the path.

Does FeaturePath not work with EMFProperties.list() ??


Greetings

[Updated on: Tue, 14 February 2012 09:13]

Report message to a moderator

Re: Binding: EMFProperties.list() with FeaturePath - Bug ? [message #798124 is a reply to message #798111] Tue, 14 February 2012 09:26 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
You can NOT multi-value-feature in a FeaturePath beside the very last
segment.

I even thought we modified FeaturePath to throw an
IllegalArgumentException in this case.

Tom

Am 14.02.12 10:11, schrieb Markus Jo:
>
>
> This works:
>
> IEMFListProperty lProp =
> EMFProperties.list(CoachgroupPackage.Literals.DISPOSITION_SEGMENTS__DISPOSITION_SEGMENT);
>
> IEMFValueProperty vProp = lProp.value(new
> ListElementAccess<Object>() {
>
> public int getReadValueIndex(List<Object> list)
> {
> return 0;
> }
>
> @Override
> public int getWriteValueIndex(List<Object> list)
> {
> return WriteData.NO_INDEX;
> }
> });
>
> IEMFValueProperty detailValue =
> vProp.value(CoachgroupPackage.Literals.DISPOSITION_SEGMENT__FROM_STATION);
> IObservableValue modelObsevable =
> detailValue.observe(((CoachGroup)getCurrentSelection()).getDispositionSegments());
>
>
>
>
> But when I use an FeaturePath in the lProp and the observeDetail()-Call
> for the modelObservable instead....it does not work.
> FeaturePath featurePath = FeaturePath.fromList(
>
> CoachgroupPackage.Literals.COACH_GROUP__DISPOSITION_SEGMENTS,
>
> CoachgroupPackage.Literals.DISPOSITION_SEGMENTS__DISPOSITION_SEGMENT);
>
>
> IEMFListProperty lProp = EMFProperties.list(featurePath);
> IEMFValueProperty vProp = lProp.value(new
> ListElementAccess<Object>() {
>
> public int getReadValueIndex(List<Object> list)
> {
> return 0;
> }
>
> @Override
> public int getWriteValueIndex(List<Object> list)
> {
> return WriteData.NO_INDEX;
> }
> });
>
> IEMFValueProperty detailValue =
> vProp.value(CoachgroupPackage.Literals.DISPOSITION_SEGMENT__FROM_STATION);
> IObservableValue nightRoute1StartStationNumberModelObsevable =
> detailValue.observeDetail(masterTreeViewerObservable);
>
>
>
>
>
>
>
> I get a "Cannot Cast Integer to List" because he does not parse the
> path....he always takes the root object delivered by the
> masterDetailObservalbe and not the elements down the path.
> Does FeaturePath not work with EMFProperties.list() ??
Re: Binding: EMFProperties.list() with FeaturePath - Bug ? [message #798129 is a reply to message #798124] Tue, 14 February 2012 09:30 Go to previous messageGo to next message
Markus Jo is currently offline Markus JoFriend
Messages: 83
Registered: January 2012
Member
Ok, the name is bad.....

CoachgroupPackage.Literals.COACH_GROUP__DISPOSITION_SEGMENTS is NO multi-value.

I used the "s" in the names end because its a wrapper object for the list of segments and then it looks better in the edit-view. That might by why there is no IllegalArgument thrown.

The MulitValue is CoachgroupPackage.Literals.DISPOSITION_SEGMENTS__DISPOSITION_SEGMENT (without s at the end, confusing, i know, sorry)
Re: Binding: EMFProperties.list() with FeaturePath - Bug ? [message #798178 is a reply to message #798129] Tue, 14 February 2012 10:53 Go to previous message
Markus Jo is currently offline Markus JoFriend
Messages: 83
Registered: January 2012
Member
Whichs means the problem is still there..... Does FeaturePath not work with EMFProperties.list() ??
Previous Topic:[CDO] cannot access org.eclipse.emf.cdo.common.id.CDOWithID
Next Topic:[Teneo] Same flags in PersistanceOptions different outcome
Goto Forum:
  


Current Time: Sat Apr 20 01:35:18 GMT 2024

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

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

Back to the top