Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » GMF Runtime - Creating an editor manually(Creating a GMF editor for displaying manually read emf data.)
GMF Runtime - Creating an editor manually [message #730384] Wed, 28 September 2011 05:38 Go to next message
Mischa N. is currently offline Mischa N.
Messages: 3
Registered: September 2011
Junior Member
I'm interested in building an editor with GMF Runtime manually.

The reason is, that we have an own file format, we have to read first with xtext and than want to forward the emf data to the editor for displaying it. So we have no XMI file to display.
We have already a working GEF solution, but now we want to change to GMF. Perhaps we can simply adjust some imports and functions so it works?

Otherwise can someone tell me how to start from the very first? I tried today to start with a simple class extending the DiagramEditorWithFlyOutPalette, analog to the class GraphicalEditorWithFlyoutPalette like it was described for GEF at the end of the tutorial part 3 at vainolo.com. Unfortunately i'm not allowed yet to post the link.

But it doesn't work exactly like that and instead i got a NullPointerException:
java.lang.NullPointerException
at org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor.getOperationHistory(DiagramEditor.java:1086)

It would be fine, if somebody can help me anyway. Thank you in advance!

[Updated on: Wed, 28 September 2011 05:47]

Report message to a moderator

Re: GMF Runtime - Creating an editor manually [message #730390 is a reply to message #730384] Wed, 28 September 2011 05:44 Go to previous messageGo to next message
Mickael Istria is currently offline Mickael Istria
Messages: 745
Registered: July 2009
Location: Grenoble, France
Senior Member
On 28/09/2011 11:38, Mischa Nietfeld wrote:
> I'm interested in building an editor with GMF Runtime manually.
>
> The reason is, that we have an own file format, we have to read first
> with xtext and than want to forward the emf data to the editor for
> displaying it. So we have no XMI file to display.

GMF (Runtime and Tooling) does not depend at all on how the file is
serialized (XMI, XML, DSL with XText) - except when loading models from
files. They directly rely on EMF.
You could use GMF Tooling to create your editor, and do the necessary
few changes to have your EObjects deserialized correctly according to
your file format. If you do that, please track your progress and share
it with the community, that would be a high-value contribution.

> We have already a working GEF solution, but now we want to change to
> GMF. Perhaps we can simply adjust some imports and functions so it works?

Why does *functionally* make you want to move to GMF ?

--
http://mickaelistria.wordpress.com
http://twitter.com/#!/mickaelistria
http://www.petalslink.com
Re: GMF Runtime - Creating an editor manually [message #730395 is a reply to message #730384] Wed, 28 September 2011 05:56 Go to previous messageGo to next message
Andreas Muelder is currently offline Andreas Muelder
Messages: 71
Registered: July 2011
Member
Hi Mischa,

Quote:

The reason is, that we have an own file format, we have to read first with xtext and than want to forward the emf data to the editor for displaying it. So we have no XMI file to display.

The common way to do is to split up the notation model and the semantic model into 2 different resources. The notation model can still stay XMI, the semantic model is your xtext model. (I think you did not pollute your semantic model with layout informations, did you?) the semantic model is loaded via the XtextResource then, your graphical editor does not even know that he is currently editing an Xtext Resource. Smile

Quote:

Otherwise can someone tell me how to start from the very first?

I implemented the YAKINDU Statechart Tools Editor from scratch without GMF tooling.
Maybe you want to have a look at the source code there.
http://code.google.com/a/eclipselabs.org/p/yakindu/source/browse#svn%2FSCT2

At the very first, you should start with an editor extending DiagramDocumentEditor.
The register an editpart provider and a view provider via the provided extension point. Add some editparts (extend from ShapeNodeEditPart or ConnectionEditPart) and some view factories.
the plugin 'org.yakindu.sct.ui.editor' in the provided SVN repository may help you building an editor with GMF runtime.


Re: GMF Runtime - Creating an editor manually [message #731670 is a reply to message #730395] Sun, 02 October 2011 07:57 Go to previous messageGo to next message
Mischa N. is currently offline Mischa N.
Messages: 3
Registered: September 2011
Junior Member
Hi Mickael,
thank you for your reply. I will try to do this and change the generated editor code for my purpose. A friend said that this will not be easy, but i will see.
We want to switch to GMF because it provides functionality like zoom, customizable coordinate systems and so on. Unfortunately i'm new to this topic so i cannot explain in further detail. That are the benefits, that was told me.
Re: GMF Runtime - Creating an editor manually [message #731674 is a reply to message #731670] Sun, 02 October 2011 08:10 Go to previous message
Mischa N. is currently offline Mischa N.
Messages: 3
Registered: September 2011
Junior Member
Hi Andreas,
you are right, we have not only one model for the notation and the semantic model altogether. So we have two files and one connecting file that describes the link between this data. If i open this file, the other both (domain and diagram) should be read and the content should be displayed.

I will now first try to update the with GMF Tooling generated editor for my purpose. If it does not seem to work fine, i will try to do it from scratch and if also this fails in the next days, i think we will stay at GEF. Because it would be nice to have but currently we do not need it urgently.

Thank you too for your code example. I will have a look at it.
Previous Topic:Sharing content within diagram
Next Topic:: Creating Custom Property cell editor in GMF 2.0
Goto Forum:
  


Current Time: Fri Aug 29 18:25:00 EDT 2014

Powered by FUDForum. Page generated in 0.01878 seconds