开发者

Starting with Eclipse GMF

开发者 https://www.devze.com 2023-03-02 20:55 出处:网络
I\'m new to Eclipse GMF and I was able to complete the mind map tutoria开发者_开发百科l successfully.

I'm new to Eclipse GMF and I was able to complete the mind map tutoria开发者_开发百科l successfully. After that, I started developing a graphical editor using it.I've generated the domain model using a XML schema. Now I need to develop graphical, tooling and mapping definition models.But I don't have a much understanding about it. Where I can get a good understanding about them?


The GMF framework indeed lacks the proper documentation other similar libraries have (such as EMF , JFace, etc) When I started using GMF (not so long ago) I mostly read through the GMF Forum. However, the eclipse modeling project book has 2-3 chapters that deal with GMF specifically. I found them quite tedious, boring and too detailed. It can serve more as a reference and less as a tutorial...


You can use this process to make a Functional graphical editor using GMF.

I am going to use following eclipse packages to make everything simple

Tool Name : EuGENia which comes as a part of Epsilon Eclipse Package available @ www.eclipse.org/epsilon

Step 1 : - Create an empty EMF Project (I hope you probably know this)

Step 2 : - Create a file_name.emf file in the model folder by following the syntax on this link

Step 3 : - Right click on the .emf file and click "Generate Ecore Model". This will generate the .ecore file

Step 4 : - Using the .ecore file you can generate the .genmodel file

Step 5 : - There are 2 ways to proceed from here

Option 1 : - Right click on .ecore file and click "Generate GMF Editor" under the Eugenia Category.

Option 2 : - Follow the below steps

Option 2, Step 1 : - Right click on .ecore file and click "Generate GMF tool,graph and map models" under the Eugenia category.

Option 2, Step 2 : - Open the GMF Dashboard View in eclipse as shown in this link and then give all the above generated files as inputs to the GMF Dashboard and then you can generate the required editor.

Explanation : -

As said by Protostome GMF lacks proper documentation so I had to search for ways to make things work for me to complete my tool. So after a long search I found the link that I have given in step 1 which solved a lot of my problems. I will explain you what EuGENia framework does with the *.emf file.

*.emf is basically a file which describes an Ecore model textually. Emfatic is background technology used by this tool. EuGENia framework takes advantage of this file and extends it to add GMF related properties as attributes to the ecore model that we are writing using Emfatic syntax (use can see the various properties supported by EuGENia in that link).

This does most of the ground work to give us a working GMF Editor.

Note : - Though this gives us a great start, I find it difficult to do some things like arranging the images on the diagram based on some routing algorithm, etc (For example when I want to show Parent-Child table relations this tool alligns everything either vertically or horizontally, I couldn't change that behaviour till now).

That was my experience with the GMF Editors, let me know if you need further help or if you have any doubts in my explanation


Best thing you can do for understand after complete Mind Map tutorial is, Find out what really does by those wizards to generate the java code for mindMap.diagram. This is what I really understood.

mindmap.ecore - define java classes which we need to implement.

mindmap.genmodel - use for generate java model code which we defined on .ecore file.

Now we have java code for model object. Next what need is images for represent those objects. use Graphical Definition Model wizard for generate figures for them. mindmap.gmfgraph - figures (node, links) for model objects. Try with changing its property values.

Next we need to define What object should show in tool pallet. For that Tooling Definition Model wizard use. mindmap.gmftool - Use .ecore file for chose what objects should be in pallet.

Next one important to understand well. This where we connect generated java model objects to its figures (which generated in .gmfgraph) , tool pallet ( which defined in .gmftool). Go through its property values few times. mindmap.gmfmap - map object definition and its view

Then we can use create mindmap.gmfgen for code generation. Generated code would run in new eclipse model with new mindmap model.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号