Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Embedding an Xtext DSL in JDT / CDT editors(Is this possible?)
Embedding an Xtext DSL in JDT / CDT editors [message #641477] Thu, 25 November 2010 15:41 Go to next message
Dolev Dotan is currently offline Dolev DotanFriend
Messages: 1
Registered: November 2010
Junior Member
Hi,
I'd like to embed DSL blocks (inside special comments) in the normal Java/C++ editors. The idea is to keep the normal syntax and the full-featured capabilities of JDT/CDT (refactorings and all) - which is not possible by re-implementing the host language in Xtext, while at the same time getting all the nice capabilities of Xtext for the DSL blocks.

Is this currently possible? If so, could you guide me how to start or where to look?
If not - can Xtext theoretically be extended (or even tweaked...) to support it?

Thanks in advance,
Dolev
Re: Embedding an Xtext DSL in JDT / CDT editors [message #645048 is a reply to message #641477] Wed, 15 December 2010 11:23 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 762
Registered: July 2009
Location: Dortmund, Germany
Senior Member

I don't think that this is possible now. You would have to change the implementation of the JDT/CDT editors and make them aware of DSL parts. Since usually you don't want to customize those editors and they don't allow to hook into them this way won't be possible.

The other way around, embedding JDT editor facilities into an Xtext DSL editor, is at least imaginable. This has no one realized yet, but the APIs would allow this in principle.

Steps to do:
- Read complete Java fragments as one terminal. This requires that start and end of Java code is marked somehow.
- Integrate Content Assist (see IType)
- Simulate known types from the DSL for the JDT - Content assist must know that you refer to something that is a known Java type in that context with the properties you access
- Same for the compiler

Regards,
~Karsten


Need professional support for Xtext, EMF, Eclipse IDE?
Go to: http://devhub.karakun.com
Twitter : @kthoms
Blog : www.karsten-thoms.de
Re: Embedding an Xtext DSL in JDT / CDT editors [message #654576 is a reply to message #645048] Wed, 16 February 2011 11:39 Go to previous message
Fabian  is currently offline Fabian Friend
Messages: 1
Registered: February 2011
Junior Member
Hello,

I have a question to Karstens answer:
How can I embed different languages with Xtext at runtime. I would like to have a small main language with a special statement for embedding other languages. In this statement there should be an attribute so specify the embedded language type, which should be a string. Dependent to this string a parser for the embedded language should be selected.

Is this possible with xtext and is there somewhere a document, which describe how to do this?

Best regards
Fabian
Previous Topic:Load EMF EObject from several dsl files
Next Topic:Mandatory and optional attributes
Goto Forum:
  


Current Time: Thu Apr 25 11:13:25 GMT 2024

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

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

Back to the top