How to select particular elements, based on current state of element in edit part [message #501520] |
Wed, 02 December 2009 16:05 |
Timothy Marc 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 |
Ed Merks Messages: 33136 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
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
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 |
Timothy Marc 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
|
|
|
Powered by
FUDForum. Page generated in 0.02262 seconds