Skip to main content



      Home
Home » Modeling » TMF (Xtext) » DefaultGlobalScopeProvider and "class path mechanism"
DefaultGlobalScopeProvider and "class path mechanism" [message #1388436] Thu, 26 June 2014 08:54 Go to next message
Eclipse UserFriend
Hello,

I would like to be able to resolve a reference from a qualified name based on the Java class path. Assuming that I've one file 'F1.myDsl' (stored in the package com.example.app1) referring to another file 'F2.myDSL' (stored in the package com.example.app2) :

myApp F1 {
ref com.example.app2.F2
}

The linking works fine when I load manually F2 and F1 in the resourceSet, but when I load only F1 (expecting that DefaultGlobalScopeProvider would find F2) the linking fail.

Can anybody tell me how to enable the the "class path mechanism"?

Regards,
Grégoire
Re: DefaultGlobalScopeProvider and "class path mechanism" [message #1388569 is a reply to message #1388436] Thu, 26 June 2014 12:34 Go to previous message
Eclipse UserFriend
HI,

am not sure if i get your problem. and i dont know such a possibity, but the following works for me

Model:
	greetings+=Greeting*;
	
Greeting:
	'Hello' name=ID ('from' from=[Greeting]) '!';


public class Main {
	
	public static void main(String[] args) throws IOException {
		Reader reader = new Reader();
		reader.setUseJavaClassPath(true);
		reader.addRegister(new MyDslStandaloneSetup());
		reader.addPath("models");
		SlotEntry outputSlot = new SlotEntry();
		outputSlot.setType("Greeting");
		reader.addLoad(outputSlot);
		WorkflowContextImpl ctx = new WorkflowContextImpl();
		reader.invoke(ctx);
		for(Greeting g : (List<Greeting>)ctx.get("model")) {
			System.out.println(g.getName() + " " + g.getFrom());
		}

		
	}

}

Previous Topic:Settings two attributes when consuming one token
Next Topic:Making QualifiedNamed reference an EObject
Goto Forum:
  


Current Time: Fri Jul 04 11:24:23 EDT 2025

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

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

Back to the top