Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [Eugenia] State of an editor generated by eugenia to xml
[Eugenia] State of an editor generated by eugenia to xml [message #643770] Wed, 08 December 2010 03:48 Go to next message
No real name is currently offline No real name
Messages: 4
Registered: December 2010
Junior Member
Hello,

i made an editor similar to the one in the tutorial
http://www.eclipse.org/gmt/epsilon/doc/articles/eugenia-gmf- tutorial. I was wondering if there's any (easy) way to export a state of a diagram created in the editor to xml


Re: [Eugenia] State of an editor generated by eugenia to xml [message #643787 is a reply to message #643770] Wed, 08 December 2010 04:45 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios Kolovos
Messages: 1776
Registered: July 2009
Senior Member
There's no built-in mechanism to export to XML AFAIK but you could write
a transformation that generates XML from the diagram (which itself is an
EMF model) using the plain XML driver:
http://eclipse.org/gmt/epsilon/doc/articles/plain-xml/

Cheers,
Dimitris

roosenw@gmail.com wrote:
> Hello,
>
> i made an editor similar to the one in the tutorial
> http://www.eclipse.org/gmt/epsilon/doc/articles/eugenia-gmf- tutorial I
> was wondering if there's any (easy) way to export a state of a diagram
> created in the editor to xml
>
>
>
Re: [Eugenia] State of an editor generated by eugenia to xml [message #643798 is a reply to message #643787] Wed, 08 December 2010 05:18 Go to previous messageGo to next message
No real name is currently offline No real name
Messages: 4
Registered: December 2010
Junior Member
Well,

how do you acces the root element of the elements created in your diagram? I dont really find a way to do this.
Re: [Eugenia] State of an editor generated by eugenia to xml [message #643844 is a reply to message #643798] Wed, 08 December 2010 08:31 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios Kolovos
Messages: 1776
Registered: July 2009
Senior Member
Hi,

Could you please elaborate a bit more on what you've done so far and
where you're stuck?

Cheers,
Dimitris

roosenw@gmail.com wrote:
> Well,
>
> how do you acces the root element of the elements created in your
> diagram? I dont really find a way to do this.
Re: [Eugenia] State of an editor generated by eugenia to xml [message #643851 is a reply to message #643844] Wed, 08 December 2010 08:40 Go to previous messageGo to next message
No real name is currently offline No real name
Messages: 4
Registered: December 2010
Junior Member
Hello Dimitri,

We have generated the code out of an EMF file following all necessary steps.

Now we have an eclipse application(an editor) which we want to be able to save to xml, we know the code how to do it but we cant find the document root with the elements created (by the user of the app) in the editor so we can iterate through them.

basically the editor looks like the editor on http://www.eclipse.org/gmt/epsilon/doc/articles/eugenia-gmf- tutorial/ with other types of nodes,links,..

Greetz,
Wim
Re: [Eugenia] State of an editor generated by eugenia to xml [message #644127 is a reply to message #643851] Thu, 09 December 2010 09:54 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios Kolovos
Messages: 1776
Registered: July 2009
Senior Member
Hi Wim,

The following code prints the root object of the active GMF diagram
editor in the workbench:

IEditorPart editor =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().getActiveEditor();
if (editor instanceof DiagramEditor) {
DiagramEditor diagramEditor = (DiagramEditor) editor;
ResourceSet resourceSet =
diagramEditor.getEditingDomain().getResourceSet();
if (resourceSet.getResources().size() > 0) {
Resource resource = resourceSet.getResources().get(0);
EObject rootElement = resource.getAllContents().next();
System.err.println(rootElement);
}
}

Cheers,
Dimitris

roosenw@gmail.com wrote:
> Hello Dimitri,
>
> We have generated the code out of an EMF file following all necessary
> steps.
>
> Now we have an eclipse application(an editor) which we want to be able
> to save to xml, we know the code how to do it but we cant find the
> document root with the elements created (by the user of the app) in the
> editor so we can iterate through them.
>
> basically the editor looks like the editor on
> http://www.eclipse.org/gmt/epsilon/doc/articles/eugenia-gmf- tutorial/
> with other types of nodes,links,..
>
> Greetz,
> Wim
Re: [Eugenia] State of an editor generated by eugenia to xml [message #644826 is a reply to message #644127] Tue, 14 December 2010 06:11 Go to previous message
No real name is currently offline No real name
Messages: 4
Registered: December 2010
Junior Member
Thanks alot!

this was exactly what i needed

greetz,
Wim
Previous Topic:[EWL] Wizard modifies underlying model
Next Topic:[eugenia] Problems creating diagram code
Goto Forum:
  


Current Time: Thu Aug 21 18:08:23 EDT 2014

Powered by FUDForum. Page generated in 0.01643 seconds