Bug 363449:
Initial contribution of an "outline" figure preview for gmfgraph.
diff --git a/.project b/.project
deleted file mode 100644
index fdc98b2..0000000
--- a/.project
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-	<name>org.eclipse.gmf.tooling-root</name>
-	<comment></comment>
-	<projects>
-	</projects>
-	<buildSpec>
-	</buildSpec>
-	<natures>
-	</natures>
-</projectDescription>
diff --git a/features/org.eclipse.gmf.tooling-feature/feature.xml b/features/org.eclipse.gmf.tooling-feature/feature.xml
index b4a16ca..514b026 100755
--- a/features/org.eclipse.gmf.tooling-feature/feature.xml
+++ b/features/org.eclipse.gmf.tooling-feature/feature.xml
@@ -262,4 +262,10 @@
          version="0.0.0"
          unpack="false"/>
 
+   <plugin
+         id="org.eclipse.gmf.graphdef.runtime"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"/>
+
 </feature>
diff --git a/plugins/org.eclipse.gmf.graphdef.edit/.classpath b/plugins/org.eclipse.gmf.graphdef.edit/.classpath
index 304e861..51c325d 100644
--- a/plugins/org.eclipse.gmf.graphdef.edit/.classpath
+++ b/plugins/org.eclipse.gmf.graphdef.edit/.classpath
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
 	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="src" path="src-extras"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
 	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
 	<classpathentry kind="output" path="bin"/>
diff --git a/plugins/org.eclipse.gmf.graphdef.edit/META-INF/MANIFEST.MF b/plugins/org.eclipse.gmf.graphdef.edit/META-INF/MANIFEST.MF
index f306cca..eba4d92 100644
--- a/plugins/org.eclipse.gmf.graphdef.edit/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.gmf.graphdef.edit/META-INF/MANIFEST.MF
@@ -15,6 +15,8 @@
  org.eclipse.emf.edit;bundle-version="[2.4.0,3.0.0)";visibility:=reexport,
  org.eclipse.emf.ecore.xmi;bundle-version="[2.4.0,3.0.0)";visibility:=reexport,
  org.eclipse.emf.edit.ui;bundle-version="[2.4.0,3.0.0)";visibility:=reexport,
- org.eclipse.ui.ide;bundle-version="[3.3.0,4.0.0)";visibility:=reexport
+ org.eclipse.ui.ide;bundle-version="[3.3.0,4.0.0)";visibility:=reexport,
+ org.eclipse.gmf.graphdef.runtime;bundle-version="0.0.1",
+ org.eclipse.draw2d;bundle-version="3.7.1"
 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/plugins/org.eclipse.gmf.graphdef.edit/plugin.xml b/plugins/org.eclipse.gmf.graphdef.edit/plugin.xml
index 2abfb50..5520078 100644
--- a/plugins/org.eclipse.gmf.graphdef.edit/plugin.xml
+++ b/plugins/org.eclipse.gmf.graphdef.edit/plugin.xml
@@ -47,12 +47,13 @@
 
   <extension point = "org.eclipse.ui.editors">
     <editor
-        id = "org.eclipse.gmf.gmfgraph.presentation.GMFGraphEditorID"
-        name = "%_UI_GMFGraphEditor_label"
-        icon = "icons/full/obj16/GMFGraphModelFile.gif"
-        extensions = "gmfgraph"
-        class = "org.eclipse.gmf.gmfgraph.presentation.GMFGraphEditor" 
-        contributorClass="org.eclipse.gmf.gmfgraph.presentation.GMFGraphActionBarContributor" >
+          class="org.eclipse.gmf.graphdef.edit.GMFGraphEditorEx"
+          contributorClass="org.eclipse.gmf.gmfgraph.presentation.GMFGraphActionBarContributor"
+          default="true"
+          extensions="gmfgraph"
+          icon="icons/full/obj16/GMFGraphModelFile.gif"
+          id="org.eclipse.gmf.gmfgraph.presentation.GMFGraphEditorID"
+          name="%_UI_GMFGraphEditor_label">
     </editor>
