Skip to main content



      Home
Home » Modeling » TMF (Xtext) » [xtext] question on scoping / content assist
[xtext] question on scoping / content assist [message #718555] Wed, 24 August 2011 12:47 Go to next message
Eclipse UserFriend
hi all

first a snippet of my grammar...

BehaviorNodeRule:
	(component = [uml::Component] | componentLiteral = STRING)
	node = Node
	("/" relation += Relation)*
;

Node:
...
	
;

Relation:
...
;


...and of the corresponding method within the scope provider...

	// returns a scope that contains all components contained in the model
	public IScope scope_BehaviorNodeRule_component(BehaviorNodeRule bnr, EReference ref){
		return scopeWithAllComponents();
	}


i created an editor from that grammar (for use within papyrus), and while the editor is working fine, the content assist is not really doing what i expected it to do. i guess it has something to do with either the scope provider or the way the grammar is constructed.

the problem i have is that, if you open the editor and "Ctrl+SPACE" without any input, only "componentLiteral - STRING" is shown as an option, but no components (the scoping method is not called).
i first have to type at least one letter that matches an existing component in order to trigger a call to the scoping method when i open the content assist.
so what i'm looking for is a way to 'force' the content assist to show all possibilities right from the start.

i guess there's an easy solution to this, so it would be very appreciated if someone could point me the way.

cheers

marco
Re: [xtext] question on scoping / content assist [message #718562 is a reply to message #718555] Wed, 24 August 2011 12:59 Go to previous messageGo to next message
Eclipse UserFriend
Hi, using contentassist it may happen that the context (first Parameter of the scope method) is Not a behaviournoderule but One of its parents (due lazy instantiation) so add an additional scope method with the parent as context too

l
public IScope scope_BehaviorNodeRule_component(youparent p, EReference ref){
Re: [xtext] question on scoping / content assist [message #719216 is a reply to message #718562] Fri, 26 August 2011 08:49 Go to previous messageGo to next message
Eclipse UserFriend
ok thank you, that makes sense.
but what's the parent in case the BehaviorNodeRule is the first rule?
Re: [xtext] question on scoping / content assist [message #719225 is a reply to message #719216] Fri, 26 August 2011 09:07 Go to previous message
Eclipse UserFriend
Hi,

debug whether the context object is null. You may also try to use an unassigned action in order to instantiate a model element immediately

BehaviorNodeRule: {BehaviorNodeRule} (component ...
Previous Topic:(no subject)
Next Topic:Initialize editor settings
Goto Forum:
  


Current Time: Fri Jul 04 11:45:27 EDT 2025

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

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

Back to the top