Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » DSL editor without launching new Eclipse instance
DSL editor without launching new Eclipse instance [message #1730714] Wed, 27 April 2016 22:14 Go to next message
Sina Madani is currently offline Sina MadaniFriend
Messages: 109
Registered: November 2015
Location: York, UK
Senior Member
Hi,

I am wondering whether it is possible to use the editor for my DSL within the same Eclipse application that I used to create the grammar (i.e. without right-click -> Run As -> Eclipse Application).

Thanks.
Re: DSL editor without launching new Eclipse instance [message #1730725 is a reply to message #1730714] Thu, 28 April 2016 04:47 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13186
Registered: July 2009
Senior Member
Well you could create a feature and add your plugins to that feature. ( the
xtext 2.10 wizard will have an option for that) then use that feature to
export a p2 repository (update site) for your dsl and install the dsl from
that update site into your eclipse.

https://gitlab.com/cdietrich/xtext-maven-example

Shows an example how to do the with maven. If you have created the feature
you can use the export deplorable features wizard from eclipse manually

But I don't know if this is the reason for your question. Or is it about
round trip


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: DSL editor without launching new Eclipse instance [message #1730832 is a reply to message #1730725] Thu, 28 April 2016 22:05 Go to previous messageGo to next message
Sina Madani is currently offline Sina MadaniFriend
Messages: 109
Registered: November 2015
Location: York, UK
Senior Member
Thanks Christian. The reason I'm asking is because I don't want to have to open up a new eclipse every time I want to check the syntax is correct for a test file.

I don't quite understand how I can do that with maven/p2/repository etc. (I'm relatively new to Eclipse and haven't got a clue what Maven is). I would've thought that it would be quite straightforward since all of the code is there but for some reason it has to be run as a separate Eclipse application? I wish the documentation had step-by-step instructions on how to make the editor standalone.
Re: DSL editor without launching new Eclipse instance [message #1730835 is a reply to message #1730832] Thu, 28 April 2016 23:54 Go to previous messageGo to next message
Miguel Jimenez is currently offline Miguel JimenezFriend
Messages: 38
Registered: July 2015
Member
Hello Sina,

I am not an expert, but here are my two cents:

To have your DSL editor working you need to install some plugins into Eclipse. Those plugins correspond to the projects Xtext creates for you (org.eclipse.xtext.mydsl, org.eclipse.xtext.mydsl.ui, etc.); the reason why you need to open a new Eclipse instance is because your current Eclipse (let's call it your development Eclipse) injects those plugins into a new instance, so you can try the editor.

Now, you normally install plugins in Eclipse by using an update site (a URL pointing to a directory containing several jar files -Eclipse plugins-). To do this you click Help > Install new software, and paste that URL in the text box. What Christian is suggesting to you, is to create a local update site for your DSL, so you can manually install the DSL plugins in your development eclipse. I think this would make your development process a little slower than just right click > run as...
Re: DSL editor without launching new Eclipse instance [message #1730837 is a reply to message #1730832] Fri, 29 April 2016 03:29 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13186
Registered: July 2009
Senior Member
This is what unit tests are for

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: DSL editor without launching new Eclipse instance [message #1730838 is a reply to message #1730837] Fri, 29 April 2016 04:37 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13186
Registered: July 2009
Senior Member
@RunWith(XtextRunner)
@InjectWith(MyDslInjectorProvider)
class MyDslParsingTest{

	@Inject
	ParseHelper<Model> parseHelper;
	
	@Inject
	extension ValidationTestHelper

	@Test 
	def void loadModel() {
		val result = parseHelper.parse('''
			Hello Xtext!!
		''')
		Assert.assertNotNull(result)
		result.assertNoErrors
	}

}


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: DSL editor without launching new Eclipse instance [message #1730847 is a reply to message #1730838] Fri, 29 April 2016 08:58 Go to previous messageGo to next message
Larry LeBron is currently offline Larry LeBronFriend
Messages: 124
Registered: October 2015
Senior Member
Yes, running unit tests, as Christian mentions, is the fastest way to check all aspects of your DSL as you're implementing it, including syntax. This gives near-instant feedback, vs taking the time to launch a separate eclipse instance.

If you're new to XText, I HIGHLY recommended reading Lorenzo's book, which covers this in great detail:

http://www.amazon.com/gp/product/B00EPCSD1M/ref=dp-kindle-redirect?ie=UTF8&btkr=1

Re: DSL editor without launching new Eclipse instance [message #1730867 is a reply to message #1730847] Fri, 29 April 2016 12:09 Go to previous message
Sina Madani is currently offline Sina MadaniFriend
Messages: 109
Registered: November 2015
Location: York, UK
Senior Member
Thanks everyone!
Previous Topic:Understand grammar changes to address content assist issue.
Next Topic:Xtext DSL to Binary conversion
Goto Forum:
  


Current Time: Wed Nov 13 20:16:31 GMT 2019

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

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

Back to the top