Skip to main content



      Home
Home » Modeling » EMF » Get all object with specific value
Get all object with specific value [message #727011] Tue, 20 September 2011 03:55 Go to next message
Eclipse UserFriend
Hi,

I guess it's a simple question, but I can't find the answer...

I have a Resource with objects of type A. These objects have a reference to object B. How can I retrieve all objects in the resource with a specific object B. So three objects have a reference to object B with id=1. I want to retrieve those three objects..

It needs to be a ObservableList, so I can set it as an input of my tableviewer..

Thanks in advance.
Re: Get all object with specific value [message #727085 is a reply to message #727011] Tue, 20 September 2011 07:23 Go to previous messageGo to next message
Eclipse UserFriend
Ricky,

EcoreUtil.UsageCrossReferencer can be used for something like this. Or
you can use Resource.getAllContents() to iterate over all objects in the
resource, determine which ones are instances of A, and then determine
which of those reference the particular B of interest. I'm not sure
how to turn the result into an observable list.



On 20/09/2011 3:55 AM, Ricky de Klerck wrote:
> Hi,
>
> I guess it's a simple question, but I can't find the answer...
>
> I have a Resource with objects of type A. These objects have a
> reference to object B. How can I retrieve all objects in the resource
> with a specific object B. So three objects have a reference to object
> B with id=1. I want to retrieve those three objects..
>
> It needs to be a ObservableList, so I can set it as an input of my
> tableviewer..
>
> Thanks in advance.
Re: Get all object with specific value [message #727087 is a reply to message #727085] Tue, 20 September 2011 07:29 Go to previous message
Eclipse UserFriend
Using a ComputedList but an important fact is that you need to observe
all elements because you need to recalculate the value once the
reference of an object changes!

Tom

Am 20.09.11 13:23, schrieb Ed Merks:
> Ricky,
>
> EcoreUtil.UsageCrossReferencer can be used for something like this. Or
> you can use Resource.getAllContents() to iterate over all objects in the
> resource, determine which ones are instances of A, and then determine
> which of those reference the particular B of interest. I'm not sure
> how to turn the result into an observable list.
>
>
>
> On 20/09/2011 3:55 AM, Ricky de Klerck wrote:
>> Hi,
>>
>> I guess it's a simple question, but I can't find the answer...
>>
>> I have a Resource with objects of type A. These objects have a
>> reference to object B. How can I retrieve all objects in the resource
>> with a specific object B. So three objects have a reference to object
>> B with id=1. I want to retrieve those three objects..
>>
>> It needs to be a ObservableList, so I can set it as an input of my
>> tableviewer..
>>
>> Thanks in advance.
Re: Get all object with specific value [message #727089 is a reply to message #727011] Tue, 20 September 2011 07:23 Go to previous message
Eclipse UserFriend
Ricky,

EcoreUtil.UsageCrossReferencer can be used for something like this. Or
you can use Resource.getAllContents() to iterate over all objects in the
resource, determine which ones are instances of A, and then determine
which of those reference the particular B of interest. I'm not sure
how to turn the result into an observable list.



On 20/09/2011 3:55 AM, Ricky de Klerck wrote:
> Hi,
>
> I guess it's a simple question, but I can't find the answer...
>
> I have a Resource with objects of type A. These objects have a
> reference to object B. How can I retrieve all objects in the resource
> with a specific object B. So three objects have a reference to object
> B with id=1. I want to retrieve those three objects..
>
> It needs to be a ObservableList, so I can set it as an input of my
> tableviewer..
>
> Thanks in advance.
Re: Get all object with specific value [message #727091 is a reply to message #727085] Tue, 20 September 2011 07:29 Go to previous message
Eclipse UserFriend
Using a ComputedList but an important fact is that you need to observe
all elements because you need to recalculate the value once the
reference of an object changes!

Tom

Am 20.09.11 13:23, schrieb Ed Merks:
> Ricky,
>
> EcoreUtil.UsageCrossReferencer can be used for something like this. Or
> you can use Resource.getAllContents() to iterate over all objects in the
> resource, determine which ones are instances of A, and then determine
> which of those reference the particular B of interest. I'm not sure
> how to turn the result into an observable list.
>
>
>
> On 20/09/2011 3:55 AM, Ricky de Klerck wrote:
>> Hi,
>>
>> I guess it's a simple question, but I can't find the answer...
>>
>> I have a Resource with objects of type A. These objects have a
>> reference to object B. How can I retrieve all objects in the resource
>> with a specific object B. So three objects have a reference to object
>> B with id=1. I want to retrieve those three objects..
>>
>> It needs to be a ObservableList, so I can set it as an input of my
>> tableviewer..
>>
>> Thanks in advance.
Previous Topic:How to create a diagram instance from an Ecore model?
Next Topic:Re: [CDO] References across two EMF models
Goto Forum:
  


Current Time: Fri Oct 24 13:04:25 EDT 2025

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

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

Back to the top