Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Accessing the resource set from other plugin(Asking for advice on how to access the resource set from outside)
Accessing the resource set from other plugin [message #909104] Thu, 06 September 2012 14:44 Go to next message
Johan Eker is currently offline Johan EkerFriend
Messages: 6
Registered: August 2012
Junior Member
Hi All,

I kindly ask for a piece of advice on the best way to access my xtext resource set from code running in separate plugins. The use case is very simple, and I would guess also very common. I have created a launch configuration for my DSL and now I want to perform different actions where I need to access the xtext resources.

A naive implementation is to do use the standalone setup, i.e. something like this:

Injector injector = new MyDSLStandaloneSetup().createInjectorAndDoEMFRegistration();
MyDSL dsl = injector.getInstance(MyDSL.class);
dsl.resourceSet // Here is my resource set!

This works ok, but seems kind of stupid since the xtext editor is already running and I only need a way to access it. In addition it seems that running the standalone concurrently with the xtext editor is causing some strange errors.

So what is the best way to get hold of the resource set from the launch configuration?

Thanks,
Johan

Re: Accessing the resource set from other plugin [message #909131 is a reply to message #909104] Thu, 06 September 2012 15:35 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13365
Registered: July 2009
Senior Member
Hi,

never call standalonesetup from withing eclipse!
why do you need guice at all?

you could make the activator of the up plugin visible from other projects
or come up with a guicified activator in your plugins yourself
(monkey see monkey do from the ui project)

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Accessing the resource set from other plugin [message #909250 is a reply to message #909131] Thu, 06 September 2012 20:11 Go to previous messageGo to next message
Johan Eker is currently offline Johan EkerFriend
Messages: 6
Registered: August 2012
Junior Member
Hi Christian,

Thanks for your quick answer. I had a hunch that using standalone from within was a bad idea (one could almost tell from the name:)

My problem is not so much making methods visible from one plugin to another as to how I can get hold of the resource set at all.

Q: How do I get my hands on the resource set in the case that the launch configuration is part of the xtext-dsl plugin?

Thanks,
Johan



Re: Accessing the resource set from other plugin [message #909257 is a reply to message #909250] Thu, 06 September 2012 20:22 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13365
Registered: July 2009
Senior Member
Hi,

sorry i dont get ehat you want to do. what do you mean with this launch config thing.
and that do you mean with "the resourceset"
can you elaborate what you actually want to do.
e.g. something like http://christiandietrich.wordpress.com/2011/10/15/xtext-calling-the-generator-from-a-context-menu/

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Accessing the resource set from other plugin [message #909269 is a reply to message #909257] Thu, 06 September 2012 21:04 Go to previous messageGo to next message
Johan Eker is currently offline Johan EkerFriend
Messages: 6
Registered: August 2012
Junior Member
Sorry for the confusion. Your post is very close to what I want to do, with exception that I do not use xtend for my codegen. With "the resourceset" I mean what you get from the resourceSetProvider in your example ("ResourceSet rs = resourceSetProvider.get(project);")

In your blog post the "resourceSetProvider" is set through guice. Is that the way to do it or can it be done directly with a method call to dsl-plugin?

Thanks for your patience,
Johan
Re: Accessing the resource set from other plugin [message #909284 is a reply to message #909269] Thu, 06 September 2012 21:52 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13365
Registered: July 2009
Senior Member
it is the way. this is done by the executableextensionfactory
Other ways: Besides the previoius answers: no


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Odd double clicking ?
Next Topic:Using Xtext's index/linking machinery in a graphical editor
Goto Forum:
  


Current Time: Wed Feb 26 13:46:25 GMT 2020

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

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

Back to the top