Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » DefaultGlobalScopeProvider and "class path mechanism"
DefaultGlobalScopeProvider and "class path mechanism" [message #1388436] Thu, 26 June 2014 12:54 Go to next message
Gregoire Dupe is currently offline Gregoire DupeFriend
Messages: 75
Registered: September 2009
Location: France
Member
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 16:34 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
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());
		}

		
	}

}



Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Settings two attributes when consuming one token
Next Topic:Making QualifiedNamed reference an EObject
Goto Forum:
  


Current Time: Thu Apr 25 13:15:46 GMT 2024

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

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

Back to the top