Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Two different "Languages" in one editor
Two different "Languages" in one editor [message #832675] Fri, 30 March 2012 12:45 Go to next message
Heinz Huber is currently offline Heinz HuberFriend
Messages: 45
Registered: February 2012
Member
Hi,

i'm trying to get into GMF and got the following question:

In my use case i want to create a graphic thing which represents configurations for router files. These configuration files should be generated by Xtext. The grammer which is needed for that is already developed.
The problem is, that the graphical representation of this xtext .ecore file is not very understandable.

So the question is, if there is a way to set 2 different languages (1 for the graphical frontend and 1 for the editor). And access some methods where i can to the transfer work from grammar A to grammer B?

I hope this is possible! And if it is possible could you please tell me the way i have to go to make this thing work. At the moment i got no idea how to start this thing.

Thanks in advance and have a great weekend!
Re: Two different "Languages" in one editor [message #833987 is a reply to message #832675] Sun, 01 April 2012 08:08 Go to previous messageGo to next message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 702
Registered: November 2009
Senior Member
Hi Heinz,

I assume that you have generated your ecore out of the XText grammar. As far as I know you can put an XText grammar ontop of an existing ecore model. Take a look at this: http://blog.efftinge.de/2009/11/xtext-using-existing-ecore-models.html. So the way to go is to define a clean Ecore MM. Create the XText grammar out of it. Then build a GMF editor for the MM. If both works you should follow the instructions from the XText documentation to make GMF and XText update each other. There are nice examples on this.

Ralph
Re: Two different "Languages" in one editor [message #834793 is a reply to message #833987] Mon, 02 April 2012 12:03 Go to previous messageGo to next message
Heinz Huber is currently offline Heinz HuberFriend
Messages: 45
Registered: February 2012
Member
Hi Ralph,

thanks for your fast answer.
I read the article you posted, but i am not sure if this is the thing i meant.

While reading the article it doesn't seem to me, that it is possible to use 2 different grammars.
The problem in my use case is, that the graphical representation of the language could be about 3 boxes for 1 element in the textual. These 3 boxes do not stand in any context to each other, so that it is not possible to arrange them into 1 textual element by grammar rules.

I don't really know how to solve this, but i don't think, that Xtext/GMF could do this on his own.
The way you explained looks like "build a editor and the textual thing on one ecore MM". Is this really the same thing that i wanted to do?

Hope you can explain this a little bit to me.
Thanks in advance!
Re: Two different "Languages" in one editor [message #836237 is a reply to message #834793] Wed, 04 April 2012 09:01 Go to previous messageGo to next message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 702
Registered: November 2009
Senior Member
Hi,

can you give an example for a textual and according graphical representation? It would also be helpful to illustrate the "3 boxes for could stand for 1 element in the textual".

Ralph
Re: Two different "Languages" in one editor [message #836363 is a reply to message #832675] Wed, 04 April 2012 11:53 Go to previous message
Heinz Huber is currently offline Heinz HuberFriend
Messages: 45
Registered: February 2012
Member
Hi Ralph,

i tryied my paint skills and got the following picture which maybe helpful for my explanation.

http://www.abload.de/img/unbenannt0xkwo.png

The problem i got is, that the direct representation of my Xtext language will be something that is very complex. So i want to make that thing a little more abstract. The picture above is the way i want to show it in my graphical editor.

The way the code is in my Xtext language is the following:
Server {
   Element (Inner Element)
}

1/2 code of Destination
Route
1/2 code of Destination


As you can see, the representation in my visual editor is very different to my textual one. There are no connections between the elements like they are in the Xtext
The problem here is, that i found no way to change my Xtext grammar that there is a match for both editors.

So my question is -> Is there a way to have a grammar for the editor thing and one grammer for the xtext editor? And then there has to be a possibilty to parse (translate) between these languages.

Hope that this explanation is better then the ones before.
Thanks in advance for your answer!

EDIT:
I forgot the "3 boxes could stand for one Object" thing. A perfect example is that Element/InnerElement thing from the picture above. A textual example for that could be:

test {
  elementval1 = hi
  innertest {
     innerval = test
     innerval2 = 123123
  }
}



So the Element from the picture is the outer element. And the InnerElement from the picture is code which will be inside that one. I chose that way of representation because there can be a Element without a InnerElement. And in my case these two boxes thing is the logical best way to show it.

[Updated on: Wed, 04 April 2012 12:04]

Report message to a moderator

Previous Topic:Put Figures/Nodes in a fixed location in the canvas when opening the Editor?
Next Topic:How to add 2D/3D animation to a GMF generated diagram surface
Goto Forum:
  


Current Time: Thu Mar 28 10:03:14 GMT 2024

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

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

Back to the top