Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Embedding a language in Java comments/annotations
Embedding a language in Java comments/annotations [message #778391] Thu, 12 January 2012 18:04 Go to next message
Aleksandar Milicevic is currently offline Aleksandar MilicevicFriend
Messages: 2
Registered: January 2012
Junior Member
Hi,

I admit I haven't done much research on XText, but I figured I'd ask a simple question here first, just to see if my problem is solvable with XText.

I want to embed my own language inside certain Java annotations. Currently, I pass small programs written in my domain specific language to those annotations as plain strings, so that everything is just plain old Java. Now what I want to do is, I want to keep everything as is (i.e. everything is still plain Java), but I would like to get all the goodies for my language inside those special strings (custom syntax highlighting, type checking, code completion, etc.). Is it possible use XText to alter the Eclipse editor for ".java" files?

Thanks.
Re: Embedding a language in Java comments/annotations [message #778540 is a reply to message #778391] Fri, 13 January 2012 07:46 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Aleksandar,

this is not possible with Xtext and I'm not sure whether the JDT
provides the necessary abstractions to accomplish this. You may want to
ask in the JDT newsgroup for custom highlighting and content assist for
strings in annotations. ObjectTeams may help to hook into some internal
stuff of the JDT, too.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 12.01.12 19:04, schrieb Aleksandar Milicevic:
> Hi,
> I admit I haven't done much research on XText, but I figured I'd ask a
> simple question here first, just to see if my problem is solvable with
> XText.
> I want to embed my own language inside certain Java annotations.
> Currently, I pass small programs written in my domain specific language
> to those annotations as plain strings, so that everything is just plain
> old Java. Now what I want to do is, I want to keep everything as is
> (i.e. everything is still plain Java), but I would like to get all the
> goodies for my language inside those special strings (custom syntax
> highlighting, type checking, code completion, etc.). Is it possible use
> XText to alter the Eclipse editor for ".java" files?
>
> Thanks.
Re: Embedding a language in Java comments/annotations [message #778547 is a reply to message #778540] Fri, 13 January 2012 08:25 Go to previous messageGo to next message
Andreas Graf is currently offline Andreas GrafFriend
Messages: 211
Registered: July 2009
Senior Member
But what he maybe could do is to have a Xtext editor pop up on a special key combination from the JDT editor containing and conveniently editing the comment that he is currently at?
Re: Embedding a language in Java comments/annotations [message #778569 is a reply to message #778547] Fri, 13 January 2012 10:04 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Yes, that is certainly possible. It wouldn't help with the coloring for
nicer reading of existing code, though.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 13.01.12 09:25, schrieb Andreas Graf:
> But what he maybe could do is to have a Xtext editor pop up on a special
> key combination from the JDT editor containing and conveniently editing
> the comment that he is currently at?
Re: Embedding a language in Java comments/annotations [message #778774 is a reply to message #778569] Fri, 13 January 2012 19:59 Go to previous message
Aleksandar Milicevic is currently offline Aleksandar MilicevicFriend
Messages: 2
Registered: January 2012
Junior Member
Thanks for the answers, I'll ask in the JDT newsgroup.
Previous Topic:Performance problem with linking
Next Topic:problems with JvmTypesBuilder, JvmModelGenerator and "this"
Goto Forum:
  


Current Time: Thu Sep 26 05:21:22 GMT 2024

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

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

Back to the top