Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Custom XtextResource or URIConverter?(Storing)
Custom XtextResource or URIConverter? [message #636567] Mon, 01 November 2010 22:09 Go to next message
Patrick Di Loreto is currently offline Patrick Di LoretoFriend
Messages: 10
Registered: May 2010
Junior Member
I have defined a grammar on top of an existing model.

I would like to include the XtextEditor as a page in an existing editor (FormEditor), now my problem is that what should be the XtextEditor input represent a sub part of another Resource.

I give you an example:

I have a model: MyCustomObject
which is stored using XMIResourceImpl.

Now I have a grammar defined for: MyCustomExpression

which is a subpart of MyCustomObject. (so myCustomExpression.eResource is XMIResourceImpl)

How can I create a XtextEditor inside a FormEditor and be able to link the XtextEditorInput to the "part" of MyCustomObject relative to MyCustomExpression?

Should I use a URIConverter and play with the createInputStream/createOutputStream ?

Or define a new Resource ?
How can I obtain programmatically an instance of XtextEditor ? Should I use: Activator.getDefault().getInjector() ?

Thx
Patrick
Re: Custom XtextResource or URIConverter? [message #650258 is a reply to message #636567] Mon, 24 January 2011 01:27 Go to previous messageGo to next message
Lazar Codrut-Lucian is currently offline Lazar Codrut-LucianFriend
Messages: 91
Registered: July 2009
Member
I'm also interested in this.

Any suggestion would be appreciated.

Thanks,
Lucian
Re: Custom XtextResource or URIConverter? [message #650295 is a reply to message #636567] Mon, 24 January 2011 09:31 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 760
Registered: July 2009
Location: Hamburg
Senior Member
Aclipse editors are quite heavy weight and kind of hard to reuse in
other contexts. You can have a look at the GMF example shipped with
Xtext which demonstrates how to embed such an editor in a popup window.

It should be easier to customize a StyledText widget with Xtext based
services such as code assist and syntax highlighting. Have a look at the
plugins
org.eclipse.xtext.ui.codetemplates
and
org.eclipse.xtext.ui.codetemplates.ui
where we integrate Xtext based editing in the Eclipse prerference page
for code templates.


Am 01.11.10 23:09, schrieb Patrick:
> I have defined a grammar on top of an existing model.
>
> I would like to include the XtextEditor as a page in an existing editor
> (FormEditor), now my problem is that what should be the XtextEditor
> input represent a sub part of another Resource.
>
> I give you an example:
>
> I have a model: MyCustomObject
> which is stored using XMIResourceImpl.
>
> Now I have a grammar defined for: MyCustomExpression
>
> which is a subpart of MyCustomObject. (so myCustomExpression.eResource
> is XMIResourceImpl)
>
> How can I create a XtextEditor inside a FormEditor and be able to link
> the XtextEditorInput to the "part" of MyCustomObject relative to
> MyCustomExpression?
>
> Should I use a URIConverter and play with the
> createInputStream/createOutputStream ?
>
> Or define a new Resource ?
> How can I obtain programmatically an instance of XtextEditor ? Should I
> use: Activator.getDefault().getInjector() ?
>
> Thx
> Patrick


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


---
Get professional support from the Xtext committers at www.typefox.io
Re: Custom XtextResource or URIConverter? [message #651418 is a reply to message #650295] Sun, 30 January 2011 17:50 Go to previous messageGo to next message
Lazar Codrut-Lucian is currently offline Lazar Codrut-LucianFriend
Messages: 91
Registered: July 2009
Member
I would like to use the xText editor to edit a subelement of a model (For instance, Model.Package.Class).
I want to create the Model and the structure with a different editor (maybe GMF), and to edit what's inside the Class with xText.
I'm thinking of creating the xText editor by using Class as the root model element.
When I press Enter on a Class inside the GMF editor, I want the xText editor to open so that I can edit what's inside the Class.

What do you think would be the easiest way to achieve this?
Do you think that temporary xText files are required?
Should I try to extend XTextResource? I've also read something about an UriConverter.
I would appreciate any suggestions.

Thanks,
Lucian
Re: Custom XtextResource or URIConverter? [message #651466 is a reply to message #651418] Mon, 31 January 2011 09:15 Go to previous message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 760
Registered: July 2009
Location: Hamburg
Senior Member
Once again, have a look at the GMF example. We have a popup editor there
that allows to edit a section of a model textually.

Am 30.01.11 18:50, schrieb Lazar Codrut-Lucian:
> I would like to use the xText editor to edit a subelement of a model
> (For instance, Model.Package.Class).
> I want to create the Model and the structure with a different editor
> (maybe GMF), and to edit what's inside the Class with xText.
> I'm thinking of creating the xText editor by using Class as the root
> model element.
> When I press Enter on a Class inside the GMF editor, I want the xText
> editor to open so that I can edit what's inside the Class.
>
> What do you think would be the easiest way to achieve this?
> Do you think that temporary xText files are required?
> Should I try to extend XTextResource? I've also read something about an
> UriConverter.
> I would appreciate any suggestions.
>
> Thanks,
> Lucian


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


---
Get professional support from the Xtext committers at www.typefox.io
Previous Topic:HELP! run a xtext-generator workflow (located in the parent workspace) programmatically
Next Topic:Feature Ideas. ( from SableCC 4.0)
Goto Forum:
  


Current Time: Thu Apr 25 15:22:13 GMT 2024

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

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

Back to the top