Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Override GMF source code to change diagram <-> text parsing
Override GMF source code to change diagram <-> text parsing [message #841407] Wed, 11 April 2012 08:59 Go to next message
Heinz Huber is currently offline Heinz HuberFriend
Messages: 45
Registered: February 2012
Member
Hi,

i am searching for a solution to change the way my diagramm is saved in the file. I want to make this possible in the GMF with Xtext environment.

For that i downloaded the complete GMF project code and searched inside that. I am not able to find a parser interface inside the whole source code which could be the right one to do the "parse diagram to text file" thing.

Also i could not find a real documentation for the project to get started changing something there.

Maybe you could tell me a interface name which i have to overwrite. Or you could point me to a documentation (getting started) which i am not able to find.

Thanks in advance!
Re: Override GMF source code to change diagram &lt;-&gt; text parsing [message #841665 is a reply to message #841407] Wed, 11 April 2012 15:57 Go to previous messageGo to next message
Guillaume Hillairet is currently offline Guillaume HillairetFriend
Messages: 95
Registered: July 2009
Member
Hi,

The parsing is not something related to GMF but to EMF and especially
to its concept of Resource. See the implementation of XMIResource to
see how EMF reads and writes models in XMI format (same format use by
GMF).

In your case you should take a look at the Xtext documentation that
explains how to integrate Xtext with GMF
(http://www.eclipse.org/Xtext/documentation/2_1_0/210-emf-integration.php#gmf_integration).


BRs,
Guillaume

On 2012-04-11 10:59:06 +0200, Heinz Huber said:

> Hi,
>
> i am searching for a solution to change the way my diagramm is saved in
> the file. I want to make this possible in the GMF with Xtext
> environment.
> For that i downloaded the complete GMF project code and searched inside
> that. I am not able to find a parser interface inside the whole source
> code which could be the right one to do the "parse diagram to text
> file" thing.
>
> Also i could not find a real documentation for the project to get
> started changing something there.
> Maybe you could tell me a interface name which i have to overwrite. Or
> you could point me to a documentation (getting started) which i am not
> able to find.
>
> Thanks in advance!
Re: Override GMF source code to change diagram &lt;-&gt; text parsing [message #842393 is a reply to message #841665] Thu, 12 April 2012 08:55 Go to previous message
Heinz Huber is currently offline Heinz HuberFriend
Messages: 45
Registered: February 2012
Member
Hi Guillaume,

first of all thanks for your quick reply!

The "combine Xtext and GMF" link helped me a bit, but i still got a question.
In the article is a part with the following text:

Quote:
In an Xtext editor, changes in the text are transfered to the underlying XtextResource (src) by a call to the method XtextResource.update(int, int, String) (src), which will trigger a partial parsing of the dirty text region and a replacement of the corresponding subtree in the AST model (semantic model).


So is it possible to change the way of parsing by overwriting some functions? I checked the API and found the following interface:
http://download.eclipse.org/modeling/tmf/xtext/javadoc/2.0.0/org/eclipse/xtext/resource/XtextResource.html

My first idea is to overwrite the doLoad(java.io.InputStream inputStream, java.util.Map<?,?> options), doSave(java.io.OutputStream outputStream, java.util.Map<?,?> options) and the update(int, int, String) function. Am i right, that these functions are doing the parser things if one resource (text or graphic) is changed?

Is my first idea the right one? Or is there another way to solve this?

Best Regards,
Heinz

[Updated on: Thu, 12 April 2012 09:35]

Report message to a moderator

Previous Topic:Read an unsaved value
Next Topic:Deploying Problems
Goto Forum:
  


Current Time: Fri Oct 30 03:07:02 GMT 2020

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

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

Back to the top