Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Loading resources in web editor
Loading resources in web editor [message #1755350] Thu, 02 March 2017 14:36 Go to next message
SAULO ARAUJO is currently offline SAULO ARAUJOFriend
Messages: 3
Registered: September 2016
Junior Member
Hi,

I have 3 small DSLs:

A describes data sources;
B describes services;
C describes authorizations, i.e., which data sources each service can access.

Some rules of the authorization DSL references non terminals from both the data sources and the services DSLs.

I was able to build web editors for the 3 DSLs. However, the editor for the authorization DSL is not very useful, because its "workspace" does not have data sources or services that an authorization can refer to.

How can I put in the "workspace" of the authorization DSL editor data sources and services?

I tried changing the createInjector method of the AuthorizationsWebSetup class to

	override Injector createInjector() {
		val runtimeModule = new AutorizacoesRuntimeModule()
		val webModule = new AutorizacoesWebModule(executorServiceProvider)
		val injector = Guice.createInjector(Modules.override(runtimeModule).with(webModule))
		
		val datasources = '''
			regen = "jdbc/regen"
			regesp = "jdbc/regesp"
		'''
		val uri = URI.createURI("platform.datasources")
		val resources = injector.getInstance(XtextResourceSet)
		val resource = resources.createResource(uri)
		resource.load(new StringInputStream(datasources), null)	
		
		injector		
	}


But createResource is retuning null.
Re: Loading resources in web editor [message #1755392 is a reply to message #1755350] Thu, 02 March 2017 18:28 Go to previous message
Christian Dietrich is currently online Christian DietrichFriend
Messages: 11104
Registered: July 2009
Senior Member
why not

class MyDslServlet extends XtextServlet {
	
	DisposableRegistry disposableRegistry
	
	override init() {
		super.init()
		MyDslAStandaloneSetup.doSetup();
		MyDslBStandaloneSetup.doSetup();
		val injector = new MyDslWebSetup().createInjectorAndDoEMFRegistration()
		disposableRegistry = injector.getInstance(DisposableRegistry)
	}


or

class MyDslServlet extends XtextServlet {
	
	DisposableRegistry disposableRegistry
	
	override init() {
		super.init()
		MyDslAStandaloneSetup.doSetup();
		MyDslBStandaloneSetup.doSetup();
		val injector = new MyDslWebSetup().createInjectorAndDoEMFRegistration()
		disposableRegistry = injector.getInstance(DisposableRegistry)
	}


class MyDslServlet extends XtextServlet {
	
	DisposableRegistry disposableRegistry
	
	override init() {
		super.init()
		new MyDslAWebSetup().createInjectorAndDoEMFRegistration();
		new MyDslBWebSetup().createInjectorAndDoEMFRegistration();
		val injector = new MyDslWebSetup().createInjectorAndDoEMFRegistration()


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Previous Topic:After Update to 2.11: Error after Clean Projects
Next Topic:Resolving of URIs in XMI files
Goto Forum:
  


Current Time: Thu Aug 24 10:59:49 GMT 2017

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

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