Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Scoping specific GMF elements in xtext grammar
Scoping specific GMF elements in xtext grammar [message #1060271] Thu, 23 May 2013 18:49 Go to next message
Phil H is currently offline Phil HFriend
Messages: 267
Registered: November 2012
Senior Member
Hi,

I've a special use case and not sure if it's possible.
To clarify the initial situtation, I've attached an image:

index.php/fa/15028/0/

As you can see, it's possible to have different super classes. A super class can be extended by a constraint, which should be described by a xtext grammar. What I now want is that when I add a constraint to super class 1, only nodes A,B and C should be able to refer.

At the moment also X and Y would be scoped, cause the resource description searches the whole Resource.

I've no idea if it would be possible to acces the current used node of GMF or if there is another solution. Can anyone give a hint?
Re: Scoping specific GMF elements in xtext grammar [message #1060309 is a reply to message #1060271] Fri, 24 May 2013 06:36 Go to previous messageGo to next message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member
Hi,

I cannot help you with the GMF-related part, but better practice is not to adapt the scoping but rather do validation (and code completion). Limiting the scope will result in generic "could not resolve reference"-errors (yes, you could also adapt those messages). If you implement validation, you can give the user specific error messages, like "you cannot reference X here, because...".

Think of a java assignment:

Long x=(String)y;

What would you think of the java tooling, if you were told that the type String could not be found? After all, it's there (Visibility vs validitiy).

Alex


Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext@itemis.de
Re: Scoping specific GMF elements in xtext grammar [message #1060674 is a reply to message #1060309] Mon, 27 May 2013 16:11 Go to previous message
Phil H is currently offline Phil HFriend
Messages: 267
Registered: November 2012
Senior Member
You're right about the validation aspect, but then a user would see all nodes which is not what I want. A Validation can also be implemented, but what I want is a filtered list which shows the user only valid entries. But the problem here is the interaction with gmf.
Previous Topic:Create Automatically Field in Xtext Editor
Next Topic:Maven errors question
Goto Forum:
  


Current Time: Thu Apr 25 22:42:14 GMT 2024

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

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

Back to the top