-  </extension>    
+  </extension>
 </plugin>
diff --git a/plugins/org.eclipse.gmf.graphdef.edit/src-extras/org/eclipse/gmf/graphdef/edit/GMFGraphEditorEx.java b/plugins/org.eclipse.gmf.graphdef.edit/src-extras/org/eclipse/gmf/graphdef/edit/GMFGraphEditorEx.java
new file mode 100644
index 0000000..5e09dd6
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.edit/src-extras/org/eclipse/gmf/graphdef/edit/GMFGraphEditorEx.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+* Copyright (c) 2011 EBM Websourcing (PetalsLink)
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*
+* Contributors:
+* Mickael Istria (EBM - PetalsLink) : initial implementation
+*******************************************************************************/
+package org.eclipse.gmf.graphdef.edit;
+
+import org.eclipse.gmf.gmfgraph.presentation.GMFGraphEditor;
+import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
+
+public class GMFGraphEditorEx extends GMFGraphEditor {
+	
+	@Override
+	public IContentOutlinePage getContentOutlinePage() {
+		if (contentOutlinePage == null) {
+			PreviewRenderedFigureOutlinePage res = new PreviewRenderedFigureOutlinePage(); 
+			contentOutlinePage = res;
+			this.addSelectionChangedListener(res);
+		}
+
+		return contentOutlinePage;
+	}
+
+}
diff --git a/plugins/org.eclipse.gmf.graphdef.edit/src-extras/org/eclipse/gmf/graphdef/edit/PreviewRenderedFigureOutlinePage.java b/plugins/org.eclipse.gmf.graphdef.edit/src-extras/org/eclipse/gmf/graphdef/edit/PreviewRenderedFigureOutlinePage.java
new file mode 100644
index 0000000..053bd9a
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.edit/src-extras/org/eclipse/gmf/graphdef/edit/PreviewRenderedFigureOutlinePage.java
@@ -0,0 +1,119 @@
+/*******************************************************************************
+* Copyright (c) 2011 EBM Websourcing (PetalsLink)
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*
+* Contributors:
+* Mickael Istria (EBM - PetalsLink) : initial implementation
+*******************************************************************************/
+package org.eclipse.gmf.graphdef.edit;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.FigureCanvas;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.gmf.gmfgraph.DiagramElement;
+import org.eclipse.gmf.gmfgraph.Figure;
+import org.eclipse.gmf.gmfgraph.FigureDescriptor;
+import org.eclipse.gmf.gmfgraph.FigureRef;
+import org.eclipse.gmf.runtime.graphdef.GMFGraphRenderedFigure;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.part.Page;
+import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
+
+class PreviewRenderedFigureOutlinePage extends Page implements IContentOutlinePage, ISelectionChangedListener {
+
+	private RectangleFigure background;
+	private FigureCanvas control;
+
+	@Override
+	public void createControl(Composite parent) {
+		FigureCanvas canvas = new FigureCanvas(parent);
+		canvas.setBackground(ColorConstants.white);
+		background = new RectangleFigure();
+		background.setForegroundColor(ColorConstants.white);
+		background.setBackgroundColor(ColorConstants.white);
+		org.eclipse.draw2d.GridLayout rectangleLayout = new org.eclipse.draw2d.GridLayout();
+		background.setLayoutManager(rectangleLayout);
+		rectangleLayout.marginHeight = 10;
+		rectangleLayout.marginWidth = 10;
+		canvas.setContents(background);
+		this.control = canvas;
+	}
+
+	@Override
+	public void dispose() {
+		// TODO Auto-generated method stub
+
+	}
+
+	@Override
+	public Control getControl() {
+		return control;
+	}
+
+	@Override
+	public void setActionBars(IActionBars actionBars) {
+	}
+
+	@Override
+	public void setFocus() {
+		getControl().setFocus();
+	}
+
+	@Override
+	public void addSelectionChangedListener(ISelectionChangedListener listener) {
+	}
+
+	@Override
+	public ISelection getSelection() {
+		return new StructuredSelection();
+	}
+
+	@Override
+	public void removeSelectionChangedListener(ISelectionChangedListener listener) {
+	}
+
+	@Override
+	public void setSelection(ISelection selection) {
+		handleSelectionChanged(selection);
+	}
+
+	private void handleSelectionChanged(ISelection selection) {
+		background.removeAll();
+		if (selection instanceof IStructuredSelection) {
+			Object item = ((IStructuredSelection) selection).getFirstElement();
+			Figure modelFigure = null;
+			if (item instanceof FigureRef) {
+				modelFigure = ((FigureRef) item).getFigure();
+			} else if (item instanceof FigureDescriptor) {
+				modelFigure = ((FigureDescriptor)item).getActualFigure();
+			} else if (item instanceof DiagramElement) {
+				FigureDescriptor figureDesc = ((DiagramElement) item).getFigure();
+				if (figureDesc != null) {
+					modelFigure = figureDesc.getActualFigure();
+				}
+			} else if (item instanceof Figure) {
+				modelFigure = (Figure) item;
+			}
+			
+			if (modelFigure != null) {
+				GMFGraphRenderedFigure draw2figure = new GMFGraphRenderedFigure(modelFigure);
+				background.add(draw2figure);
+			}
+		}
+	}
+
+	@Override
+	public void selectionChanged(SelectionChangedEvent event) {
+		handleSelectionChanged(event.getSelection());
+	}
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.graphdef.runtime/.classpath b/plugins/org.eclipse.gmf.graphdef.runtime/.classpath
new file mode 100644
index 0000000..ad32c83
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.runtime/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.gmf.graphdef.runtime/.project b/plugins/org.eclipse.gmf.graphdef.runtime/.project
new file mode 100644
index 0000000..a311a73
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.runtime/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.eclipse.gmf.graphdef.runtime</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.gmf.graphdef.runtime/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.gmf.graphdef.runtime/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..528ade9
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.runtime/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Wed Nov 16 16:27:33 CET 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/plugins/org.eclipse.gmf.graphdef.runtime/META-INF/MANIFEST.MF b/plugins/org.eclipse.gmf.graphdef.runtime/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..0e6b37f
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.runtime/META-INF/MANIFEST.MF
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Plugin to consume directly the GraphDef in a diagram at runtime
+Bundle-SymbolicName: org.eclipse.gmf.graphdef.runtime
+Bundle-Version: 0.0.1.qualifier
+Bundle-Activator: org.eclipse.gmf.runtime.graphdef.internal.Activator
+Bundle-Vendor: Eclipse.org
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.draw2d;bundle-version="3.7.1",
+ org.eclipse.gmf.graphdef;bundle-version="2.0.100",
+ org.eclipse.emf;bundle-version="2.6.0",
+ org.eclipse.emf.ecore;bundle-version="2.7.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.gmf.runtime.graphdef
diff --git a/plugins/org.eclipse.gmf.graphdef.runtime/about.html b/plugins/org.eclipse.gmf.graphdef.runtime/about.html
new file mode 100644
index 0000000..1b8f940
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.runtime/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+ 
+<p>June 5, 2007</p>	
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;).  Unless otherwise 
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;).  A copy of the EPL is available 
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is 
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content.  Check the Redistributor's license that was 
+provided with the Content.  If no such license exists, contact the Redistributor.  Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.graphdef.runtime/build.properties b/plugins/org.eclipse.gmf.graphdef.runtime/build.properties
new file mode 100644
index 0000000..34d2e4d
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.runtime/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .
diff --git a/plugins/org.eclipse.gmf.graphdef.runtime/pom.xml b/plugins/org.eclipse.gmf.graphdef.runtime/pom.xml
new file mode 100644
index 0000000..eb92404
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.runtime/pom.xml
@@ -0,0 +1,44 @@
+<!--
+ * Copyright (c) 2011 PetalsLink
+ *  All rights reserved. This program and the accompanying materials
+ *  are made available under the terms of the Eclipse Public License v1.0
+ *  which accompanies this distribution, and is available at
+ *  http://www.eclipse.org/legal/epl-v10.html
+ *  
+ *   Contributors:
+ *      Mickael istria (PetalsLink)
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>org.eclipse.gmf-tooling.plugins</groupId>
+	<artifactId>org.eclipse.gmf.graphdef.runtime</artifactId>
+	<version>0.0.1-SNAPSHOT</version>
+	<packaging>eclipse-plugin</packaging>
+
+	<parent>
+		<groupId>org.eclipse.gmf-tooling</groupId>
+		<artifactId>plugins</artifactId>
+		<version>2.4.1-SNAPSHOT</version>
+		<relativePath>../</relativePath>
+	</parent>
+
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.eclipse.tycho</groupId>
+				<artifactId>tycho-source-plugin</artifactId>
+				<version>${tycho-version}</version>
+				<executions>
+					<execution>
+						<id>attach-source</id>
+						<goals>
+							<goal>plugin-source</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+	</build>
+
+</project>
\ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.graphdef.runtime/src/org/eclipse/gmf/runtime/graphdef/GMFGraphRenderedFigure.java b/plugins/org.eclipse.gmf.graphdef.runtime/src/org/eclipse/gmf/runtime/graphdef/GMFGraphRenderedFigure.java
new file mode 100644
index 0000000..29bc7b1
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.runtime/src/org/eclipse/gmf/runtime/graphdef/GMFGraphRenderedFigure.java
@@ -0,0 +1,361 @@
+/*******************************************************************************
+* Copyright (c) 2011 EBM Websourcing (PetalsLink)
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*
+* Contributors:
+* Mickael Istria (EBM - PetalsLink) : initial implementation
+*******************************************************************************/
+package org.eclipse.gmf.runtime.graphdef;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.draw2d.Border;
+import org.eclipse.draw2d.BorderLayout;
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Ellipse;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.GridData;
+import org.eclipse.draw2d.GridLayout;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.LayoutManager;
+import org.eclipse.draw2d.Polyline;
+import org.eclipse.draw2d.PolylineDecoration;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.ScalablePolygonShape;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.gmfgraph.Alignment;
+import org.eclipse.gmf.gmfgraph.ConstantColor;
+import org.eclipse.gmf.gmfgraph.CustomLayout;
+import org.eclipse.gmf.gmfgraph.FigureRef;
+import org.eclipse.gmf.gmfgraph.FlowLayout;
+import org.eclipse.gmf.gmfgraph.GridLayoutData;
+import org.eclipse.gmf.gmfgraph.Layout;
+import org.eclipse.gmf.gmfgraph.LayoutData;
+import org.eclipse.gmf.gmfgraph.LayoutRef;
+import org.eclipse.gmf.gmfgraph.LineKind;
+import org.eclipse.gmf.gmfgraph.Point;
+import org.eclipse.gmf.gmfgraph.PolygonDecoration;
+import org.eclipse.gmf.gmfgraph.PolylineConnection;
+import org.eclipse.gmf.gmfgraph.RGBColor;
+import org.eclipse.gmf.gmfgraph.RealFigure;
+import org.eclipse.gmf.gmfgraph.RoundedRectangle;
+import org.eclipse.gmf.gmfgraph.ScalablePolygon;
+import org.eclipse.gmf.gmfgraph.Shape;
+import org.eclipse.gmf.gmfgraph.StackLayout;
+import org.eclipse.gmf.gmfgraph.XYLayout;
+import org.eclipse.gmf.gmfgraph.XYLayoutData;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * This class represents the runtime Draw2d {@link IFigure} for a given
+ * .gmfgraph {@link org.eclipse.gmf.gmfgraph.Figure} description.
+ * 
+ * It simply interprets all given attributes to instantiate a Draw2d figure.
+ * 
+ * @author Mickael Istria - EBM WebSourcing
+ */
+public class GMFGraphRenderedFigure extends Figure {
+	
+	private static class ConvertedFigure {
+		public IFigure figure;
+		public Object layoutData;
+	}
+
+	private IFigure mainFigure;
+	private List<Color> toDisposeColors = new ArrayList<Color>();
+	private List<Font> toDisposeFonts = new ArrayList<Font>();
+	
+	public GMFGraphRenderedFigure(org.eclipse.gmf.gmfgraph.Figure figureDef) {
+		setLayoutManager(new GridLayout(1, false));
+		ConvertedFigure res = toDraw2d(figureDef); 
+		mainFigure = res.figure;
+		GridData gridData = new GridData();
+		gridData.widthHint = mainFigure.getPreferredSize().width;
+		gridData.heightHint = mainFigure.getPreferredSize().height;
+		add(mainFigure, gridData);
+	}
+	
+	@Override
+	public void erase() {
+		for (Color color : toDisposeColors) {
+			color.dispose();
+		}
+		for (Font font : toDisposeFonts) {
+			font.dispose();
+		}
+		super.erase();
+	}
+
+	private ConvertedFigure toDraw2d(org.eclipse.gmf.gmfgraph.Figure figureDef) {
+		IFigure figure = null;
+		Object layoutData = null;
+		// Create Figure
+		if (figureDef instanceof FigureRef) {
+			ConvertedFigure converted = toDraw2d(((FigureRef)figureDef).getFigure());
+			figure = converted.figure;
+			layoutData = converted.layoutData;
+		} else if (figureDef instanceof org.eclipse.gmf.gmfgraph.Ellipse) {
+			figure = new Ellipse();
+		} else if (figureDef instanceof org.eclipse.gmf.gmfgraph.Rectangle) {
+			figure = new RectangleFigure();
+		} else if (figureDef instanceof RoundedRectangle) {
+			figure = new org.eclipse.draw2d.RoundedRectangle();
+		} else if (figureDef instanceof PolygonDecoration) {
+			figure = new org.eclipse.draw2d.PolygonDecoration();
+		} else if (figureDef instanceof ScalablePolygon) {
+			figure = new ScalablePolygonShape();
+		} else if (figureDef instanceof org.eclipse.gmf.gmfgraph.Polygon) {
+			figure = new org.eclipse.draw2d.Polygon();
+		} else if (figureDef instanceof PolylineDecoration) {
+			figure = new PolylineDecoration();
+		} else if (figureDef instanceof PolylineConnection) {
+			figure = new org.eclipse.draw2d.PolylineConnection();
+		} else if (figureDef instanceof org.eclipse.gmf.gmfgraph.Polyline) {
+			figure = new Polyline();
+		} else {
+			// TODO connections, label, decoration, custom...
+			// all other concrete types for a Figure
+		}
+		
+		if (figureDef.getLayoutData() != null) {
+			layoutData = toDraw2d(figureDef.getLayoutData());
+		}
+		
+		populate(figureDef, figure);
+		
+		ConvertedFigure res = new ConvertedFigure();
+		res.figure = figure;
+		res.layoutData = layoutData;
+		return res;
+	}
+
+	private void populate(org.eclipse.gmf.gmfgraph.Figure figureDef, IFigure figure) {
+		// populate children and attrs
+		if (figureDef.getBackgroundColor() != null) {
+			figure.setBackgroundColor(toDraw2d(figureDef.getBackgroundColor()));
+		}
+		if (figureDef.getBorder() != null) {
+			figure.setBorder(toDraw2d(figureDef.getBorder()));
+		}
+		if (figureDef.getFont() != null) {
+			figure.setFont(toDraw2d(figureDef.getFont()));
+		}
+		if (figureDef.getForegroundColor() != null) {
+			figure.setForegroundColor(toDraw2d(figureDef.getForegroundColor()));
+		}
+		if (figureDef.getInsets() != null) {
+			// TODO
+		}
+		if (figureDef.getLayout() != null) {
+			figure.setLayoutManager(toDraw2d(figureDef.getLayout()));
+		}
+		if (figureDef.getLocation() != null) {
+			figure.setLocation(toDraw2d(figureDef.getLocation()));
+		}
+		if (figureDef.getMaximumSize() != null) {
+			figure.setMaximumSize(toDraw2d(figureDef.getMaximumSize()));
+		}
+		if (figureDef.getMinimumSize() != null) {
+			figure.setMinimumSize(toDraw2d(figureDef.getMinimumSize()));
+		}
+		if (figureDef.getPreferredSize() != null) {
+			figure.setPreferredSize(toDraw2d(figureDef.getPreferredSize()));
+		}
+		if (figureDef.getSize() != null) {
+			figure.setSize(toDraw2dDimension(figureDef.getSize()));
+		}
+		
+		if (figureDef instanceof Shape) {
+			Shape shapeDef = (Shape)figureDef;
+			org.eclipse.draw2d.Shape shape = (org.eclipse.draw2d.Shape) figure;
+			shape.setFill(shapeDef.isFill());
+			shape.setOutline(shapeDef.isOutline());
+			shape.setXOR(shapeDef.isXorFill());
+			shape.setLineStyle(toDraw2d(shapeDef.getLineKind()));
+			shape.setLineWidth(shapeDef.getLineWidth());
+		}
+		
+		if (figureDef instanceof RealFigure) {
+			for (EObject child : ((RealFigure)figureDef).getChildren()) {
+				if (child instanceof org.eclipse.gmf.gmfgraph.Figure) {
+					ConvertedFigure converted = toDraw2d((org.eclipse.gmf.gmfgraph.Figure)child);
+					figure.add(converted.figure, converted.layoutData);
+				}
+			}
+		}
+		
+		if (figureDef instanceof RoundedRectangle) {
+			RoundedRectangle rectangleDef = (RoundedRectangle)figureDef;
+			((org.eclipse.draw2d.RoundedRectangle)figure).setCornerDimensions(new Dimension(rectangleDef.getCornerWidth(), rectangleDef.getCornerHeight()));
+		}
+		
+		if (figureDef instanceof org.eclipse.gmf.gmfgraph.Polyline) {
+			org.eclipse.gmf.gmfgraph.Polyline polylineDef = (org.eclipse.gmf.gmfgraph.Polyline)figureDef;
+			for (Point point : polylineDef.getTemplate()) {
+				((Polyline)figure).addPoint(toDraw2d(point));
+			}
+		}
+	}
+	
+	
+
+	////////////////
+	// Converters //
+	////////////////
+	
+	private int toDraw2d(LineKind lineKind) {
+		switch (lineKind) {
+			case LINE_CUSTOM_LITERAL: return SWT.LINE_CUSTOM;
+			case LINE_DASH_LITERAL: return SWT.LINE_DASH;
+			case LINE_DASHDOT_LITERAL: return SWT.LINE_DASHDOT;
+			case LINE_DASHDOTDOT_LITERAL: return SWT.LINE_DASHDOTDOT;
+			case LINE_DOT_LITERAL: return SWT.LINE_DOT;
+			case LINE_SOLID_LITERAL: return SWT.LINE_SOLID;
+		};
+		return SWT.DEFAULT;
+	}
+
+	private LayoutManager toDraw2d(Layout layout) {
+		if (layout instanceof LayoutRef) {
+			return toDraw2d(((LayoutRef) layout).getActual());
+		} else if (layout instanceof org.eclipse.gmf.gmfgraph.BorderLayout) {
+			org.eclipse.gmf.gmfgraph.BorderLayout layoutDef = (org.eclipse.gmf.gmfgraph.BorderLayout)layout;
+			BorderLayout res = new BorderLayout();
+			res.setHorizontalSpacing(layoutDef.getSpacing().getDx());
+			res.setVerticalSpacing(layoutDef.getSpacing().getDy());
+			return res;
+		} else if (layout instanceof CustomLayout) {
+			((CustomLayout) layout).getQualifiedClassName();
+			return null;
+		} else if (layout instanceof FlowLayout) {
+			FlowLayout layoutDef = (FlowLayout)layout;
+			org.eclipse.draw2d.FlowLayout res = new org.eclipse.draw2d.FlowLayout();
+			res.setHorizontal(!layoutDef.isVertical());
+			res.setMajorAlignment(toDraw2d(layoutDef.getMajorAlignment()));
+			res.setMinorAlignment(toDraw2d(layoutDef.getMinorAlignment()));
+			res.setMajorSpacing(layoutDef.getMajorSpacing());
+			res.setMinorAlignment(layoutDef.getMinorSpacing());
+			return res;
+		} else if (layout instanceof org.eclipse.gmf.gmfgraph.GridLayout) {
+			org.eclipse.gmf.gmfgraph.GridLayout layoutDef = (org.eclipse.gmf.gmfgraph.GridLayout) layout;
+			GridLayout res = new GridLayout();
+			if (layoutDef.getSpacing() != null) {
+				res.horizontalSpacing = layoutDef.getSpacing().getDx();
+				res.verticalSpacing = layoutDef.getSpacing().getDy();
+			}
+			if (layoutDef.getMargins() != null) {
+				res.marginHeight = layoutDef.getMargins().getDy();
+				res.marginWidth = layoutDef.getMargins().getDx();
+			}
+			res.makeColumnsEqualWidth = layoutDef.isEqualWidth();
+			res.numColumns = layoutDef.getNumColumns();
+			return res;
+		} else if (layout instanceof StackLayout) {
+			return new org.eclipse.draw2d.StackLayout();
+		} else if (layout instanceof XYLayout) {
+			return new org.eclipse.draw2d.XYLayout();
+		}
+		return null;
+	}
+
+	private int toDraw2d(Alignment majorAlignment) {
+		switch (majorAlignment) {
+		case BEGINNING_LITERAL: return SWT.BEGINNING;
+		case END_LITERAL: return SWT.END;
+		case CENTER_LITERAL: return SWT.CENTER;
+		case FILL_LITERAL: return SWT.FILL;
+		}
+		return SWT.DEFAULT;
+	}
+
+	private Font toDraw2d(org.eclipse.gmf.gmfgraph.Font font) {
+		Font res = new Font(Display.getDefault(), new FontData(font.toString()));
+		toDisposeFonts.add(res);
+		return res;
+	}
+	
+	private Border toDraw2d(org.eclipse.gmf.gmfgraph.Border border) {
+		// TODO
+		return null;
+	}
+
+	private Color toDraw2d(org.eclipse.gmf.gmfgraph.Color colorDef) {
+		if (colorDef instanceof ConstantColor) {
+			switch (((ConstantColor) colorDef).getValue()) {
+			case BLACK_LITERAL: return ColorConstants.black;
+			case BLUE_LITERAL: return ColorConstants.blue;
+			case CYAN_LITERAL: return ColorConstants.cyan;
+			case DARK_BLUE_LITERAL: return ColorConstants.darkBlue;
+			case DARK_GRAY_LITERAL: return ColorConstants.darkGray;
+			case DARK_GREEN_LITERAL: return ColorConstants.darkGreen;
+			case GRAY_LITERAL: return ColorConstants.gray;
+			case GREEN_LITERAL: return ColorConstants.green;
+			case LIGHT_BLUE_LITERAL: return ColorConstants.lightBlue;
+			case LIGHT_GRAY_LITERAL: return ColorConstants.lightGray;
+			case LIGHT_GREEN_LITERAL: return ColorConstants.lightGreen;
+			case ORANGE_LITERAL: return ColorConstants.orange;
+			case RED_LITERAL: return ColorConstants.red;
+			case WHITE_LITERAL: return ColorConstants.white;
+			case YELLOW_LITERAL: return ColorConstants.yellow;
+			default:
+				return null;
+			}
+		} else if (colorDef instanceof RGBColor) {
+			RGBColor rgbColorDef = (RGBColor)colorDef;
+			RGB rgb = new RGB(rgbColorDef.getBlue(), rgbColorDef.getGreen(), rgbColorDef.getRed());
+			Color res = new Color(Display.getDefault(), rgb);
+			toDisposeColors.add(res);
+			return res;
+		}
+		return null;
+	}
+
+	private Object toDraw2d(LayoutData layoutData) {
+		if (layoutData instanceof XYLayoutData) {
+			XYLayoutData xyLayoutData = (XYLayoutData)layoutData;
+			Rectangle res = new Rectangle();
+			res.setSize(toDraw2d(xyLayoutData.getSize()));
+			res.setLocation(toDraw2d(xyLayoutData.getTopLeft()));
+			return res;
+		} else if (layoutData instanceof GridLayoutData) {
+			GridLayoutData gridLayoutData = (GridLayoutData) layoutData;
+			GridData res = new GridData();
+			res.grabExcessHorizontalSpace = gridLayoutData.isGrabExcessHorizontalSpace();
+			res.grabExcessVerticalSpace = gridLayoutData.isGrabExcessVerticalSpace();
+			res.heightHint = gridLayoutData.getSizeHint().getDx();
+			res.widthHint = gridLayoutData.getSizeHint().getDy();
+			res.horizontalAlignment = toDraw2d(gridLayoutData.getHorizontalAlignment());
+			res.verticalAlignment = toDraw2d(((GridLayoutData) layoutData).getVerticalAlignment());
+			res.horizontalIndent = gridLayoutData.getHorizontalIndent();
+			res.horizontalSpan = gridLayoutData.getHorizontalSpan();
+			res.verticalSpan = gridLayoutData.getVerticalSpan();
+			return res;
+		} else {
+			// TODO: Border and Custom NOT SUPPORTED
+			return null;
+		}
+	}
+
+	private org.eclipse.draw2d.geometry.Point toDraw2d(Point point) {
+		return new org.eclipse.draw2d.geometry.Point(point.getX(), point.getY());
+	}
+
+	private Dimension toDraw2dDimension(Point point) {
+		return new Dimension(point.getX(), point.getY());
+	}
+	
+	private Dimension toDraw2d(org.eclipse.gmf.gmfgraph.Dimension size) {
+		return new Dimension(size.getDx(), size.getDy());
+	}
+}
diff --git a/plugins/org.eclipse.gmf.graphdef.runtime/src/org/eclipse/gmf/runtime/graphdef/internal/Activator.java b/plugins/org.eclipse.gmf.graphdef.runtime/src/org/eclipse/gmf/runtime/graphdef/internal/Activator.java
new file mode 100644
index 0000000..6d84acd
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.runtime/src/org/eclipse/gmf/runtime/graphdef/internal/Activator.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+* Copyright (c) 2011 EBM Websourcing (PetalsLink)
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*
+* Contributors:
+* Mickael Istria (EBM - PetalsLink) : initial implementation
+*******************************************************************************/
+package org.eclipse.gmf.runtime.graphdef.internal;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ * 
+ */
+public class Activator extends AbstractUIPlugin {
+
+	// The plug-in ID
+	public static final String PLUGIN_ID = "org.eclipse.gmf.graphdef.runtime"; //$NON-NLS-1$
+
+	// The shared instance
+	private static Activator plugin;
+	
+	/**
+	 * The constructor
+	 */
+	public Activator() {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+	 */
+	public void start(BundleContext context) throws Exception {
+		super.start(context);
+		plugin = this;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+	 */
+	public void stop(BundleContext context) throws Exception {
+		plugin = null;
+		super.stop(context);
+	}
+
+	/**
+	 * Returns the shared instance
+	 *
+	 * @return the shared instance
+	 */
+	public static Activator getDefault() {
+		return plugin;
+	}
+
+}
diff --git a/plugins/pom.xml b/plugins/pom.xml
index a4126d8..e11e295 100755
--- a/plugins/pom.xml
+++ b/plugins/pom.xml
@@ -28,6 +28,7 @@
 		<module>org.eclipse.gmf.graphdef</module>
 		<module>org.eclipse.gmf.graphdef.codegen</module>
 		<module>org.eclipse.gmf.graphdef.codegen.ui</module>
+		<module>org.eclipse.gmf.graphdef.runtime</module>
 		<module>org.eclipse.gmf.graphdef.edit</module>
 		<module>org.eclipse.gmf.graphdef.editor</module>
 		<module>org.eclipse.gmf.tooldef</module>