Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Problems with scoping
Problems with scoping [message #768341] Tue, 20 December 2011 00:01 Go to next message
Jens Missing name is currently offline Jens Missing nameFriend
Messages: 27
Registered: November 2011
Junior Member
hi,

I would like to create multiple windows.
That's why I need a scope for each window..

But it doesen't work.
I think the getScope function will not be called.

I hope you can help me. Is the getScope function correct?


Here is my gui-dsl:

DomainModel:
	(elements+=PackageDeclaration);
	
PackageDeclaration:
	'package' name=QualifiedName '{'
		elements+=Window*
	'}';

QualifiedName:
	ID ('.' ID)*;

Window:
	'window' name=ID '{'
		& 'sizeX' sizeX = INTEGER & 'sizeY' sizeY = INTEGER & ('title' title = STRING)? &
		((tabContainer=TabContainer) | (panel+=Panel)+)	 
	'}'
;



public IScope getScope(Window w, EReference eRef) {
	 // Go to graph root
	 EObject root = w;
	 while(root.eContainer() != null) {
	   root = root.eContainer();
	 }
		
	 // Traverse whole model-graph and save Containers to List
	 List<Container> container = new ArrayList<Container>();
	 for(TreeIterator<EObject> it = root.eAllContents(); it.hasNext();) {
	   EObject o = it.next();
	   if(o instanceof Container) {
		 container.add((Container)o);
	   }
	 }
	 return scopeFor(container);
}	



[Updated on: Tue, 20 December 2011 00:06]

Report message to a moderator

Re: Problems with scoping [message #768472 is a reply to message #768341] Tue, 20 December 2011 08:12 Go to previous message
Meinte Boersma is currently offline Meinte BoersmaFriend
Messages: 434
Registered: July 2009
Location: Leiden, Netherlands
Senior Member
For what cross-reference would you expect the scope to be called? There are no cross-references (like "[Window]") in your grammar.

Previous Topic:Create Xtext/Xbase project with predefined ecore model
Next Topic:[Xtend] protected/public extensions not visible to subclasses
Goto Forum:
  


Current Time: Thu Apr 25 03:57:25 GMT 2024

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

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

Back to the top