Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » XtextEditor based on a string
XtextEditor based on a string [message #669956] Thu, 12 May 2011 07:44 Go to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
Hi

can I open an Xtext editor not based on a file, but on a string? The
string represents the whole program I'd like to edit (thus I do not need
to open the editor on a part of a file, like in the integration with GMF).

I'd like to embed it into another editor; I saw that there's a form
integration example, but it looks like one needs to write a lot of code;
is that lot of code required by the integration in a form, or is it
required anyway?

thanks in advance
Lore

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: XtextEditor based on a string [message #669968 is a reply to message #669956] Thu, 12 May 2011 08:39 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Lorenzo

Using Xtext for a string is easy; you just open a stream on a string
rather than a file.

It's the integration that is tricky.
- an Xtext editor in an editor is comparatively straightforward - there
are good 2-year old blogs
- an Xtext editor in a pop-up is a bit harder, also blogged, or you
could try to understand how Papyrus does
https://bugs.eclipse.org/bugs/show_bug.cgi?id=34533
- an Xtext editor in a view is harder still (there is no IEditorSite),
you could look at the original XTFO
or its adaptation for Indigo in org.eclipse.ocl.examples.xtext.console

If you've not previously programmed with IEditorPart then you may have a
bit to learn.

Hopefully the itemis guys are busy writing last minute documentation on
all this for the Indigo release.

Regards

Ed Willink

On 12/05/2011 08:44, Lorenzo Bettini wrote:
> Hi
>
> can I open an Xtext editor not based on a file, but on a string? The
> string represents the whole program I'd like to edit (thus I do not
> need to open the editor on a part of a file, like in the integration
> with GMF).
>
> I'd like to embed it into another editor; I saw that there's a form
> integration example, but it looks like one needs to write a lot of
> code; is that lot of code required by the integration in a form, or is
> it required anyway?
>
> thanks in advance
> Lore
>
Re: XtextEditor based on a string [message #671548 is a reply to message #669968] Wed, 18 May 2011 09:23 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 05/12/2011 10:39 AM, Ed Willink wrote:
> Hi Lorenzo
>

Hi Ed

> Using Xtext for a string is easy; you just open a stream on a string
> rather than a file.
>

actually that was my first try, using a StringEditorInput... but it
looks like xtext refuses an editor input if it's not an instance of a
IFileEditorInput... I'll try to reproduce the code as soon as
possible... also... it looks like the file must be in the workspace...

> It's the integration that is tricky.
> - an Xtext editor in an editor is comparatively straightforward - there
> are good 2-year old blogs
> - an Xtext editor in a pop-up is a bit harder, also blogged, or you
> could try to understand how Papyrus does
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=34533

are you sure this bug is the one you meant? it looks like it refers to
different bug

> - an Xtext editor in a view is harder still (there is no IEditorSite),
> you could look at the original XTFO

XTFO?

> or its adaptation for Indigo in org.eclipse.ocl.examples.xtext.console
>
> If you've not previously programmed with IEditorPart then you may have a
> bit to learn.
>
> Hopefully the itemis guys are busy writing last minute documentation on
> all this for the Indigo release.
>

OK, let's see if any of them enters the discussion :)

> Regards
>
> Ed Willink
>
> On 12/05/2011 08:44, Lorenzo Bettini wrote:
>> Hi
>>
>> can I open an Xtext editor not based on a file, but on a string? The
>> string represents the whole program I'd like to edit (thus I do not
>> need to open the editor on a part of a file, like in the integration
>> with GMF).
>>
>> I'd like to embed it into another editor; I saw that there's a form
>> integration example, but it looks like one needs to write a lot of
>> code; is that lot of code required by the integration in a form, or is
>> it required anyway?
>>
>> thanks in advance
>> Lore
>>
>


--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: XtextEditor based on a string [message #671663 is a reply to message #671548] Wed, 18 May 2011 15:43 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=34533
> Papyrus does
>
> are you sure this bug is the one you meant? it looks like it refers
> to different bug

Correction: https://bugs.eclipse.org/bugs/show_bug.cgi?id=345330
>
>> - an Xtext editor in a view is harder still (there is no IEditorSite),
>> you could look at the original XTFO
>
> XTFO?
Eclipse Labs Xtext Forms Integration :
http://code.google.com/a/eclipselabs.org/p/xtext-forms-integration/
>
Regards

Ed Willink
Previous Topic:(no subject)
Next Topic:[Xtext 2] Missing error markers in package explorer
Goto Forum:
  


Current Time: Mon May 06 05:59:43 GMT 2024

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

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

Back to the top