Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Accessing nested features
Accessing nested features [message #637376] Fri, 05 November 2010 09:59 Go to next message
Patrick is currently offline PatrickFriend
Messages: 17
Registered: August 2010
Location: Rome
Junior Member
Hi All,

assume I have a model like this:

http://dl.dropbox.com/u/4830862/sample_model.png

is it possible to observe the list of terms defined in the concrete subclass MySpecificCondition navigating the relations from the root (master) object MyDefinition ? I wrote this but don't work:

IEMFListProperty terms = EMFProperties.list(
				FeaturePath.fromList(
						SamplePackage.Literals.MY_DEFINITION__CONDITION,
						SamplePackage.Literals.MY_SPECIFIC_CONDITION__TERMS
				)
		);


If instead the list of terms was defined in the superclass the above list is correctly retrieved.

For your convenience here is the model ecore http://dl.dropbox.com/u/4830862/sample.ecore

Tnanks a lot for your help

Regards,
Patrick

Re: Accessing nested features [message #637383 is a reply to message #637376] Fri, 05 November 2010 10:10 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6505
Registered: July 2009
Senior Member
Could you provide a complete project I can run locally to see what happens?

Tom

Am 05.11.10 10:59, schrieb Patrick:
> Hi All,
>
> assume I have a model like this:
>
>
>
> is it possible to observe the list of terms defined in the concrete
> subclass MySpecificCondition navigating the relations from the root
> (master) object MyDefinition ? I wrote this but don't work:
>
>
> IEMFListProperty terms = EMFProperties.list(
> FeaturePath.fromList(
> SamplePackage.Literals.MY_DEFINITION__CONDITION,
> SamplePackage.Literals.MY_SPECIFIC_CONDITION__TERMS
> )
> );
>
>
> If instead the list of terms was defined in the superclass the above
> list is correctly retrieved.
>
> For your convenience here is the model ecore
> http://dl.dropbox.com/u/4830862/sample.ecore
>
> Tnanks a lot for your help
>
> Regards,
> Patrick
>
>
Re: Accessing nested features [message #637496 is a reply to message #637376] Fri, 05 November 2010 20:06 Go to previous message
Patrick is currently offline PatrickFriend
Messages: 17
Registered: August 2010
Location: Rome
Junior Member
Hi,

I solved the problem... indeed the problem was me... I was using the wrong input to the viewer Sad the IEMFListProperty works build that way works fine.

Now I have another problem and I'd like to have your expert advice on how to approach it.

Using the above IEMFListProperty I'm able to observe the list of terms and show them in a ListView:
viewer.setContentProvider(new ObservableListContentProvider());
			viewer.setLabelProvider(new MyConditionTermLabelProvider());
			viewer.setInput(prop.observeDetail(master));

However, the observed object MyConditionTerm is too complex to effectively display it as plain text in a list, so I would use a TreeViewer to show the object structure, that conforms to this model:
http://dl.dropbox.com/u/4830862/extended_sample_model.png
For instance, each MyConditionTerm instance could be represented in a hierarchy like this:
http://dl.dropbox.com/u/4830862/extended_sample_tree.png
The problem I have is that the MyConditionTerm structure is not hierarchical, so I don't know how to setup an ObservableListTreeContentProvider to obtain this result.
How could I arrange things to "transform" the non-hierarchical structure to show up as a hierarchy ? should I leverage custom IObservableFactory and TreeStructureAdvisor ?

Thanks a lot for your help

Here is the updated ecore model http://dl.dropbox.com/u/4830862/sample.ecore

Best Regards,
Patrick

[Updated on: Fri, 05 November 2010 20:12]

Report message to a moderator

Previous Topic:use CDO in an JEE environment?
Next Topic:Command vs. Operation
Goto Forum:
  


Current Time: Thu Oct 24 01:53:53 GMT 2019

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

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

Back to the top