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 10:51 Go to next message
John M. is currently offline John M.
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 11:56 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26014
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.
Re: Before executing AddCommand check for duplicate EKey or run validation [message #922777 is a reply to message #921971] Tue, 25 September 2012 06:23 Go to previous messageGo to next message
John M. is currently offline John M.
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 08:25 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26014
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.
Previous Topic:EMF Editor Menu isEnabled
Next Topic:Why MetamodelPackage.Literals.Type_Attribute...
Goto Forum:
  


Current Time: Tue Sep 02 02:49:33 EDT 2014

Powered by FUDForum. Page generated in 0.02175 seconds