Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Before executing AddCommand check for duplicate EKey or run validation
Before executing AddCommand check for duplicate EKey or run validation [message #921916] Mon, 24 September 2012 14:51 Go to next message
John M. is currently offline John M.Friend
Messages: 198
Registered: July 2010
Senior Member
Hello,

I have created an AddCommand and I don't want to execute it, if it would cause a violation of a constraints.
In general I think there are two ways to approach it:

- Check the keys for the new key
- run the generated validator

I can't find the key listing for the first way.

For the second way I don't know how to get the context.

Thanks for any advices.
Re: Before executing AddCommand check for duplicate EKey or run validation [message #921971 is a reply to message #921916] Mon, 24 September 2012 15:56 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
John,

Comments below.

On 24/09/2012 4:51 PM, John M. wrote:
> Hello,
>
> I have created an AddCommand and I don't want to execute it, if it
> would cause a violation of a constraints.
> In general I think there are two ways to approach it:
>
> - Check the keys for the new key
> - run the generated validator
The validator will only run against the model in its current state, so
until you actually add it, you can't check if the model with that added
is invalid.
>
> I can't find the key listing for the first way.
Why not? The add command knows where it's doing the add, i.e, the owner
of the command.
>
> For the second way I don't know how to get the context.
I don't see how you'd get the second way to work.
>
> Thanks for any advices.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Before executing AddCommand check for duplicate EKey or run validation [message #922777 is a reply to message #921971] Tue, 25 September 2012 10:23 Go to previous messageGo to next message
John M. is currently offline John M.Friend
Messages: 198
Registered: July 2010
Senior Member
>> I can't find the key listing for the first way.
> Why not? The add command knows where it's doing the add, i.e, the owner
> of the command.
So I have manually to iterate over all and check if the key is contained?
I thought there is perhaps a list of used eKeys or something similar.
Re: Before executing AddCommand check for duplicate EKey or run validation [message #922882 is a reply to message #922777] Tue, 25 September 2012 12:25 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
John,

No, there isn't.

On 25/09/2012 12:23 PM, John M. wrote:
>>> I can't find the key listing for the first way.
>> Why not? The add command knows where it's doing the add, i.e, the
>> owner of the command.
> So I have manually to iterate over all and check if the key is contained?
> I thought there is perhaps a list of used eKeys or something similar.


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:EMF Editor Menu isEnabled
Next Topic:Why MetamodelPackage.Literals.Type_Attribute...
Goto Forum:
  


Current Time: Fri Apr 19 12:47:40 GMT 2024

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

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

Back to the top