Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » EVL constraints dont work
EVL constraints dont work [message #1059082] Thu, 16 May 2013 15:03 Go to next message
serhat gezgin is currently offline serhat gezginFriend
Messages: 243
Registered: January 2013
Location: Izmir
Senior Member
Hi all,

When i write this validation to my model;

constraint doldur {
		
		guard : self.satisfies('IllegalCharactersForName')
		
		check {
			if(self.ownedField.select(f | f.name = "Text").size() <> 1){
				var text = new TextField;
				text.name = "Text";
				text.displayName = "Text";
				self.ownedField.add(text);
			}
		
			if(self.ownedField.excludes(text)){
					return false;
			}
			return true;
		}
		
		message : 'laaaa'
	}


i always get error (atached picture and txt file shows error)

But i need to create element from validation so how can i do this

anyone can help me ?

Regards
  • Attachment: EVLError.png
    (Size: 222.71KB, Downloaded 180 times)
  • Attachment: EVLError.txt
    (Size: 17.02KB, Downloaded 343 times)
Re: EVL constraints dont work [message #1059093 is a reply to message #1059082] Thu, 16 May 2013 15:44 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 597
Registered: January 2010
Location: Birmingham, UK
Senior Member

By design, the EMF Validation framework runs checks from a read-only environment. The model cannot be modified from a check.

If you want a fix, you should add it to the "fix" entry in your constraint. I'm not sure what your constraint is trying to do though: wouldn't it keep adding fields whenever you had zero, two or more fields?

Please explain what you are trying to check for. Do you want to make sure that the model object has an ownedField with a text different from "Text"?
Re: EVL constraints dont work [message #1059100 is a reply to message #1059093] Thu, 16 May 2013 17:09 Go to previous messageGo to next message
serhat gezgin is currently offline serhat gezginFriend
Messages: 243
Registered: January 2013
Location: Izmir
Senior Member
Hi

I want to have a TextField in the list (as default ever list must have TextField) so

when user create WebList and than save this model, validation works and create

TextField. I just need an auto complete strategy for list. (if WebList have Fields it

means TextField created before)

so how can i done this i dont know how can i do this ?

Regards
Re: EVL constraints dont work [message #1059119 is a reply to message #1059100] Thu, 16 May 2013 20:13 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2175
Registered: July 2009
Location: York, UK
Senior Member

Hi,

It may be the case that a more natural solution would be to auto-create a text field every time you create a WebList. To do this, you'd need to modify the generated code as discussed in [1].

Cheers,
Dimitris

[1] http://www.eclipse.org/forums/index.php/mv/msg/486121/1056056/#msg_1056056
Re: EVL constraints dont work [message #1059176 is a reply to message #1059119] Fri, 17 May 2013 06:51 Go to previous message
serhat gezgin is currently offline serhat gezginFriend
Messages: 243
Registered: January 2013
Location: Izmir
Senior Member
Thanks it works for me

Regards
Previous Topic:EuGENia Annotations
Next Topic:Create Element from Diagram
Goto Forum:
  


Current Time: Thu May 09 16:26:59 GMT 2024

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

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

Back to the top