Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » How to select particular elements, based on current state of element in edit part
How to select particular elements, based on current state of element in edit part [message #501520] Wed, 02 December 2009 16:05 Go to next message
Timothy Marc is currently offline Timothy MarcFriend
Messages: 547
Registered: July 2009
Senior Member
Hi all,

let's try to explain my problem: I have a model, where an element A has
a reference A::ab to B and A::az Z. B itself has a containment reference
B::bz[0..*] to Z. For the drop down box in my editor, i just want to
display all the Z elements, which are selecteable via A::ab->B::bz.

In OCL this should be quite easy:

context A
inv:: if self:az <> null then self.ab.az->exist(self.az);

Haven't tried this, but it must be this way or similar. But, how can i
affect this for the edit part? I've looked inside the EMF book, but i
didn't found an answer.

Is it clear, what i mean?

Thanks
Timothy
Re: How to select particular elements, based on current state of element in edit part [message #501526 is a reply to message #501520] Wed, 02 December 2009 16:22 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30635
Registered: July 2009
Senior Member
Timothy,

Comments below.

Timothy Marc wrote:
> Hi all,
>
> let's try to explain my problem: I have a model, where an element A
> has a reference A::ab to B and A::az Z. B itself has a containment
> reference B::bz[0..*] to Z. For the drop down box in my editor, i just
> want to display all the Z elements, which are selecteable via
> A::ab->B::bz.
>
> In OCL this should be quite easy:
>
> context A
> inv:: if self:az <> null then self.ab.az->exist(self.az);
>
> Haven't tried this, but it must be this way or similar. But, how can i
> affect this for the edit part? I've looked inside the EMF book, but i
> didn't found an answer.
You can specialize A::az's property descriptor's getChoiceOfValues. At
that point you'll have access to an A instance and will be able to
return a collection containing null and a.getAb().getBz().
>
> Is it clear, what i mean?
Look in EReferenceItemProvider.addEOppositePropertyDescriptor for a
similar example.
>
> Thanks
> Timothy
Re: How to select particular elements, based on current state of element in edit part [message #501635 is a reply to message #501526] Thu, 03 December 2009 08:22 Go to previous message
Timothy Marc is currently offline Timothy MarcFriend
Messages: 547
Registered: July 2009
Senior Member
Dear Ed,

thanks! A wonderfull hint and simple to implement... take such simple
but effecive thinks like this into account for the next version auf the
EMF book.

Cheers
Timothy

Ed Merks schrieb:
> Timothy,
>
> Comments below.
>
> Timothy Marc wrote:
>> Hi all,
>>
>> let's try to explain my problem: I have a model, where an element A
>> has a reference A::ab to B and A::az Z. B itself has a containment
>> reference B::bz[0..*] to Z. For the drop down box in my editor, i just
>> want to display all the Z elements, which are selecteable via
>> A::ab->B::bz.
>>
>> In OCL this should be quite easy:
>>
>> context A
>> inv:: if self:az <> null then self.ab.az->exist(self.az);
>>
>> Haven't tried this, but it must be this way or similar. But, how can i
>> affect this for the edit part? I've looked inside the EMF book, but i
>> didn't found an answer.
> You can specialize A::az's property descriptor's getChoiceOfValues. At
> that point you'll have access to an A instance and will be able to
> return a collection containing null and a.getAb().getBz().
>>
>> Is it clear, what i mean?
> Look in EReferenceItemProvider.addEOppositePropertyDescriptor for a
> similar example.
>>
>> Thanks
>> Timothy
Previous Topic:[Teneo] library example editor
Next Topic:Issue with persisting and loading of EMF Enum entities
Goto Forum:
  


Current Time: Fri Nov 15 20:16:19 GMT 2019

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

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

Back to the top