Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » a string representation for program elements (EObjects)
a string representation for program elements (EObjects) [message #649800] Thu, 20 January 2011 15:33 Go to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
Hi

xtext already relies on customizable representations of a program
element (EObject) for the ui, such as the label provider and the content
outline that can be customized and injected...

is there something similar for simple string representations of EObjects
of the program? Something to be used not in the ui, but just to have a
string representation of a program element?

E.g., to print something on the console, or to generate proper error
strings in the validator?

thanks in advance
Lorenzo

--
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: a string representation for program elements (EObjects) [message #649829 is a reply to message #649800] Thu, 20 January 2011 17:02 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

i am not quite sure if this is what you need but you could give

org.eclipse.xtend.typesystem.emf.EObjectType.toString(EObjec t)


a try

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: a string representation for program elements (EObjects) [message #649967 is a reply to message #649829] Fri, 21 January 2011 08:40 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 01/20/2011 06:02 PM, Christian Dietrich wrote:
> Hi,
>
> i am not quite sure if this is what you need but you could give
>
> org.eclipse.xtend.typesystem.emf.EObjectType.toString(EObjec t)
>
>

I'll try

but is that injectable?

as I said in my first post, I'd like to have something similar to
LabelProvider, say, e.g., StringRepresentationProvider, to be used in
the non-ui plugin, that users can customize.

Of course, it's quite easy to implement it (and I already have
something), but I was wondering whether xtext already had something
similar, which already uses, like LabelProvider, just not to re-invent
the wheel ;)

thanks
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: a string representation for program elements (EObjects) [message #649969 is a reply to message #649967] Fri, 21 January 2011 09:13 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

there is notthing i'd know of.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: a string representation for program elements (EObjects) [message #649976 is a reply to message #649800] Fri, 21 January 2011 09:24 Go to previous message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 760
Registered: July 2009
Location: Hamburg
Senior Member
EmfFormatter dumps EObject trees in a readable way.

We don't have a non-UI service for configurable textual representations
of EObjects. But it should be easy to implement (PolymorphicDispatch or
EmfSwitch). If you create an interface for that you can easily bind
whatever implementation you want by means of Guice.

Am 20.01.11 16:33, schrieb Lorenzo Bettini:
> Hi
>
> xtext already relies on customizable representations of a program
> element (EObject) for the ui, such as the label provider and the content
> outline that can be customized and injected...
>
> is there something similar for simple string representations of EObjects
> of the program? Something to be used not in the ui, but just to have a
> string representation of a program element?
>
> E.g., to print something on the console, or to generate proper error
> strings in the validator?
>
> thanks in advance
> Lorenzo
>


--
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:rewrite ANTLR .g grammar in XText
Next Topic:Generating code in project with classpath awareness
Goto Forum:
  


Current Time: Thu Apr 25 18:54:52 GMT 2024

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

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

Back to the top