Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Editing in-memory content
Editing in-memory content [message #906075] Fri, 31 August 2012 15:07 Go to next message
Fabio Mancinelli is currently offline Fabio MancinelliFriend
Messages: 8
Registered: August 2012
Junior Member
Hi everybody,

I am trying to accomplish the following thing: I would like to edit some
content that has been fetched from some remote server using an editor
generated by XText.

So basically I have an object instance that contains the data and that
lives in memory, and I would like to use it as the input of the XText
editor (i.e., the data returned by the object's getter, should be piped
to the editor somehow).

I am reading some older posts, and it seems that Xtext editors are
strongly tied to the resource framework and they need actual files in
projects.

Is there a way for implementing my use-case or I am just wasting time?

Thank you for your help.

-Fabio
Re: Editing in-memory content [message #906078 is a reply to message #906075] Fri, 31 August 2012 15:12 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13468
Registered: July 2009
Senior Member
Hi,

you can use the embedded editor. have a look at https://github.com/cdietrich/mql for an example usage

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Editing in-memory content [message #906367 is a reply to message #906078] Sat, 01 September 2012 08:38 Go to previous messageGo to next message
Fabio Mancinelli is currently offline Fabio MancinelliFriend
Messages: 8
Registered: August 2012
Junior Member
On 08/31/2012 05:12 PM, Christian Dietrich wrote:
> Hi,
>
> you can use the embedded editor. have a look at
> https://github.com/cdietrich/mql for an example usage
>
> ~Christian

Thank you Christian, it seems that's exactly what I need.

-Fabio
Re: Editing in-memory content [message #908152 is a reply to message #906078] Tue, 04 September 2012 20:41 Go to previous messageGo to next message
Fabio Mancinelli is currently offline Fabio MancinelliFriend
Messages: 8
Registered: August 2012
Junior Member
On 08/31/2012 05:12 PM, Christian Dietrich wrote:
> Hi,
>
> you can use the embedded editor. have a look at
> https://github.com/cdietrich/mql for an example usage
>
> ~Christian

Hi Christian,

the EmbeddedEditor works like a charm, though I have an additional
question... When I use a standard XText editor, by clicking with the
second mouse button on the left colum (where errors and warnings are
displayed), I get a menu with a lot of options (among them the "show
line numbers" one)

The EmbeddedEditor doesn't seem to register this popup menu...
My use case was to have line numbers also in the embedded editor.

Do you have a hint about how to achieve that?

Thanks,
Fabio
Re: Editing in-memory content [message #908165 is a reply to message #908152] Tue, 04 September 2012 21:26 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13468
Registered: July 2009
Senior Member
nope sorry i have no idea

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Editing in-memory content [message #908182 is a reply to message #908165] Tue, 04 September 2012 22:14 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13468
Registered: July 2009
Senior Member
Hi,

here is a poc.

embeddedEditor = embeddedEditorFactory.newEditor(editedResourceProvider).showErrorAndWarningAnnotations().withParent(sashForm);
		LineNumberRulerColumn lnrc = new LineNumberRulerColumn();
		 embeddedEditor.getViewer().addVerticalRulerColumn(lnrc);


you may have to fix/move stuff to

org.eclipse.xtext.ui.editor.embedded.EmbeddedEditorFactory.Builder.withParent(Composite)
and call compositeRuler.addDecorator(0, column); or something like that directly there

to change there order of the rulers analogous to the editor.

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Editing in-memory content [message #908693 is a reply to message #908182] Wed, 05 September 2012 20:27 Go to previous message
Fabio Mancinelli is currently offline Fabio MancinelliFriend
Messages: 8
Registered: August 2012
Junior Member
On 09/05/2012 12:14 AM, Christian Dietrich wrote:
> Hi,
>
> here is a poc.
>
> embeddedEditor =
> embeddedEditorFactory.newEditor(editedResourceProvider).showErrorAndWarningAnnotations().withParent(sashForm);
>
> LineNumberRulerColumn lnrc = new LineNumberRulerColumn();
> embeddedEditor.getViewer().addVerticalRulerColumn(lnrc);
>
> you may have to fix/move stuff to
>
> org.eclipse.xtext.ui.editor.embedded.EmbeddedEditorFactory.Builder.withParent(Composite)
>
> and call compositeRuler.addDecorator(0, column); or something like that
> directly there
>
> to change there order of the rulers analogous to the editor.
>
> ~Christian
>
Thanks for your precious help, Christian.

-Fabio
Previous Topic:What to use for automated xtext builds & tests?
Next Topic:Linking to a java class with specific criteria ?
Goto Forum:
  


Current Time: Thu May 28 02:37:41 GMT 2020

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

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

Back to the top