Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Help with scoping
Help with scoping [message #722406] Mon, 05 September 2011 17:04 Go to next message
Rafael Angarita is currently offline Rafael AngaritaFriend
Messages: 94
Registered: November 2010
Member
Hello,

I have something like this in my grammar:


ObjectReference:
		type=[VariableType]
;


VariableType:
	Attribute | Domain | ExtendedDataType
;



The problem is that the objects Attribute and Domain are explicitly written by the user, while the object ExtendedDataType is an implicit object of my DSL.

My first thought was to simply write a scoping method like this:


public IScope scope_VariableType(EObject context, EReference reference) {

		
        //get the list of my implicit objects
	Interface i = ElementFactory.getFactory().getInterfaceByName("ExtendedDataTypes");
	return Scopes.scopeFor(i.getExtendedDataTypes());
}


, but it will only show the ExtendedDataType objects and not the Attribute and Domain objects written by the user.

What approach I can use here to show all the objects I need?

Thanks!
Re: Help with scoping [message #722412 is a reply to message #722406] Mon, 05 September 2011 17:35 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

just a technical solution: see org.eclipse.xtext.scoping.Scopes.scopeFor(Iterable<? extends EObject>, IScope)
and call delegategetscope for the out scope

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Loading the whole project in a Resource
Next Topic:When Including JavaVMTypes MWE generates useless classes
Goto Forum:
  


Current Time: Fri Apr 26 13:32:47 GMT 2024

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

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

Back to the top