Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [SOLVED]Problem with Xtend keywords
[SOLVED]Problem with Xtend keywords [message #1369628] Tue, 20 May 2014 17:22 Go to next message
Alexander R is currently offline Alexander RFriend
Messages: 211
Registered: July 2013
Senior Member
Hello,

I am using a Xtext-Typesystem-API (https://code.google.com/a/eclipselabs.org/p/xtext-typesystem/) which provides me the following operaton:

 typeof(EObject obj, TypeCalculationTrace trace);


I want to use this operation in my : MydslValidator.xtend - class, but it is not possible because Xtend reserve this operationname as a keyword.

Is there a possibility to use this operation without wrapping it in an own Javaclass?

~Alex

[Updated on: Wed, 21 May 2014 09:04]

Report message to a moderator

Re: Problem with Xtend keywords [message #1369654 is a reply to message #1369628] Tue, 20 May 2014 17:38 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi does it work to escape with ^keyword

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Problem with Xtend keywords [message #1369718 is a reply to message #1369654] Tue, 20 May 2014 18:11 Go to previous messageGo to next message
Alexander R is currently offline Alexander RFriend
Messages: 211
Registered: July 2013
Senior Member
Hi,
you made my day (or better night..Smile)!!

Thank you! Is it maybe possible to define more than one validator? maybe one in Xtend and another one in Java?
I read something about it here: http://blog.dietmar-stoll.de/2013/04/multiple-validators-in-xtext.html but I'm not sure, that I can combine Java and Xtend validators.

~Alex
Re: Problem with Xtend keywords [message #1369812 is a reply to message #1369718] Tue, 20 May 2014 19:05 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
you can add subvalidators using the annotation @ComposedChecks on the main validator class

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Problem with Xtend keywords [message #1369813 is a reply to message #1369812] Tue, 20 May 2014 19:06 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
it does not play a role if they are written in java or in xtend

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Problem with Xtend keywords [message #1371153 is a reply to message #1369628] Wed, 21 May 2014 08:39 Go to previous messageGo to next message
Alexander R is currently offline Alexander RFriend
Messages: 211
Registered: July 2013
Senior Member
Hi,

I'm a litte bit confused, cause it didn't work out for me. I'm doing the following steps:

1. Adding a composedCheck in my XTEND-MyDslValidator:
@ComposedChecks (validators = { CustomValidator.class })
class MyDslValidator extends AbstractCdalfValidator{
..
}

2. Create a Javaclass in the same validation package that looks like this:
public class CustomValidator extends AbstractDeclarativeValidator{

}


Do I have to register the CustomValidator.class also in the xtext runtime module or maybe in the .mwe2 file?
I also getting the following error in the Xtend-Validator-class:

The value for an annotation attribute must be a constant expression

Thanks!
[SOLVED] Re: Problem with Xtend keywords [message #1371198 is a reply to message #1371153] Wed, 21 May 2014 09:03 Go to previous message
Alexander R is currently offline Alexander RFriend
Messages: 211
Registered: July 2013
Senior Member
I've opened a new post: http://www.eclipse.org/forums/index.php/m/1371197/#msg_1371197

[Updated on: Wed, 21 May 2014 09:04]

Report message to a moderator

Previous Topic:Best way to access Properties of a Class
Next Topic: [SOLVED] @ComposedChecks in MyDslValidator.xtend - class
Goto Forum:
  


Current Time: Thu Mar 28 13:34:43 GMT 2024

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

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

Back to the top