Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » conditional constaints
conditional constaints [message #723677] Fri, 09 September 2011 05:52 Go to next message
John Smith is currently offline John SmithFriend
Messages: 137
Registered: July 2009
Senior Member
I want the lowerBound and the changeable constraints be more flexible.
They shall have different values for certain stages in the lifecycle of
an eobject. While I could do this with the lowerBound constaint by
overriding validate_MultiplicityConforms in the generated Validator
class and then setting eStructuralFeature.setLowerBound() (and resetting
to the old value in the finally block), I not managed to hook into the
changeable implementation. Any idea how to hook into it ? I want a
feature to be readonly in certain lifecycle stages. I do not want to add
adapters to each eobject, because adding the adapters requires support
by the application logic. E.g. a GMF-Editor will not add my adapters.
Also its not very efficient of course.
Re: conditional constaints [message #723779 is a reply to message #723677] Fri, 09 September 2011 12:23 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Comments below.

On 08/09/2011 10:52 PM, exquisitus wrote:
> I want the lowerBound and the changeable constraints be more flexible.
It's not like that we can arbitrarily change how they work.
> They shall have different values for certain stages in the lifecycle
> of an eobject.
That sounds unworkable. The Ecore model is supposed to be static.
> While I could do this with the lowerBound constaint by overriding
> validate_MultiplicityConforms in the generated Validator class and
> then setting eStructuralFeature.setLowerBound() (and resetting to the
> old value in the finally block), I not managed to hook into the
> changeable implementation.
If you need to do something specific to your model, best you do it in
its derived validator via additional constraints.
> Any idea how to hook into it ?
It affects how the model is actually generated. If there's a setter, it
can be called. There's no hook to prevent it.
> I want a feature to be readonly in certain lifecycle stages.
Are you expecting some malicious attempt to change the objects?
> I do not want to add adapters to each eobject, because adding the
> adapters requires support by the application logic.
I don't understand this comment.
> E.g. a GMF-Editor will not add my adapters.
In the end someone is somehow turning something on and off, so what's
wrong with doing that with an adapter as opposed to some mechanism that
doesn't yet exist?
> Also its not very efficient of course.
I have to wonder what problem you're trying to solve...


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:(no subject)
Next Topic:Dependence of codegen.ecore.Generator on Eclipse and alternatives
Goto Forum:
  


Current Time: Fri Apr 26 20:23:32 GMT 2024

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

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

Back to the top