dimanche 15 février 2009

GMF: first contact

First contact is a term describing the first meeting of two cultures previously unaware of one another...

Running the mindmap sample

Simply begin and try to execute the raw mindmap sample without generating nor changing anything.

Installation
Install the modeling Eclipse Ganymede's bundle here: http://www.eclipse.org/downloads/
eclipse-modeling-ganymede-incubation-win32.zip
eclipse-modeling-ganymede-SR1-incubation-win32.zip

Checkout the GMF examples from the cvs repository:

:pserver:anonymous@dev.eclipse.org:/cvsroot/modeling
HEAD/org.eclipse.gmf.examples
or download from here: http://f.pfister.free.fr/archives/gmf_examples.zip

Install the 3 following examples:
File/import/existing project into workspace (check: copy project into workspace)

org.eclipse.gmf.examples.mindmap
org.eclipse.gmf.examples.mindmap.edit
org.eclipse.gmf.examples.mindmap.diagram

Running the example
Right click on org.eclipse.gmf.examples.mindmap.diagram, run as Eclipse Application. This will run the org.eclipse.gmf.examples.mindmap.diagram plugin (graphical model editor), using org.eclipse.gmf.examples.mindmap (containing the metamodel) and org.eclipse.gmf.examples.mindmap.edit (provide property editing capabilities)
File/new/project/general project
File/new/Examples/Mindmap Diagram
Window/show view/properties

Create a new model
Compose a new model with 2 resources, 5 topics, one of them composed of 2 threads, each composed of several threadItems. Link topics, threads, threadItems to resources.

Model source code: http://f.pfister.free.fr/archives/myfirst.mindmap



The model diagram


The model tree



The model source

Looking at the Metamodel
Let's try to understand how the metamodel is the models's model.
Go back to the org.eclipse.gmf.examples.mindmap project, open the metamodel:
Open org.eclipse.gmf.examples.mindmap/model/mindmap.ecore_diagram
or Initialize Ecore Diagram File (right click on mindmap.ecore), and layout a clean diagram as below:


The Mindmap Metamodel


The Mindmap Metamodel as a tree

The Mindmap Metamodel as an ecore xml file


Tasks:

  • Understand the model conformity to the metamodel
  • Propose to check the model's consistency (Topic and it's first thread belongs to the same resource ?)
  • Propose to extend the model's semantic (visualize links between threadItems and resources ?)
Resources

Model source code

http://f.pfister.free.fr/archives/myfirst.mindmap

checkout from my SVN

http://gmfhowto.googlecode.com/svn/branches/gmf-examples-1.0/