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 11:03 Go to next message
serhat gezgin is currently offline serhat gezgin
Messages: 236
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 37 times)
  • Attachment: EVLError.txt
    (Size: 17.02KB, Downloaded 74 times)
Re: EVL constraints dont work [message #1059093 is a reply to message #1059082] Thu, 16 May 2013 11:44 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-Dominguez
Messages: 304
Registered: January 2010
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 13:09 Go to previous messageGo to next message
serhat gezgin is currently offline serhat gezgin
Messages: 236
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 16:13 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris Kolovos
Messages: 796
Registered: July 2009
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 02:51 Go to previous message
serhat gezgin is currently offline serhat gezgin
Messages: 236
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: Tue Jul 29 11:00:35 EDT 2014

Powered by FUDForum. Page generated in 0.01644 seconds