Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Reading created model(Reading the model)
Reading created model [message #1224775] Fri, 27 December 2013 13:54 Go to next message
Filipe Ramos is currently offline Filipe Ramos
Messages: 18
Registered: December 2013
Junior Member
Hi,

I have created an eclipse graphiti plugin, but now I wanna be able to click on a button and convert the model created with the graphical editor to text. The problem is: I can't find a way to read the model that is being created on the editor.

Is there a way to do that?


Thanks!
Re: Reading created model [message #1228566 is a reply to message #1224775] Tue, 07 January 2014 09:01 Go to previous messageGo to next message
Michael Wenz is currently offline Michael Wenz
Messages: 1571
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Hi Filipe,

not sure what exactly you are trying to do. The Graphiti editor works on an
EMF model in memory, which is created/maintained using an resource
set/editing domain inside the editor. You may use this resource set to
access EMF resources and EObjects.

On save the editor content/EMF model is persisted on disk.

Michael
Re: Reading created model [message #1249018 is a reply to message #1228566] Mon, 17 February 2014 17:26 Go to previous messageGo to next message
Filipe Ramos is currently offline Filipe Ramos
Messages: 18
Registered: December 2013
Junior Member
Hi Michael, thanks for your reply!

I'll be more specific about what I want: when I create a Graphiti model (based on my ecore model), I wanna be able to click on a Eclipse menu item and run a handler that needs to access the ecore model with the contents of the diagram I'm working on. How is that possible?

Thanks.
Re: Reading created model [message #1249436 is a reply to message #1224775] Tue, 18 February 2014 03:52 Go to previous messageGo to next message
Soeren M is currently offline Soeren M
Messages: 77
Registered: September 2011
Member
Hey,

maybe I dont understand what you mean, but if you just want the elements from the
current diagram, you can call them via:

getDiagram().getChildren();


Now you are able to test the elements for their business object.
Re: Reading created model [message #1252635 is a reply to message #1249436] Fri, 21 February 2014 07:30 Go to previous messageGo to next message
Filipe Ramos is currently offline Filipe Ramos
Messages: 18
Registered: December 2013
Junior Member
Hi,

I can do that from the diagram editor code, but I want to do that from the handler of a menu button (created using the commands extension point).

Is that possible?

If not, can I read the model from the file on disk after I save it with the editor?

Thanks.
Re: Reading created model [message #1252799 is a reply to message #1252635] Fri, 21 February 2014 11:13 Go to previous messageGo to next message
Michael Wenz is currently offline Michael Wenz
Messages: 1571
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Filipe,

best would be to synchronize with the editor if the menu entry is part of
the editor. You will need to get the currently active editor (instanceof
DiagramEditor, getActiveEditor on the currently active Eclipse page) and
from there you should be able to grab the diagram and its resource.

Michael
Re: Reading created model [message #1256933 is a reply to message #1252799] Tue, 25 February 2014 18:50 Go to previous messageGo to next message
Filipe Ramos is currently offline Filipe Ramos
Messages: 18
Registered: December 2013
Junior Member
Maybe that's what I need. Unfortunately I'm having some import errors, and I don't know which packages I should install. I've installed the EMF SDK and the Graphical Editing Framework GEF SDK, but to no avail...

The packages that cannot be resolved are:
org.eclipse.emf.edit.domain.IEditingDomainProvider,
org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor and
org.eclipse.gef.ui.parts.GraphicalEditorWithFlyoutPalette.

They are referenced indirectly when I import org.eclipse.graphiti.ui.editor.DiagramEditor.

Which packages should I install?


Thaks.

-- edit --

Just found a workaround: manually imported org.eclipse.ui.*; org.eclipse.emf.* and org.eclipse.gef.* in the project build path.

[Updated on: Wed, 26 February 2014 18:25]

Report message to a moderator

Re: Reading created model [message #1258644 is a reply to message #1256933] Thu, 27 February 2014 10:46 Go to previous messageGo to next message
Michael Wenz is currently offline Michael Wenz
Messages: 1571
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Filipe,

you will additionally need EMF Transactions SDK and EMF Validation SDK.

But I wonder why you get errors regarding Tabbed Properties classes and GEF
classes. Are you sure you have installed them correctly and use the right
target?

Michael
Re: Reading created model [message #1258966 is a reply to message #1258644] Thu, 27 February 2014 18:31 Go to previous messageGo to next message
Filipe Ramos is currently offline Filipe Ramos
Messages: 18
Registered: December 2013
Junior Member
The erros appears when I import org.eclipse.graphiti.ui.editor.DiagramEditor.

I have EMF Model Transactions SDK and EMF Validation Framework SDK installed (I checked on Help->Install New Software...)

The target platform is Running Platform.

[Updated on: Thu, 27 February 2014 18:42]

Report message to a moderator

Re: Reading created model [message #1259449 is a reply to message #1258966] Fri, 28 February 2014 06:43 Go to previous message
Michael Wenz is currently offline Michael Wenz
Messages: 1571
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Hm, this should be part of the EMF SDK.

Michael
Previous Topic:Disabling Undo
Next Topic:Refreshing the Diagram Editor
Goto Forum:
  


Current Time: Thu Jul 24 00:37:18 EDT 2014

Powered by FUDForum. Page generated in 0.02867 seconds