Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Run as... for your DSL
Run as... for your DSL [message #1269434] Tue, 11 March 2014 21:48 Go to next message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 673
Registered: July 2009
Location: Trondheim, Norway
Senior Member
Hi,

I've made a DSL that generates JUnit tests and would like to be able to
use Run as-> JUnit on my own file type. I know how to make my
configuration type and launcher, but in this case I would like to just
delegate to the existing JUnit launcher, as if the user had used Run
as->JUnit test on the generated JUnit test. My first attempt was to
register an adapter that adapts an IFile to an IType, but it never
seemed to be activated :-(

Note that this would be a handy general mechanism, i.e. any Xtext-based
DSL, be able to use Run as on the DSL file, and delegate to and launch
any generated file.

Is this possible?

Hallvard
Re: Run as... for your DSL [message #1269787 is a reply to message #1269434] Wed, 12 March 2014 07:38 Go to previous messageGo to next message
Joerg Reichert is currently offline Joerg ReichertFriend
Messages: 80
Registered: July 2009
Location: Leipzig
Member
Hi Hallvard,

have a look at https://github.com/meysholdt/eclipse_jdt_junit_runners
It is used by http://www.xpect-tests.org/ where you can select Run as JUnit Test on a xt file.

Best regards,
Joerg


--
Need professional support for Xtext and EMF?
Go to: http://xtext.itemis.com
Re: Run as... for your DSL [message #1270040 is a reply to message #1269787] Wed, 12 March 2014 12:38 Go to previous messageGo to next message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 673
Registered: July 2009
Location: Trondheim, Norway
Senior Member
I've just noticed that xbase has a launching package. It it related to
what is provided by xpect?

How are the xbase launching classes used?

Hallvard

On 12.03.14 08:38, Joerg Reichert wrote:
> Hi Hallvard,
>
> have a look at https://github.com/meysholdt/eclipse_jdt_junit_runners
> It is used by http://www.xpect-tests.org/ where you can select Run as
> JUnit Test on a xt file.
>
> Best regards,
> Joerg
Re: Run as... for your DSL [message #1270057 is a reply to message #1270040] Wed, 12 March 2014 12:57 Go to previous messageGo to next message
Joerg Reichert is currently offline Joerg ReichertFriend
Messages: 80
Registered: July 2009
Location: Leipzig
Member
I'm not sure if its related, I've only seen that Xpect defines an extension to hook into the JUnit launcher:
https://github.com/meysholdt/Xpect/blob/master/org.xpect.ui/plugin.xml#L401

Maybe this is a good starting point, although XPECT does a lot more adaptions as you may need.

Joerg


--
Need professional support for Xtext and EMF?
Go to: http://xtext.itemis.com
Re: Run as... for your DSL [message #1270058 is a reply to message #1270057] Wed, 12 March 2014 12:59 Go to previous messageGo to next message
Joerg Reichert is currently offline Joerg ReichertFriend
Messages: 80
Registered: July 2009
Location: Leipzig
Member
For Xtend it is realized here:
https://github.com/eclipse/xtext/blob/master/plugins/org.eclipse.xtend.ide/plugin.xml#L1013


--
Need professional support for Xtext and EMF?
Go to: http://xtext.itemis.com
Re: Run as... for your DSL [message #1270402 is a reply to message #1270058] Thu, 13 March 2014 00:21 Go to previous message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 673
Registered: July 2009
Location: Trondheim, Norway
Senior Member
Thanks for the pointers! I managed to make it work, though it wasn't as
easy or streamlined as I hoped. With the help of the debugger I (think
I) understood how the adapter logic worked, and by copying relevant
plugin.xml extensions and xbase launching code I could make my code do
the same thing as Xtend/Xbase. However, I got the fealing that it should
have been enough to copy the plugin.xml extensions, but use my own
executable extension and inject my own subclass of
JavaElementDelegateJunitLaunch, but there seemed to be some interaction
with adapters registered by Xtend, so it didn't work.

Anyway, since it works I'm satisfied!

Hallvard

On 12.03.14 13:59, Joerg Reichert wrote:
> For Xtend it is realized here:
> https://github.com/eclipse/xtext/blob/master/plugins/org.eclipse.xtend.ide/plugin.xml#L1013
>
Previous Topic:Build the Dependent xtext grammar files using ant Script
Next Topic:Multiple output configurations to separate API and Impl code
Goto Forum:
  


Current Time: Fri Apr 26 11:19:15 GMT 2024

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

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

Back to the top