Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [Newbie] Filtering selection choices on references?
[Newbie] Filtering selection choices on references? [message #548972] Fri, 23 July 2010 14:53 Go to next message
Andreas Goetz is currently offline Andreas GoetzFriend
Messages: 110
Registered: July 2009
Senior Member
Hi there,

please forgive me if this is obvious, but I'm new to EMF and could not
research a solution.

My model contrains references (wires) between objects (sockets), where
each output and input socket must only be connected to one wire (0..1
wires per socket).

I believe I can enforce this through EMF Validation, but would rather
provide that unavailable sockets (i.e. ones that are already connected
to wired) are filtered out from the selection dropdown when modeling the
wire.

Is there a filtering extension point or similiar that would allow to do
this instead of after-the-fact validation? Or some overiding of
"getValidAttibuteChoices" choices in the generated model/ edit code?

Best regards,
Andreas
Re: [Newbie] Filtering selection choices on references? [message #548988 is a reply to message #548972] Fri, 23 July 2010 15:34 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Andreas,

Comments below.

Andreas Goetz wrote:
> Hi there,
>
> please forgive me if this is obvious, but I'm new to EMF and could not
> research a solution.
>
> My model contrains references (wires) between objects (sockets), where
> each output and input socket must only be connected to one wire (0..1
> wires per socket).
>
> I believe I can enforce this through EMF Validation, but would rather
> provide that unavailable sockets (i.e. ones that are already connected
> to wired) are filtered out from the selection dropdown when modeling
> the wire.
>
> Is there a filtering extension point or similiar that would allow to
> do this instead of after-the-fact validation? Or some overiding of
> "getValidAttibuteChoices" choices in the generated model/ edit code?
You'd specialize the property descriptor's getChoiceOfValues to include
only the choices you want. See
ETypedElementItemProvider.addETypePropertyDescriptor.
>
> Best regards,
> Andreas


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [Newbie] Filtering selection choices on references? [message #549096 is a reply to message #548988] Sat, 24 July 2010 10:16 Go to previous messageGo to next message
Andreas Goetz is currently offline Andreas GoetzFriend
Messages: 110
Registered: July 2009
Senior Member
Not quite sure yet:

On 23.07.2010 17:34, Ed Merks wrote:
> Andreas,
>
> Comments below.
>
> Andreas Goetz wrote:
>> Hi there,
>> ...
>> Is there a filtering extension point or similiar that would allow to
>> do this instead of after-the-fact validation? Or some overiding of
>> "getValidAttibuteChoices" choices in the generated model/ edit code?
> You'd specialize the property descriptor's getChoiceOfValues to include
> only the choices you want. See
> ETypedElementItemProvider.addETypePropertyDescriptor.
The generated model classes (all extending a common root model element)
are created by EMF to extend ItemProviderAdapter. I'm lost at where to
get the ETypedElementItemProvider from?
>> Best regards,
>> Andreas
Re: [Newbie] Filtering selection choices on references? [message #549112 is a reply to message #549096] Sat, 24 July 2010 16:04 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Andreas,

The point is to notice how it creates an inner class that extends
ItemPropertyDescriptor and then overrides the getChoiceOfValues method.
You'll do that in your own item provider for the property in question.


Andreas Goetz wrote:
> Not quite sure yet:
>
> On 23.07.2010 17:34, Ed Merks wrote:
>> Andreas,
>>
>> Comments below.
>>
>> Andreas Goetz wrote:
>>> Hi there,
>>> ...
>>> Is there a filtering extension point or similiar that would allow to
>>> do this instead of after-the-fact validation? Or some overiding of
>>> "getValidAttibuteChoices" choices in the generated model/ edit code?
>> You'd specialize the property descriptor's getChoiceOfValues to include
>> only the choices you want. See
>> ETypedElementItemProvider.addETypePropertyDescriptor.
> The generated model classes (all extending a common root model
> element) are created by EMF to extend ItemProviderAdapter. I'm lost at
> where to get the ETypedElementItemProvider from?
>>> Best regards,
>>> Andreas
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:serialization of model instance created by JAVA
Next Topic:Violation of EOpposites of cross references
Goto Forum:
  


Current Time: Sat Mar 30 01:28:46 GMT 2024

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

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

Back to the top