diff --git a/org.fortiss.tooling.base/trunk/META-INF/MANIFEST.MF b/org.fortiss.tooling.base/trunk/META-INF/MANIFEST.MF
index 86b5ba49541a7946ded8801daee4be43e237bca4..901886303259cfe5d2cfab613f50a62315f459a6 100644
--- a/org.fortiss.tooling.base/trunk/META-INF/MANIFEST.MF
+++ b/org.fortiss.tooling.base/trunk/META-INF/MANIFEST.MF
@@ -8,8 +8,8 @@ Bundle-Vendor: %providerName
 Bundle-Localization: plugin
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Export-Package: org.fortiss.tooling.base.editor,
- org.fortiss.tooling.base.model,
- org.fortiss.tooling.base.model.impl,
- org.fortiss.tooling.base.model.util
+ org.fortiss.tooling.base.model.element,
+ org.fortiss.tooling.base.model.element.impl,
+ org.fortiss.tooling.base.model.element.util
 Require-Bundle: org.fortiss.tooling.kernel;bundle-version="0.0.1";visibility:=reexport
 Bundle-ActivationPolicy: lazy
diff --git a/org.fortiss.tooling.base/trunk/model/base.ecore b/org.fortiss.tooling.base/trunk/model/base.ecore
index a49c72c5e087acc41ea70747012cf391a98e2491..3faca2a3fded1a5ed2123079292eab3866a2fabe 100644
--- a/org.fortiss.tooling.base/trunk/model/base.ecore
+++ b/org.fortiss.tooling.base/trunk/model/base.ecore
@@ -2,47 +2,236 @@
 <ecore:EPackage xmi:version="2.0"
     xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="model"
-    nsURI="http://www.fortiss.org/tooling/base" nsPrefix="org-fortiss-tooling-base">
-  <eClassifiers xsi:type="ecore:EClass" name="IModelElement">
-    <eStructuralFeatures xsi:type="ecore:EReference" name="specifications" upperBound="-1"
-        eType="#//IModelElementSpecification" containment="true"/>
-    <eStructuralFeatures xsi:type="ecore:EReference" name="referencedBy" upperBound="-1"
-        eType="#//IModelElementReference" eOpposite="#//IModelElementReference/reference"/>
-  </eClassifiers>
-  <eClassifiers xsi:type="ecore:EClass" name="IModelElementSpecification" abstract="true"
-      interface="true"/>
-  <eClassifiers xsi:type="ecore:EClass" name="IModelElementReference" abstract="true"
-      interface="true">
-    <eStructuralFeatures xsi:type="ecore:EReference" name="reference" eType="#//IModelElement"
-        eOpposite="#//IModelElement/referencedBy"/>
-  </eClassifiers>
-  <eClassifiers xsi:type="ecore:EClass" name="IHierarchicElement" abstract="true"
-      interface="true" eSuperTypes="#//IHierarchicElementContainer #//IModelElement">
-    <eStructuralFeatures xsi:type="ecore:EReference" name="connections" upperBound="-1"
-        eType="#//IConnection" containment="true"/>
-    <eStructuralFeatures xsi:type="ecore:EReference" name="connectors" upperBound="-1"
-        eType="#//IConnector" containment="true"/>
-  </eClassifiers>
-  <eClassifiers xsi:type="ecore:EClass" name="IHierarchicElementContainer" abstract="true"
-      interface="true">
-    <eStructuralFeatures xsi:type="ecore:EReference" name="containedElements" upperBound="-1"
-        eType="#//IHierarchicElement" containment="true"/>
-  </eClassifiers>
-  <eClassifiers xsi:type="ecore:EClass" name="IConnector" abstract="true" interface="true"
-      eSuperTypes="#//IModelElement">
-    <eStructuralFeatures xsi:type="ecore:EReference" name="incoming" upperBound="-1"
-        eType="#//IConnection" eOpposite="#//IConnection/target"/>
-    <eStructuralFeatures xsi:type="ecore:EReference" name="outgoing" upperBound="-1"
-        eType="#//IConnection" eOpposite="#//IConnection/source"/>
-  </eClassifiers>
-  <eClassifiers xsi:type="ecore:EClass" name="IConnection" abstract="true" interface="true"
-      eSuperTypes="#//IModelElement">
-    <eStructuralFeatures xsi:type="ecore:EReference" name="source" eType="#//IConnector"
-        eOpposite="#//IConnector/outgoing"/>
-    <eStructuralFeatures xsi:type="ecore:EReference" name="target" eType="#//IConnector"
-        eOpposite="#//IConnector/incoming"/>
-  </eClassifiers>
-  <eClassifiers xsi:type="ecore:EClass" name="IHiddenSpecification" abstract="true"
-      interface="true" eSuperTypes="#//IModelElementSpecification"/>
-  <eClassifiers xsi:type="ecore:EClass" name="IAnnotatedSpecification" eSuperTypes="#//IHiddenSpecification"/>
+    nsURI="http://www.fortiss.org/tooling/base/model" nsPrefix="org-fortiss-tooling-base-model">
+  <eSubpackages name="element" nsURI="http://www.fortiss.org/tooling/base/model/element"
+      nsPrefix="org-fortiss-tooling-base-model-element">
+    <eClassifiers xsi:type="ecore:EClass" name="IModelElement">
+      <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+        <details key="documentation" value="Super class of first class model elements."/>
+      </eAnnotations>
+      <eStructuralFeatures xsi:type="ecore:EReference" name="specifications" upperBound="-1"
+          eType="#//element/IModelElementSpecification" containment="true">
+        <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+          <details key="documentation" value="List of model element specifications providing additional model element properties."/>
+        </eAnnotations>
+      </eStructuralFeatures>
+      <eStructuralFeatures xsi:type="ecore:EReference" name="referencedBy" upperBound="-1"
+          eType="#//element/IModelElementReference" eOpposite="#//element/IModelElementReference/reference">
+        <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+          <details key="documentation" value="List of model element references."/>
+        </eAnnotations>
+      </eStructuralFeatures>
+    </eClassifiers>
+    <eClassifiers xsi:type="ecore:EClass" name="IModelElementSpecification" abstract="true"
+        interface="true">
+      <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+        <details key="documentation" value="Super class of model element specifications. Such specifications provide additional plugable properties."/>
+      </eAnnotations>
+    </eClassifiers>
+    <eClassifiers xsi:type="ecore:EClass" name="IModelElementReference" abstract="true"
+        interface="true">
+      <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+        <details key="documentation" value="Super class of EObjects referencing model elements."/>
+      </eAnnotations>
+      <eStructuralFeatures xsi:type="ecore:EReference" name="reference" eType="#//element/IModelElement"
+          eOpposite="#//element/IModelElement/referencedBy">
+        <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+          <details key="documentation" value="The referenced model element."/>
+        </eAnnotations>
+      </eStructuralFeatures>
+    </eClassifiers>
+    <eClassifiers xsi:type="ecore:EClass" name="IHierarchicElement" abstract="true"
+        interface="true" eSuperTypes="#//element/IHierarchicElementContainer #//element/IModelElement">
+      <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+        <details key="documentation" value="Super class of hierarchic model elements."/>
+      </eAnnotations>
+      <eStructuralFeatures xsi:type="ecore:EReference" name="connections" upperBound="-1"
+          eType="#//element/IConnection" containment="true">
+        <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+          <details key="documentation" value="List of aggregated connection model elements. Usually a hierarchic element aggregates all connections of its direct sub-structure."/>
+        </eAnnotations>
+      </eStructuralFeatures>
+      <eStructuralFeatures xsi:type="ecore:EReference" name="connectors" upperBound="-1"
+          eType="#//element/IConnector" containment="true">
+        <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+          <details key="documentation" value="List of aggregated connectors."/>
+        </eAnnotations>
+      </eStructuralFeatures>
+    </eClassifiers>
+    <eClassifiers xsi:type="ecore:EClass" name="IHierarchicElementContainer" abstract="true"
+        interface="true">
+      <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+        <details key="documentation" value="Super class of containers of hierarchic model elements."/>
+      </eAnnotations>
+      <eStructuralFeatures xsi:type="ecore:EReference" name="containedElements" upperBound="-1"
+          eType="#//element/IHierarchicElement" containment="true">
+        <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+          <details key="documentation" value="The contained hierarchic model elements."/>
+        </eAnnotations>
+      </eStructuralFeatures>
+    </eClassifiers>
+    <eClassifiers xsi:type="ecore:EClass" name="IConnector" abstract="true" interface="true"
+        eSuperTypes="#//element/IModelElement">
+      <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+        <details key="documentation" value="Super class of connectors. Connectors reference incoming and outgoing connection model elements."/>
+      </eAnnotations>
+      <eStructuralFeatures xsi:type="ecore:EReference" name="incoming" upperBound="-1"
+          eType="#//element/IConnection" eOpposite="#//element/IConnection/target">
+        <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+          <details key="documentation" value="The incoming connections."/>
+        </eAnnotations>
+      </eStructuralFeatures>
+      <eStructuralFeatures xsi:type="ecore:EReference" name="outgoing" upperBound="-1"
+          eType="#//element/IConnection" eOpposite="#//element/IConnection/source">
+        <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+          <details key="documentation" value="The outgoing connections."/>
+        </eAnnotations>
+      </eStructuralFeatures>
+    </eClassifiers>
+    <eClassifiers xsi:type="ecore:EClass" name="IConnection" abstract="true" interface="true"
+        eSuperTypes="#//element/IModelElement">
+      <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+        <details key="documentation" value="Super class of connections. Connections are aggregated in a hierarchic model element and reference two connectors from that element or any direct sub-elenent."/>
+      </eAnnotations>
+      <eStructuralFeatures xsi:type="ecore:EReference" name="source" eType="#//element/IConnector"
+          eOpposite="#//element/IConnector/outgoing">
+        <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+          <details key="documentation" value="The connection's source connector."/>
+        </eAnnotations>
+      </eStructuralFeatures>
+      <eStructuralFeatures xsi:type="ecore:EReference" name="target" eType="#//element/IConnector"
+          eOpposite="#//element/IConnector/incoming">
+        <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+          <details key="documentation" value="The connection's target connector."/>
+        </eAnnotations>
+      </eStructuralFeatures>
+    </eClassifiers>
+    <eClassifiers xsi:type="ecore:EClass" name="IHiddenSpecification" abstract="true"
+        interface="true" eSuperTypes="#//element/IModelElementSpecification">
+      <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+        <details key="documentation" value="Super class of model element specifications, which should be excluded from the navigator view."/>
+      </eAnnotations>
+    </eClassifiers>
+    <eClassifiers xsi:type="ecore:EClass" name="IAnnotatedSpecification" eSuperTypes="#//element/IHiddenSpecification">
+      <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+        <details key="documentation" value="Super class of hidden model element specifications that represent annotations."/>
+      </eAnnotations>
+    </eClassifiers>
+  </eSubpackages>
+  <eSubpackages name="layout" nsURI="http://www.fortiss.org/tooling/base/model/layout"
+      nsPrefix="org-fortiss-tooling-base-model-layout">
+    <eClassifiers xsi:type="ecore:EClass" name="ILayoutedModelElement" abstract="true"
+        interface="true">
+      <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+        <details key="documentation" value="Super class of model elements with layout data."/>
+      </eAnnotations>
+      <eStructuralFeatures xsi:type="ecore:EReference" name="layoutData" upperBound="-1"
+          eType="#//layout/ILayoutData" containment="true">
+        <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+          <details key="documentation" value="Stores the aggregated layout data."/>
+        </eAnnotations>
+      </eStructuralFeatures>
+    </eClassifiers>
+    <eClassifiers xsi:type="ecore:EClass" name="ILayoutData" abstract="true" interface="true">
+      <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+        <details key="documentation" value="Super class of all layout data objects."/>
+      </eAnnotations>
+      <eStructuralFeatures xsi:type="ecore:EAttribute" name="key" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
+        <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+          <details key="documentation" value="The layout key indicating how the layout data is to be interpreted."/>
+        </eAnnotations>
+      </eStructuralFeatures>
+    </eClassifiers>
+    <eClassifiers xsi:type="ecore:EClass" name="Point" eSuperTypes="#//layout/ILayoutData">
+      <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+        <details key="documentation" value="Layout data for 2D locations."/>
+      </eAnnotations>
+      <eStructuralFeatures xsi:type="ecore:EAttribute" name="x" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt">
+        <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+          <details key="documentation" value="The horizontal X coordinate."/>
+        </eAnnotations>
+      </eStructuralFeatures>
+      <eStructuralFeatures xsi:type="ecore:EAttribute" name="y" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt">
+        <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+          <details key="documentation" value="The vertical Y coordinate."/>
+        </eAnnotations>
+      </eStructuralFeatures>
+    </eClassifiers>
+    <eClassifiers xsi:type="ecore:EClass" name="Dimension" eSuperTypes="#//layout/ILayoutData">
+      <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+        <details key="documentation" value="Layout data for 2D dimensions."/>
+      </eAnnotations>
+      <eStructuralFeatures xsi:type="ecore:EAttribute" name="width" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"
+          defaultValueLiteral="10">
+        <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+          <details key="documentation" value="The width."/>
+        </eAnnotations>
+      </eStructuralFeatures>
+      <eStructuralFeatures xsi:type="ecore:EAttribute" name="height" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"
+          defaultValueLiteral="10">
+        <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+          <details key="documentation" value="The height."/>
+        </eAnnotations>
+      </eStructuralFeatures>
+    </eClassifiers>
+    <eClassifiers xsi:type="ecore:EEnum" name="EOrientation">
+      <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+        <details key="documentation" value="Enumeration of 2D directions and orientations."/>
+      </eAnnotations>
+      <eLiterals name="NORTH"/>
+      <eLiterals name="EAST" value="1"/>
+      <eLiterals name="SOUTH" value="2"/>
+      <eLiterals name="WEST" value="3"/>
+    </eClassifiers>
+    <eClassifiers xsi:type="ecore:EClass" name="Orientation" eSuperTypes="#//layout/ILayoutData">
+      <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+        <details key="documentation" value="Layout data for 2D orientations."/>
+      </eAnnotations>
+      <eStructuralFeatures xsi:type="ecore:EAttribute" name="orientation" lowerBound="1"
+          eType="#//layout/EOrientation" defaultValueLiteral="NORTH">
+        <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+          <details key="documentation" value="The orientation."/>
+        </eAnnotations>
+      </eStructuralFeatures>
+    </eClassifiers>
+    <eClassifiers xsi:type="ecore:EClass" name="Points" eSuperTypes="#//layout/ILayoutData">
+      <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+        <details key="documentation" value="Layout data for a sequence of 2D locations."/>
+      </eAnnotations>
+      <eStructuralFeatures xsi:type="ecore:EReference" name="points" upperBound="-1"
+          eType="#//layout/Point" containment="true">
+        <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+          <details key="documentation" value="The aggregated locations."/>
+        </eAnnotations>
+      </eStructuralFeatures>
+    </eClassifiers>
+    <eClassifiers xsi:type="ecore:EClass" name="Angle" eSuperTypes="#//layout/ILayoutData">
+      <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+        <details key="documentation" value="Layout data for an angle (the interpretation of the double value is application dependent)."/>
+      </eAnnotations>
+      <eStructuralFeatures xsi:type="ecore:EAttribute" name="angle" lowerBound="1"
+          eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EDouble"
+          defaultValueLiteral="0">
+        <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+          <details key="documentation" value="The double value of the angle."/>
+        </eAnnotations>
+      </eStructuralFeatures>
+    </eClassifiers>
+    <eClassifiers xsi:type="ecore:EClass" name="Offset" eSuperTypes="#//layout/ILayoutData">
+      <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+        <details key="documentation" value="Layout data of a single dimensional offset."/>
+      </eAnnotations>
+      <eStructuralFeatures xsi:type="ecore:EAttribute" name="offset" lowerBound="1"
+          eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt" defaultValueLiteral="0">
+        <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+          <details key="documentation" value="The offset value."/>
+        </eAnnotations>
+      </eStructuralFeatures>
+    </eClassifiers>
+    <eClassifiers xsi:type="ecore:EClass" name="OffsetOrientation" eSuperTypes="#//layout/Offset #//layout/Orientation">
+      <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+        <details key="documentation" value="Combines an offset with an orientation."/>
+      </eAnnotations>
+    </eClassifiers>
+  </eSubpackages>
 </ecore:EPackage>
diff --git a/org.fortiss.tooling.base/trunk/plugin.xml b/org.fortiss.tooling.base/trunk/plugin.xml
index 1f620f10209ee3033c48100b3d81c48b8ad34f6b..11f62bee1c1e8e4eb8f27d4a5ffa5e06a74e6b38 100644
--- a/org.fortiss.tooling.base/trunk/plugin.xml
+++ b/org.fortiss.tooling.base/trunk/plugin.xml
@@ -12,8 +12,14 @@
 
    <extension point="org.eclipse.emf.ecore.generated_package">
       <package
-            uri="http://www.fortiss.org/tooling/base"
-            class="org.fortiss.tooling.base.model.BasePackage"
+            uri="http://www.fortiss.org/tooling/base/model/element"
+            class="org.fortiss.tooling.base.model.element.ElementPackage"
+            genModel="model/base.genmodel"/>
+   </extension>
+   <extension point="org.eclipse.emf.ecore.generated_package">
+      <package
+            uri="http://www.fortiss.org/tooling/base/model/layout"
+        	class="org.fortiss.tooling.base.model.layout.LayoutPackage"
             genModel="model/base.genmodel"/>
    </extension>
 </plugin>
diff --git a/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/compose/DropContext.java b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/compose/DropContext.java
new file mode 100644
index 0000000000000000000000000000000000000000..d7ca86a9fbd839a572f80a44baf1ca97300025e4
--- /dev/null
+++ b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/compose/DropContext.java
@@ -0,0 +1,66 @@
+/*--------------------------------------------------------------------------+
+$Id$
+|                                                                          |
+| Copyright 2011 ForTISS GmbH                                              |
+|                                                                          |
+| Licensed under the Apache License, Version 2.0 (the "License");          |
+| you may not use this file except in compliance with the License.         |
+| You may obtain a copy of the License at                                  |
+|                                                                          |
+|    http://www.apache.org/licenses/LICENSE-2.0                            |
+|                                                                          |
+| Unless required by applicable law or agreed to in writing, software      |
+| distributed under the License is distributed on an "AS IS" BASIS,        |
+| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
+| See the License for the specific language governing permissions and      |
+| limitations under the License.                                           |
++--------------------------------------------------------------------------*/
+package org.fortiss.tooling.base.compose;
+
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.gef.EditPart;
+import org.fortiss.tooling.base.editpart.RootEditPartBase;
+import org.fortiss.tooling.kernel.interfaces.ICompositionContext;
+
+/**
+ * Composition context for GEF edit parts initiated by a drop gesture. The
+ * context content is defined by the editpart that was the drop target and the
+ * mouse position.
+ * <P>
+ * The editpart can also be a root edit part, e.g. the background of some
+ * editor.
+ * 
+ * @author hoelzl
+ * @author $Author$
+ * @version $Rev$
+ * @ConQAT.Rating YELLOW Hash: F41CA022ECFE85D93C254EFB2BE6D7BE
+ */
+public class DropContext implements ICompositionContext {
+
+	/** Drop target edit part */
+	private final EditPart dropTarget;
+
+	/** Position. */
+	private final Point position;
+
+	/** Constructor. */
+	public DropContext(EditPart dropTarget, Point position) {
+		this.dropTarget = dropTarget;
+		this.position = position;
+	}
+
+	/** Returns the position. */
+	public Point getPosition() {
+		return position;
+	}
+
+	/** Returns the drop target edit part. */
+	public EditPart getDropTarget() {
+		return dropTarget;
+	}
+
+	/** Returns whether drop target is root edit part (base). */
+	public boolean isRoot() {
+		return dropTarget instanceof RootEditPartBase;
+	}
+}
diff --git a/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/editor/TreeViewerEditorBase.java b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/editor/TreeViewerEditorBase.java
index 5fdfe6ade5c4d348caa03e1d5ecb45ca6e6c717a..2f791297ac1f2b5c5301b486fb67585370cdeee8 100644
--- a/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/editor/TreeViewerEditorBase.java
+++ b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/editor/TreeViewerEditorBase.java
@@ -50,7 +50,7 @@ import org.fortiss.tooling.kernel.util.EObjectSelectionUtils;
  * @author hoelzl
  * @author $Author$
  * @version $Rev$
- * @ConQAT.Rating RED Hash: 307872B23BCAC5771FDAD66F17973611
+ * @ConQAT.Rating YELLOW Hash: 570713B6F67C37F5BD0948CEBAC276D4
  */
 public abstract class TreeViewerEditorBase<T extends EObject> extends
 		EditorBase<T> {
@@ -177,7 +177,6 @@ public abstract class TreeViewerEditorBase<T extends EObject> extends
 				return ICompositorService.INSTANCE.canCompose(
 						(EObject) lastTarget, dropped, null);
 			}
-
 			return false;
 		}
 
diff --git a/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/editpart/ConnectorEditPartBase.java b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/editpart/ConnectorEditPartBase.java
new file mode 100644
index 0000000000000000000000000000000000000000..faaf9539452757b73983fcd1e9f32df2f9044d1e
--- /dev/null
+++ b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/editpart/ConnectorEditPartBase.java
@@ -0,0 +1,39 @@
+/*--------------------------------------------------------------------------+
+$Id$
+|                                                                          |
+| Copyright 2011 ForTISS GmbH                                              |
+|                                                                          |
+| Licensed under the Apache License, Version 2.0 (the "License");          |
+| you may not use this file except in compliance with the License.         |
+| You may obtain a copy of the License at                                  |
+|                                                                          |
+|    http://www.apache.org/licenses/LICENSE-2.0                            |
+|                                                                          |
+| Unless required by applicable law or agreed to in writing, software      |
+| distributed under the License is distributed on an "AS IS" BASIS,        |
+| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
+| See the License for the specific language governing permissions and      |
+| limitations under the License.                                           |
++--------------------------------------------------------------------------*/
+package org.fortiss.tooling.base.editpart;
+
+import org.fortiss.tooling.base.model.element.IConnector;
+import org.fortiss.tooling.base.model.layout.ILayoutedModelElement;
+
+/**
+ * Base class for connector edit parts.
+ * 
+ * @author hummel
+ * @author hoelzl
+ * @author $Author$
+ * @version $Rev$
+ * @ConQAT.Rating YELLOW Hash: 33691B003B390F6576C82DFB32395F1C
+ */
+public abstract class ConnectorEditPartBase<T extends ILayoutedModelElement & IConnector>
+		extends PositionedEditPartBase<T> {
+
+	/** Constructor. */
+	protected ConnectorEditPartBase(T modelElement) {
+		super(modelElement);
+	}
+}
diff --git a/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/editpart/GraphicalConnectionEditPartBase.java b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/editpart/GraphicalConnectionEditPartBase.java
new file mode 100644
index 0000000000000000000000000000000000000000..01aa54966e33e5384f86ffbb48019dbc3300dec2
--- /dev/null
+++ b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/editpart/GraphicalConnectionEditPartBase.java
@@ -0,0 +1,88 @@
+/*--------------------------------------------------------------------------+
+$Id$
+|                                                                          |
+| Copyright 2011 ForTISS GmbH                                              |
+|                                                                          |
+| Licensed under the Apache License, Version 2.0 (the "License");          |
+| you may not use this file except in compliance with the License.         |
+| You may obtain a copy of the License at                                  |
+|                                                                          |
+|    http://www.apache.org/licenses/LICENSE-2.0                            |
+|                                                                          |
+| Unless required by applicable law or agreed to in writing, software      |
+| distributed under the License is distributed on an "AS IS" BASIS,        |
+| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
+| See the License for the specific language governing permissions and      |
+| limitations under the License.                                           |
++--------------------------------------------------------------------------*/
+package org.fortiss.tooling.base.editpart;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.gef.editparts.AbstractConnectionEditPart;
+import org.fortiss.tooling.base.model.element.IConnection;
+import org.fortiss.tooling.base.model.layout.ILayoutedModelElement;
+import org.fortiss.tooling.kernel.interfaces.IModelElementHandler;
+import org.fortiss.tooling.kernel.services.IModelElementService;
+
+/**
+ * Base class for graphical connection edit parts.
+ * 
+ * @author hoelzl
+ * @author $Author$
+ * @version $Rev$
+ * @ConQAT.Rating YELLOW Hash: CEB37EC45D3FB317BEF8282765C22C0A
+ */
+public abstract class GraphicalConnectionEditPartBase<T extends ILayoutedModelElement & IConnection>
+		extends AbstractConnectionEditPart {
+
+	/** The underlying model object. */
+	protected final T modelElement;
+
+	/** The model element handler to be used for the {@link #modelElement}. */
+	protected final IModelElementHandler<T> modelElementHandler;
+
+	/**
+	 * The adapter used to receive change notifications for the
+	 * {@link #modelElement}.
+	 */
+	protected final Adapter fullRefreshAdapter = new AdapterImpl() {
+
+		/** {@inheritDoc} */
+		@Override
+		public void notifyChanged(Notification notification) {
+			// do not care what happens, just refresh everything
+			refresh();
+		}
+	};
+
+	/** Constructor. */
+	@SuppressWarnings("unchecked")
+	protected GraphicalConnectionEditPartBase(T modelElement) {
+		this.modelElement = modelElement;
+		setModel(modelElement);
+		this.modelElementHandler = (IModelElementHandler<T>) IModelElementService.INSTANCE
+				.getModelElementHandler(modelElement);
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	protected void createEditPolicies() {
+		// no edit policies installed by default
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public void activate() {
+		super.activate();
+		modelElement.eAdapters().add(fullRefreshAdapter);
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public void deactivate() {
+		modelElement.eAdapters().remove(fullRefreshAdapter);
+		super.deactivate();
+	}
+}
diff --git a/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/editpart/GraphicalEditPartBase.java b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/editpart/GraphicalEditPartBase.java
new file mode 100644
index 0000000000000000000000000000000000000000..c7457e8855a35c31bc6f2c78c6192de623227403
--- /dev/null
+++ b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/editpart/GraphicalEditPartBase.java
@@ -0,0 +1,89 @@
+/*--------------------------------------------------------------------------+
+$Id$
+|                                                                          |
+| Copyright 2011 ForTISS GmbH                                              |
+|                                                                          |
+| Licensed under the Apache License, Version 2.0 (the "License");          |
+| you may not use this file except in compliance with the License.         |
+| You may obtain a copy of the License at                                  |
+|                                                                          |
+|    http://www.apache.org/licenses/LICENSE-2.0                            |
+|                                                                          |
+| Unless required by applicable law or agreed to in writing, software      |
+| distributed under the License is distributed on an "AS IS" BASIS,        |
+| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
+| See the License for the specific language governing permissions and      |
+| limitations under the License.                                           |
++--------------------------------------------------------------------------*/
+package org.fortiss.tooling.base.editpart;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
+import org.fortiss.tooling.kernel.interfaces.IModelElementHandler;
+import org.fortiss.tooling.kernel.services.IModelElementService;
+
+/**
+ * The base class for all graphical edit parts.
+ * 
+ * @param <T>
+ *            the type of the model element wrapped.
+ * 
+ * @author hoelzl
+ * @author $Author$
+ * @version $Rev$
+ * @ConQAT.Rating YELLOW Hash: 8835616CDDA5F811EE493732151D585F
+ */
+public abstract class GraphicalEditPartBase<T extends EObject> extends
+		AbstractGraphicalEditPart {
+
+	/**
+	 * The adapter used to receive change notifications for the
+	 * {@link #modelElement}.
+	 */
+	protected final Adapter fullRefreshAdapter = new AdapterImpl() {
+
+		/** {@inheritDoc} */
+		@Override
+		public void notifyChanged(Notification notification) {
+			// do not care what happens, just refresh everything
+			refresh();
+		}
+	};
+
+	/** The underlying model object. */
+	protected final T modelElement;
+
+	/** The model element handler to be used for the {@link #modelElement}. */
+	protected final IModelElementHandler<T> modelElementHandler;
+
+	/** Constructor. */
+	@SuppressWarnings("unchecked")
+	protected GraphicalEditPartBase(T modelElement) {
+		this.modelElement = modelElement;
+		setModel(modelElement);
+
+		this.modelElementHandler = (IModelElementHandler<T>) IModelElementService.INSTANCE
+				.getModelElementHandler(modelElement);
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	protected abstract void createEditPolicies();
+
+	/** {@inheritDoc} */
+	@Override
+	public void activate() {
+		super.activate();
+		modelElement.eAdapters().add(fullRefreshAdapter);
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public void deactivate() {
+		modelElement.eAdapters().remove(fullRefreshAdapter);
+		super.deactivate();
+	}
+}
diff --git a/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/editpart/LayoutedConnectionEditPartBase.java b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/editpart/LayoutedConnectionEditPartBase.java
new file mode 100644
index 0000000000000000000000000000000000000000..be687ead4f4affe8329dd3223a487c35ae1d76e8
--- /dev/null
+++ b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/editpart/LayoutedConnectionEditPartBase.java
@@ -0,0 +1,80 @@
+/*--------------------------------------------------------------------------+
+$Id$
+|                                                                          |
+| Copyright 2011 ForTISS GmbH                                              |
+|                                                                          |
+| Licensed under the Apache License, Version 2.0 (the "License");          |
+| you may not use this file except in compliance with the License.         |
+| You may obtain a copy of the License at                                  |
+|                                                                          |
+|    http://www.apache.org/licenses/LICENSE-2.0                            |
+|                                                                          |
+| Unless required by applicable law or agreed to in writing, software      |
+| distributed under the License is distributed on an "AS IS" BASIS,        |
+| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
+| See the License for the specific language governing permissions and      |
+| limitations under the License.                                           |
++--------------------------------------------------------------------------*/
+package org.fortiss.tooling.base.editpart;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.util.EContentAdapter;
+import org.fortiss.tooling.base.model.element.IConnection;
+import org.fortiss.tooling.base.model.layout.ILayoutedModelElement;
+import org.fortiss.tooling.base.model.layout.LayoutPackage;
+
+/**
+ * The base class for all layouted connection edit parts. This makes sure the
+ * edit part is updated if the layout data changes in some way.
+ * 
+ * @param <T>
+ *            the type of the model element wrapped.
+ * 
+ * @author hoelzl
+ * @author $Author$
+ * @version $Rev$
+ * @ConQAT.Rating YELLOW Hash: 4528B935FD404A834CBD215E46A1BFC1
+ */
+public abstract class LayoutedConnectionEditPartBase<T extends ILayoutedModelElement & IConnection>
+		extends GraphicalConnectionEditPartBase<T> {
+
+	// TODO (FH): check for collision with full refresh adapter of super class !
+
+	/** The adapter used for dealing with changes of the */
+	protected final Adapter layoutChanged = new EContentAdapter() {
+
+		@Override
+		public void notifyChanged(Notification notification) {
+
+			// skip everything that is not layout related
+			if (notification.getNotifier() == modelElement) {
+				if (notification.getFeature() != LayoutPackage.Literals.ILAYOUTED_MODEL_ELEMENT__LAYOUT_DATA) {
+					return;
+				}
+			}
+
+			super.notifyChanged(notification);
+			refresh();
+		}
+	};
+
+	/** Constructor. */
+	protected LayoutedConnectionEditPartBase(T modelElement) {
+		super(modelElement);
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public void activate() {
+		super.activate();
+		modelElement.eAdapters().add(layoutChanged);
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public void deactivate() {
+		modelElement.eAdapters().remove(layoutChanged);
+		super.deactivate();
+	}
+}
diff --git a/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/editpart/LayoutedEditPartBase.java b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/editpart/LayoutedEditPartBase.java
new file mode 100644
index 0000000000000000000000000000000000000000..a19312ab97b1ac66aaa9a48dcdf47120434172d2
--- /dev/null
+++ b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/editpart/LayoutedEditPartBase.java
@@ -0,0 +1,79 @@
+/*--------------------------------------------------------------------------+
+$Id$
+|                                                                          |
+| Copyright 2011 ForTISS GmbH                                              |
+|                                                                          |
+| Licensed under the Apache License, Version 2.0 (the "License");          |
+| you may not use this file except in compliance with the License.         |
+| You may obtain a copy of the License at                                  |
+|                                                                          |
+|    http://www.apache.org/licenses/LICENSE-2.0                            |
+|                                                                          |
+| Unless required by applicable law or agreed to in writing, software      |
+| distributed under the License is distributed on an "AS IS" BASIS,        |
+| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
+| See the License for the specific language governing permissions and      |
+| limitations under the License.                                           |
++--------------------------------------------------------------------------*/
+package org.fortiss.tooling.base.editpart;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EContentAdapter;
+import org.fortiss.tooling.base.model.layout.ILayoutedModelElement;
+import org.fortiss.tooling.base.model.layout.LayoutPackage;
+
+/**
+ * The base class for all layouted edit parts. This makes sure the edit part is
+ * updated if the layout data changes in some way.
+ * 
+ * @param <T>
+ *            the type of the model element wrapped.
+ * 
+ * @author hoelzl
+ * @author $Author$
+ * @version $Rev$
+ * @ConQAT.Rating YELLOW Hash: 3B3F681234663486E6A14C541251F972
+ */
+public abstract class LayoutedEditPartBase<T extends ILayoutedModelElement>
+		extends GraphicalEditPartBase<T> {
+
+	/** The adapter used for dealing with changes of the */
+	protected final Adapter layoutChanged = new EContentAdapter() {
+
+		@Override
+		public void notifyChanged(Notification notification) {
+			// skip everything that is not layout related
+			if (notification.getNotifier() == modelElement
+					&& notification.getFeature() != LayoutPackage.Literals.ILAYOUTED_MODEL_ELEMENT__LAYOUT_DATA) {
+				return;
+			}
+			super.notifyChanged(notification);
+			if (!(notification.getNotifier() instanceof EObject)
+					|| notification.getFeature() == null) {
+				return;
+			}
+			refresh();
+		}
+	};
+
+	/** Constructor. */
+	protected LayoutedEditPartBase(T modelElement) {
+		super(modelElement);
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public void activate() {
+		super.activate();
+		modelElement.eAdapters().add(layoutChanged);
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public void deactivate() {
+		modelElement.eAdapters().remove(layoutChanged);
+		super.deactivate();
+	}
+}
diff --git a/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/editpart/NodeEditPartBase.java b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/editpart/NodeEditPartBase.java
new file mode 100644
index 0000000000000000000000000000000000000000..f167e549c7d8f0c32c2e310090d282b855e8cae9
--- /dev/null
+++ b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/editpart/NodeEditPartBase.java
@@ -0,0 +1,192 @@
+/*--------------------------------------------------------------------------+
+$Id$
+|                                                                          |
+| Copyright 2011 ForTISS GmbH                                              |
+|                                                                          |
+| Licensed under the Apache License, Version 2.0 (the "License");          |
+| you may not use this file except in compliance with the License.         |
+| You may obtain a copy of the License at                                  |
+|                                                                          |
+|    http://www.apache.org/licenses/LICENSE-2.0                            |
+|                                                                          |
+| Unless required by applicable law or agreed to in writing, software      |
+| distributed under the License is distributed on an "AS IS" BASIS,        |
+| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
+| See the License for the specific language governing permissions and      |
+| limitations under the License.                                           |
++--------------------------------------------------------------------------*/
+package org.fortiss.tooling.base.editpart;
+
+import java.util.List;
+
+import org.conqat.lib.commons.string.StringUtils;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.XYLayout;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.RequestConstants;
+import org.eclipse.swt.graphics.Color;
+import org.fortiss.tooling.base.layout.constants.RecommendedLayoutConstants;
+import org.fortiss.tooling.base.layout.util.LayoutDataUtils;
+import org.fortiss.tooling.base.model.layout.ILayoutedModelElement;
+import org.fortiss.tooling.kernel.model.INamedCommentedElement;
+import org.fortiss.tooling.kernel.services.IModelElementService;
+
+/**
+ * The base class for graphical edit parts which encapsulate nodes (i.e. the
+ * main modeling elements). All of them have a name label and an activation
+ * mode.
+ * 
+ * @param <T>
+ *            the type of the model element wrapped.
+ * 
+ * @author hoelzl
+ * @author $Author$
+ * @version $Rev$
+ * @ConQAT.Rating RED Hash: D6B33EFB704B0CA151E1C945B5BC48C6
+ */
+public abstract class NodeEditPartBase<T extends ILayoutedModelElement & INamedCommentedElement>
+		extends PositionedEditPartBase<T> {
+
+	/** The label used for the name. */
+	protected final Label nameLabel = new Label();
+
+	/** Whether this is active. Also see {@link #setActive(boolean)}. */
+	protected boolean active = false;
+
+	/** Constructor. */
+	protected NodeEditPartBase(T modelObject) {
+		super(modelObject);
+
+		nameLabel.setForegroundColor(getForegroundColor());
+		nameLabel.setFont(RecommendedLayoutConstants.TITLE_FONT);
+		nameLabel.setTextAlignment(PositionConstants.LEFT
+				| PositionConstants.TOP);
+		nameLabel.setTextPlacement(PositionConstants.EAST);
+		nameLabel.setIcon(IModelElementService.INSTANCE.getModelElementHandler(
+				modelElement).getIcon());
+	}
+
+	/**
+	 * {@inheritDoc}
+	 */
+	@Override
+	protected final IFigure createFigure() {
+		final IFigure figure = createBaseFigure();
+		figure.setBackgroundColor(getBackgroundColor());
+
+		figure.setLayoutManager(new XYLayout());
+		figure.add(nameLabel);
+		// TODO (FH): implement marker support
+		// figure.add(markerFigure);
+
+		return figure;
+	}
+
+	/** Creates the outer base figure. */
+	protected abstract IFigure createBaseFigure();
+
+	/**
+	 * Returns the foreground color used.
+	 */
+	protected abstract Color getForegroundColor();
+
+	/**
+	 * Returns the background color used.
+	 */
+	protected abstract Color getBackgroundColor();
+
+	/**
+	 * Returns the background color for active nodes.
+	 */
+	protected Color getActiveColor() {
+		return getBackgroundColor();
+	}
+
+	/**
+	 * {@inheritDoc}
+	 * <p>
+	 * Returns the connectors as children.
+	 */
+	@Override
+	protected List<?> getModelChildren() {
+		return modelElementHandler.getConnectors(modelElement);
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	protected Rectangle determinePosition() {
+		return LayoutDataUtils.getNodeBounds(modelElement);
+	}
+
+	/**
+	 * {@inheritDoc}
+	 * <p>
+	 * Implements the component role for deletion.
+	 */
+	@Override
+	protected void createEditPolicies() {
+		// TODO (FH): add remove policy
+		// installEditPolicy(EditPolicy.COMPONENT_ROLE, new RemoveEditPolicy());
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public void performRequest(Request req) {
+		if (req.getType() == RequestConstants.REQ_OPEN) {
+
+			// TODO (FH): add double-click open editor support
+			// ModelContext context = ModelContextManager.getInstance()
+			// .getContext(modelElement);
+			// CCTSEditorInput editorInput = new CCTSEditorInput(modelElement,
+			// context);
+			// try {
+			// PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+			// .getActivePage()
+			// .openEditor(editorInput, CCTSBindingEditor.ID);
+			// } catch (PartInitException e) {
+			// LoggingUtils
+			// .error(CCTSModelBaseActivator.getDefault(),
+			// "Could not open editor with ID "
+			// + CCTSBindingEditor.ID, e);
+			// }
+		}
+		super.performRequest(req);
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	protected void refreshVisuals() {
+		super.refreshVisuals();
+
+		nameLabel.setText(modelElement.getName());
+
+		IFigure figure = getFigure();
+
+		String tooltipText = StringUtils.wrapLongLines(modelElement.getName()
+				+ ": " + modelElement.getComment(), 100);
+		figure.setToolTip(new Label(tooltipText));
+
+		figure.setBackgroundColor(active ? getActiveColor()
+				: getBackgroundColor());
+
+		Rectangle rect = LayoutDataUtils.getNodeBounds(modelElement);
+		int inset = 2 * RecommendedLayoutConstants.RECTANGULAR_SHAPE_INSETS;
+		rect = new Rectangle(inset, inset, rect.width - 2 * inset, rect.height
+				- 2 * inset);
+		figure.setConstraint(nameLabel, rect);
+	}
+
+	/**
+	 * This method can be used to mark this editpart as active, which can be
+	 * used e.g. for displaying the active state in the simulation.
+	 */
+	public void setActive(boolean active) {
+		if (this.active != active) {
+			this.active = active;
+			refreshVisuals();
+		}
+	}
+}
diff --git a/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/editpart/PositionedEditPartBase.java b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/editpart/PositionedEditPartBase.java
new file mode 100644
index 0000000000000000000000000000000000000000..c222bc06a544b4a9b3d195fb850a17cb2dceed12
--- /dev/null
+++ b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/editpart/PositionedEditPartBase.java
@@ -0,0 +1,161 @@
+/*--------------------------------------------------------------------------+
+$Id$
+|                                                                          |
+| Copyright 2011 ForTISS GmbH                                              |
+|                                                                          |
+| Licensed under the Apache License, Version 2.0 (the "License");          |
+| you may not use this file except in compliance with the License.         |
+| You may obtain a copy of the License at                                  |
+|                                                                          |
+|    http://www.apache.org/licenses/LICENSE-2.0                            |
+|                                                                          |
+| Unless required by applicable law or agreed to in writing, software      |
+| distributed under the License is distributed on an "AS IS" BASIS,        |
+| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
+| See the License for the specific language governing permissions and      |
+| limitations under the License.                                           |
++--------------------------------------------------------------------------*/
+package org.fortiss.tooling.base.editpart;
+
+import org.eclipse.draw2d.ConnectionAnchor;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.ConnectionEditPart;
+import org.eclipse.gef.DragTracker;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.NodeEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.SelectionRequest;
+import org.eclipse.gef.tools.ConnectionDragCreationTool;
+import org.eclipse.gef.tools.DragEditPartsTracker;
+import org.fortiss.tooling.base.model.layout.ILayoutedModelElement;
+
+/**
+ * The base class for all edit parts which are positioned using x/y coordinates.
+ * Additionally this class introduces the marker figure.
+ * 
+ * @param <T>
+ *            the type of the model element wrapped.
+ * 
+ * @author hoelzl
+ * @author $Author$
+ * @version $Rev$
+ * @ConQAT.Rating RED Hash: D6B33EFB704B0CA151E1C945B5BC48C6
+ */
+public abstract class PositionedEditPartBase<T extends ILayoutedModelElement>
+		extends LayoutedEditPartBase<T> implements NodeEditPart {
+
+	/**
+	 * Figure used for displaying markers. This figure has to be added in the
+	 * subclasses.
+	 */
+	// TODO (FH): implement marker support
+	// protected final MarkerFigure markerFigure = new MarkerFigure();
+
+	/** Constructor. */
+	protected PositionedEditPartBase(T modelElement) {
+		super(modelElement);
+		// markerFigure.setTextAlignment(PositionConstants.LEFT
+		// | PositionConstants.TOP);
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public void refresh() {
+
+		// we have to make sure, that we are registered as constraint with our
+		// parent (if we have one)
+		if (getParent() instanceof GraphicalEditPart) {
+			((GraphicalEditPart) getParent()).getFigure().setConstraint(
+					getFigure(), determinePosition());
+		}
+
+		super.refresh();
+
+		// markerFigure.setMarkers(CCTSMarkerManager.getInstance().getMarkersFor(
+		// modelElement));
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	protected void refreshVisuals() {
+		super.refreshVisuals();
+
+		// IFigure figure = getFigure();
+		// if (markerFigure.getParent() == figure) {
+		// Rectangle rect = LayoutUtils.getNodeBounds(modelElement);
+		// figure.setConstraint(markerFigure, new Rectangle(rect.width - 18,
+		// rect.height - 18, 16, 16));
+		// }
+	}
+
+	/**
+	 * Returns the position and size this edit part's main figure should have in
+	 * the layout.
+	 */
+	protected abstract Rectangle determinePosition();
+
+	/**
+	 * Returns the default connection anchor for this port (does not depend on
+	 * type of connection).
+	 */
+	protected abstract ConnectionAnchor defaultConnectionAnchor();
+
+	/**
+	 * {@inheritDoc}
+	 * <p>
+	 * Returns the {@link #defaultConnectionAnchor()}.
+	 */
+	@Override
+	public final ConnectionAnchor getSourceConnectionAnchor(
+			ConnectionEditPart connection) {
+		return defaultConnectionAnchor();
+	}
+
+	/**
+	 * {@inheritDoc}
+	 * <p>
+	 * Returns the {@link #defaultConnectionAnchor()}.
+	 */
+	@Override
+	public final ConnectionAnchor getSourceConnectionAnchor(Request request) {
+		return defaultConnectionAnchor();
+	}
+
+	/**
+	 * {@inheritDoc}
+	 * <p>
+	 * Returns the {@link #defaultConnectionAnchor()}.
+	 */
+	@Override
+	public final ConnectionAnchor getTargetConnectionAnchor(
+			ConnectionEditPart connection) {
+		return defaultConnectionAnchor();
+	}
+
+	/**
+	 * {@inheritDoc}
+	 * <p>
+	 * Returns the {@link #defaultConnectionAnchor()}.
+	 */
+	@Override
+	public final ConnectionAnchor getTargetConnectionAnchor(Request request) {
+		return defaultConnectionAnchor();
+	}
+
+	/**
+	 * {@inheritDoc}
+	 */
+	@Override
+	public DragTracker getDragTracker(Request request) {
+		if (request instanceof SelectionRequest) {
+			SelectionRequest sr = (SelectionRequest) request;
+			if (sr.getLastButtonPressed() == 1
+					&& (sr.isAltKeyPressed() || sr.isControlKeyPressed())) {
+				return new ConnectionDragCreationTool();
+			} else if (sr.getLastButtonPressed() == 1) {
+				return new DragEditPartsTracker(this);
+			}
+		}
+		return null;
+	}
+}
\ No newline at end of file
diff --git a/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/editpart/RootEditPartBase.java b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/editpart/RootEditPartBase.java
new file mode 100644
index 0000000000000000000000000000000000000000..bb5d3fe0897f01151fb9a8cf534b34e792f70428
--- /dev/null
+++ b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/editpart/RootEditPartBase.java
@@ -0,0 +1,89 @@
+/*--------------------------------------------------------------------------+
+$Id$
+|                                                                          |
+| Copyright 2011 ForTISS GmbH                                              |
+|                                                                          |
+| Licensed under the Apache License, Version 2.0 (the "License");          |
+| you may not use this file except in compliance with the License.         |
+| You may obtain a copy of the License at                                  |
+|                                                                          |
+|    http://www.apache.org/licenses/LICENSE-2.0                            |
+|                                                                          |
+| Unless required by applicable law or agreed to in writing, software      |
+| distributed under the License is distributed on an "AS IS" BASIS,        |
+| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
+| See the License for the specific language governing permissions and      |
+| limitations under the License.                                           |
++--------------------------------------------------------------------------*/
+package org.fortiss.tooling.base.editpart;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.draw2d.BendpointConnectionRouter;
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.ConnectionLayer;
+import org.eclipse.draw2d.ConnectionRouter;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.FreeformLayer;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.XYLayout;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.LayerConstants;
+import org.eclipse.swt.SWT;
+
+/**
+ * The base class for roots of the editpart hierarchy.
+ * 
+ * @param <T>
+ *            the type of the model element wrapped.
+ * 
+ * @author hoelzl
+ * @author $Author$
+ * @version $Rev$
+ * @ConQAT.Rating YELLOW Hash: 76BF89DC0EFA9511DDF95CA4EC32C074
+ */
+public abstract class RootEditPartBase<T extends EObject> extends
+		GraphicalEditPartBase<T> {
+
+	/** Stores the connection router. */
+	private final ConnectionRouter connectionRouter;
+
+	/** Constructor. */
+	protected RootEditPartBase(T modelElement, ConnectionRouter connectionRouter) {
+		super(modelElement);
+		this.connectionRouter = connectionRouter;
+	}
+
+	/** Constructor. */
+	protected RootEditPartBase(T modelElement) {
+		this(modelElement, new BendpointConnectionRouter());
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	protected IFigure createFigure() {
+		Figure f = new FreeformLayer();
+
+		f.setBackgroundColor(ColorConstants.white);
+		f.setOpaque(false);
+		f.setLayoutManager(new XYLayout());
+
+		ConnectionLayer cLayer = (ConnectionLayer) getLayer(LayerConstants.CONNECTION_LAYER);
+		if (cLayer != null) {
+			cLayer.setAntialias(SWT.ON);
+			cLayer.setConnectionRouter(connectionRouter);
+		}
+
+		return f;
+	}
+
+	/** Adds all nodes and connectors as children. */
+	@Override
+	protected List<Object> getModelChildren() {
+		List<Object> result = new ArrayList<Object>();
+		result.addAll(modelElementHandler.getSubnodes(modelElement));
+		result.addAll(modelElementHandler.getConnectors(modelElement));
+		return result;
+	}
+}
diff --git a/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/editpart/anchor/InsetChopBoxConnectionAnchor.java b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/editpart/anchor/InsetChopBoxConnectionAnchor.java
new file mode 100644
index 0000000000000000000000000000000000000000..124a532e1376b1fc4e048043ccbd23ce828c1b78
--- /dev/null
+++ b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/editpart/anchor/InsetChopBoxConnectionAnchor.java
@@ -0,0 +1,50 @@
+/*--------------------------------------------------------------------------+
+$Id$
+|                                                                          |
+| Copyright 2011 ForTISS GmbH                                              |
+|                                                                          |
+| Licensed under the Apache License, Version 2.0 (the "License");          |
+| you may not use this file except in compliance with the License.         |
+| You may obtain a copy of the License at                                  |
+|                                                                          |
+|    http://www.apache.org/licenses/LICENSE-2.0                            |
+|                                                                          |
+| Unless required by applicable law or agreed to in writing, software      |
+| distributed under the License is distributed on an "AS IS" BASIS,        |
+| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
+| See the License for the specific language governing permissions and      |
+| limitations under the License.                                           |
++--------------------------------------------------------------------------*/
+package org.fortiss.tooling.base.editpart.anchor;
+
+import org.eclipse.draw2d.ChopboxAnchor;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Point;
+
+/**
+ * An extension to {@link ChopboxAnchor} using insets of half bounding box.
+ * 
+ * @author doebber
+ * @author hoelzl
+ * @author $Author$
+ * @version $Rev$
+ * @ConQAT.Rating YELLOW Hash: E1FF5315EEFE58AA002CC01E97F619C6
+ */
+public class InsetChopBoxConnectionAnchor extends ChopboxAnchor {
+
+	/** Constructor */
+	public InsetChopBoxConnectionAnchor(IFigure owner) {
+		super(owner);
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public Point getLocation(Point reference) {
+		Point edge = super.getLocation(reference);
+		Point ref = getReferencePoint();
+		Point anchor = new Point();
+		anchor.x = ref.x + (edge.x - ref.x) / 2;
+		anchor.y = ref.y + (edge.y - ref.y) / 2;
+		return anchor;
+	}
+}
diff --git a/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/layout/IPointLayouter.java b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/layout/IPointLayouter.java
new file mode 100644
index 0000000000000000000000000000000000000000..96ee10e5997baa572fd77045857fd25a3781bb55
--- /dev/null
+++ b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/layout/IPointLayouter.java
@@ -0,0 +1,42 @@
+/*--------------------------------------------------------------------------+
+$Id$
+|                                                                          |
+| Copyright 2011 ForTISS GmbH                                              |
+|                                                                          |
+| Licensed under the Apache License, Version 2.0 (the "License");          |
+| you may not use this file except in compliance with the License.         |
+| You may obtain a copy of the License at                                  |
+|                                                                          |
+|    http://www.apache.org/licenses/LICENSE-2.0                            |
+|                                                                          |
+| Unless required by applicable law or agreed to in writing, software      |
+| distributed under the License is distributed on an "AS IS" BASIS,        |
+| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
+| See the License for the specific language governing permissions and      |
+| limitations under the License.                                           |
++--------------------------------------------------------------------------*/
+package org.fortiss.tooling.base.layout;
+
+import org.fortiss.tooling.base.model.layout.Point;
+
+/**
+ * An ILayouter handles specialized layouts of points like snap to grid or move
+ * to border.
+ * 
+ * @author hoelzl
+ * @author $Author$
+ * @version $Rev$
+ * @ConQAT.Rating RED Hash: D6B33EFB704B0CA151E1C945B5BC48C6
+ */
+// TODO (FH): do we need this?
+public interface IPointLayouter {
+
+	/** Performs the layout task on the given {@link Point}. */
+	public void doLayout(Point point);
+
+	/**
+	 * Performs the layout task on the given
+	 * {@link org.eclipse.draw2d.geometry.Point}.
+	 */
+	public void doLayout(org.eclipse.draw2d.geometry.Point point);
+}
diff --git a/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/layout/constants/LayoutKeyConstants.java b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/layout/constants/LayoutKeyConstants.java
new file mode 100644
index 0000000000000000000000000000000000000000..ddc147ef7c3bb51c7883dab80c31b68bf643cb15
--- /dev/null
+++ b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/layout/constants/LayoutKeyConstants.java
@@ -0,0 +1,60 @@
+/*--------------------------------------------------------------------------+
+$Id$
+|                                                                          |
+| Copyright 2011 ForTISS GmbH                                              |
+|                                                                          |
+| Licensed under the Apache License, Version 2.0 (the "License");          |
+| you may not use this file except in compliance with the License.         |
+| You may obtain a copy of the License at                                  |
+|                                                                          |
+|    http://www.apache.org/licenses/LICENSE-2.0                            |
+|                                                                          |
+| Unless required by applicable law or agreed to in writing, software      |
+| distributed under the License is distributed on an "AS IS" BASIS,        |
+| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
+| See the License for the specific language governing permissions and      |
+| limitations under the License.                                           |
++--------------------------------------------------------------------------*/
+package org.fortiss.tooling.base.layout.constants;
+
+/**
+ * Layout constants defining keys for the commonly used layout objects, like
+ * {@link LayoutKeyConstants#NODE_DIMENSION} and
+ * {@link LayoutKeyConstants#NODE_POSITION} for nodes,
+ * {@link LayoutKeyConstants#CONNECTOR_DIMENSION}, and
+ * {@link LayoutKeyConstants#CONNECTOR_POSITION} for connectors, and
+ * {@link LayoutKeyConstants#CONNECTION_POINTS} for connections.
+ * 
+ * @author hoelzl
+ * @author hummel
+ * @author wandinger
+ * @author $Author$
+ * @version $Rev$
+ * @ConQAT.Rating YELLOW Hash: 25AD71B03A35B62E98B23A7E3319C20B
+ */
+public final class LayoutKeyConstants {
+
+	/** Dimension layout data key. */
+	public static final String NODE_DIMENSION = "dim";
+
+	/** Position layout data key. */
+	public static final String NODE_POSITION = "pos";
+
+	/** Points layout data key. */
+	public static final String CONNECTION_POINTS = "points";
+
+	/** Sticky position layout data key */
+	public static final String CONNECTOR_POSITION = "cpos";
+
+	/** Sticky dimension layout data key */
+	public static final String CONNECTOR_DIMENSION = "cdim";
+
+	/** Sticky orientation layout data key */
+	public static final String CONNECTOR_ORIENTATION = "corient";
+
+	/** Sticky offset layout data key */
+	public static final String CONNECTOR_OFFSET = "coffset";
+
+	/** Sticky angle layout data key */
+	public static final String CONNECTOR_ANGLE = "cangle";
+}
diff --git a/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/layout/constants/RecommendedLayoutConstants.java b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/layout/constants/RecommendedLayoutConstants.java
new file mode 100644
index 0000000000000000000000000000000000000000..effee91465fa6863a24d45d1ce2e8cd4e8c5ee14
--- /dev/null
+++ b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/layout/constants/RecommendedLayoutConstants.java
@@ -0,0 +1,90 @@
+/*--------------------------------------------------------------------------+
+$Id$
+|                                                                          |
+| Copyright 2011 ForTISS GmbH                                              |
+|                                                                          |
+| Licensed under the Apache License, Version 2.0 (the "License");          |
+| you may not use this file except in compliance with the License.         |
+| You may obtain a copy of the License at                                  |
+|                                                                          |
+|    http://www.apache.org/licenses/LICENSE-2.0                            |
+|                                                                          |
+| Unless required by applicable law or agreed to in writing, software      |
+| distributed under the License is distributed on an "AS IS" BASIS,        |
+| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
+| See the License for the specific language governing permissions and      |
+| limitations under the License.                                           |
++--------------------------------------------------------------------------*/
+package org.fortiss.tooling.base.layout.constants;
+
+import org.conqat.ide.commons.ui.swt.FontUtils;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Font;
+
+/**
+ * Default layout constants for GEF-based editors.
+ * 
+ * @author wandinger
+ * @author $Author$
+ * @version $Rev$
+ * @ConQAT.Rating YELLOW Hash: B39B2B4E72E7414FABE88CBE9DF54EEE
+ */
+public final class RecommendedLayoutConstants {
+
+	/** Title font. */
+	public static final Font TITLE_FONT = FontUtils.derive(
+			JFaceResources.getDefaultFont(), 0, SWT.BOLD);
+
+	// editor grid constants
+
+	/** The offset of the grid. */
+	public static final Point GRID_ORIGIN = new Point(0, 0);
+
+	/** The size between two lines of the grid. */
+	public static final int GRID_SIZE = 12;
+
+	// oval shapes constants
+
+	/** The size of oval connectors. */
+	public static final int OVAL_CONNECTOR_SIZE = GRID_SIZE * 2;
+
+	/** Dimension used for oval connectors. */
+	public static final Dimension OVAL_CONNECTOR_DIMENSION = new Dimension(
+			OVAL_CONNECTOR_SIZE, OVAL_CONNECTOR_SIZE);
+
+	/** The minimal height of an oval shape. */
+	public static final int OVAL_SHAPE_MINIMUM_HEIGHT = GRID_SIZE * 6;
+
+	/** The aspect ratio of oval shapes. */
+	public static final double OVAL_SHAPE_ASPECT_RATIO = 1.6;
+
+	/** The minimal width of an oval shape. */
+	public static final int OVAL_SHAPE_MINIMUM_WIDTH = (int) (OVAL_SHAPE_MINIMUM_HEIGHT * OVAL_SHAPE_ASPECT_RATIO);
+
+	// rectangular shapes constants
+
+	/** The minimum width of a rectangular shape. */
+	public static final int RECTANGULAR_SHAPE_MINIMUM_WIDTH = 9 * GRID_SIZE;
+
+	/** The minimum height of a rectangular shape. */
+	public static final int RECTANGULAR_SHAPE_MINIMUM_HEIGHT = 6 * GRID_SIZE;
+
+	/** The size of the insets of a rectangular shape. */
+	public static final int RECTANGULAR_SHAPE_INSETS = GRID_SIZE;
+
+	/** The size of a rectangular connector. */
+	public static final int RECTANGULAR_CONNECTOR_SIZE = 2 * GRID_SIZE;
+
+	/** Dimension used for rectangular connector. */
+	public static final Dimension RECTANGULAR_CONNECTOR_DIMENSION = new Dimension(
+			RECTANGULAR_CONNECTOR_SIZE, RECTANGULAR_CONNECTOR_SIZE);
+
+	/** The bounds used for the main figure of the rectangular connector. */
+	public static final Rectangle RECTANGULAR_CONNECTOR_FIGURE_BOUNDS = new Rectangle(
+			RECTANGULAR_CONNECTOR_SIZE / 4, RECTANGULAR_CONNECTOR_SIZE / 4,
+			RECTANGULAR_CONNECTOR_SIZE / 2, RECTANGULAR_CONNECTOR_SIZE / 2);
+}
diff --git a/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/layout/util/EditPartLayoutUtils.java b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/layout/util/EditPartLayoutUtils.java
new file mode 100644
index 0000000000000000000000000000000000000000..e4255d2f1d43094b6451b4c09389876a9802abf9
--- /dev/null
+++ b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/layout/util/EditPartLayoutUtils.java
@@ -0,0 +1,267 @@
+/*--------------------------------------------------------------------------+
+$Id$
+|                                                                          |
+| Copyright 2011 ForTISS GmbH                                              |
+|                                                                          |
+| Licensed under the Apache License, Version 2.0 (the "License");          |
+| you may not use this file except in compliance with the License.         |
+| You may obtain a copy of the License at                                  |
+|                                                                          |
+|    http://www.apache.org/licenses/LICENSE-2.0                            |
+|                                                                          |
+| Unless required by applicable law or agreed to in writing, software      |
+| distributed under the License is distributed on an "AS IS" BASIS,        |
+| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
+| See the License for the specific language governing permissions and      |
+| limitations under the License.                                           |
++--------------------------------------------------------------------------*/
+package org.fortiss.tooling.base.layout.util;
+
+import java.awt.Polygon;
+
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.fortiss.tooling.base.compose.DropContext;
+import org.fortiss.tooling.base.layout.constants.LayoutKeyConstants;
+import org.fortiss.tooling.base.layout.constants.RecommendedLayoutConstants;
+import org.fortiss.tooling.base.model.layout.EOrientation;
+import org.fortiss.tooling.base.model.layout.ILayoutedModelElement;
+import org.fortiss.tooling.base.model.layout.OffsetOrientation;
+
+/**
+ * Utility class collecting EditPart layout methods.
+ * 
+ * @author wandinger
+ * @author hummel
+ * @author $Author$
+ * @version $Rev$
+ * @ConQAT.Rating YELLOW Hash: 3964EB0B7D1E388B567D8C31BCBD16F2
+ */
+public class EditPartLayoutUtils {
+
+	/** Returns the given value aligned to the grid. */
+	public static int snapToGrid(double d) {
+		return RecommendedLayoutConstants.GRID_SIZE
+				* (int) Math.round(d / RecommendedLayoutConstants.GRID_SIZE);
+	}
+
+	/** Modifies the x and y coordinates of the given point to be on the grid. */
+	public static void snapToGrid(Point p) {
+		p.x = snapToGrid(p.x);
+		p.y = snapToGrid(p.y);
+	}
+
+	/**
+	 * Returns polar coordinates of the point on the ellipse border having the
+	 * given angle.
+	 */
+	public static Polar calculateEllipseBorderPolar(double angle,
+			Dimension ellipseSize, int inset) {
+		double a = ellipseSize.width / 2 - inset;
+		double b = ellipseSize.height / 2 - inset;
+		double epsilon = Math.sqrt(a * a - b * b) / a;
+		double r = b
+				/ Math.sqrt(1 - epsilon * epsilon * Math.cos(angle)
+						* Math.cos(angle));
+		return new Polar(angle, r);
+	}
+
+	/**
+	 * Returns Cartesian coordinates of the point on the ellipse border having
+	 * the given angle.
+	 */
+	public static Point calculateEllipseBorderPoint(double angle,
+			Dimension ellipseSize, int inset) {
+		Polar p = calculateEllipseBorderPolar(angle, ellipseSize, inset);
+		return p.toCartesian().translate(ellipseSize.getScaled(.5));
+	}
+
+	/**
+	 * Returns the {@link OffsetOrientation} of the point on the rectangle
+	 * border having a given Point inside the rectangle.
+	 */
+	public static OffsetOrientation calculateRectangleBorderOrientation(
+			Point source, Dimension rectangleSize, int inset) {
+		int offset = 0;
+		EOrientation orientation = EOrientation.NORTH;
+
+		// The figure bounds
+		Rectangle bounds = new Rectangle(0, 0, rectangleSize.width,
+				rectangleSize.height);
+
+		// Divide the rectangle into four diagonal sectors
+		Polygon northSector = new Polygon(new int[] { bounds.getCenter().x,
+				bounds.x, bounds.width }, new int[] { bounds.getCenter().y,
+				bounds.y, bounds.y }, 3);
+		Polygon eastSector = new Polygon(new int[] { bounds.getCenter().x,
+				bounds.width, bounds.width }, new int[] { bounds.getCenter().y,
+				bounds.y, bounds.height }, 3);
+		Polygon southSector = new Polygon(new int[] { bounds.getCenter().x,
+				bounds.width, bounds.x }, new int[] { bounds.getCenter().y,
+				bounds.height, bounds.height }, 3);
+		Polygon westSector = new Polygon(new int[] { bounds.getCenter().x,
+				bounds.x, bounds.x }, new int[] { bounds.getCenter().y,
+				bounds.height, bounds.y }, 3);
+
+		// Determine in which sector we are and clamp the position accordingly
+		if (northSector.contains(source.x, source.y)) {
+			orientation = EOrientation.NORTH;
+			offset = (int) (source.x * (1 - (2 * inset) / (double) bounds.width));
+		}
+		if (westSector.contains(source.x, source.y)) {
+			orientation = EOrientation.WEST;
+			offset = (int) (source.y * (1 - (2 * inset)
+					/ (double) bounds.height));
+		}
+		if (southSector.contains(source.x, source.y)) {
+			orientation = EOrientation.SOUTH;
+			offset = (int) (source.x * (1 - (2 * inset) / (double) bounds.width));
+		}
+		if (eastSector.contains(source.x, source.y)) {
+			orientation = EOrientation.EAST;
+			offset = (int) (source.y * (1 - (2 * inset)
+					/ (double) bounds.height));
+		}
+		return OrientationUtils.createOffsetOrientation(orientation, offset);
+	}
+
+	/**
+	 * Ensure that the minimum size and aspect ratio of a oval shape are
+	 * redeemed.
+	 */
+	public static Dimension clampOvalShapeSize(Dimension oldSize, int direction) {
+		Dimension newSize;
+
+		// check for minimum size
+		newSize = new Dimension(
+				oldSize.width < RecommendedLayoutConstants.OVAL_SHAPE_MINIMUM_WIDTH ? RecommendedLayoutConstants.OVAL_SHAPE_MINIMUM_WIDTH
+						: oldSize.width,
+				oldSize.height < RecommendedLayoutConstants.OVAL_SHAPE_MINIMUM_HEIGHT ? RecommendedLayoutConstants.OVAL_SHAPE_MINIMUM_HEIGHT
+						: oldSize.height);
+
+		// ensure that the aspect ratio is redeemed
+		switch (direction) {
+		case PositionConstants.SOUTH_EAST:
+			int aspectHeight = (int) (newSize.width / RecommendedLayoutConstants.OVAL_SHAPE_ASPECT_RATIO);
+			int aspectWidth = (int) (newSize.height * RecommendedLayoutConstants.OVAL_SHAPE_ASPECT_RATIO);
+			newSize.setSize(new Dimension(
+					newSize.width > aspectWidth ? aspectWidth : newSize.width,
+					newSize.height > aspectHeight ? aspectHeight
+							: newSize.height));
+			break;
+		case PositionConstants.SOUTH:
+			newSize.setSize(new Dimension(
+					(int) (newSize.height * RecommendedLayoutConstants.OVAL_SHAPE_ASPECT_RATIO),
+					newSize.height));
+			break;
+		case PositionConstants.EAST:
+			newSize.setSize(new Dimension(
+					newSize.width,
+					(int) (newSize.width / RecommendedLayoutConstants.OVAL_SHAPE_ASPECT_RATIO)));
+			break;
+		}
+
+		return newSize;
+	}
+
+	/**
+	 * Ensure that the minimum size of a rectangular shape is redeemed.
+	 */
+	public static Dimension clampRectangularShapeSize(Dimension oldSize) {
+		// check for minimum size
+		Dimension newSize = new Dimension(
+				oldSize.width < RecommendedLayoutConstants.RECTANGULAR_SHAPE_MINIMUM_WIDTH ? RecommendedLayoutConstants.RECTANGULAR_SHAPE_MINIMUM_WIDTH
+						: oldSize.width,
+				oldSize.height < RecommendedLayoutConstants.RECTANGULAR_SHAPE_MINIMUM_HEIGHT ? RecommendedLayoutConstants.RECTANGULAR_SHAPE_MINIMUM_HEIGHT
+						: oldSize.height);
+
+		return newSize;
+	}
+
+	/** Layouts the given connector within the surrounding ellipse. */
+	public static void layoutConnectorInEllipse(ILayoutedModelElement layouted,
+			ILayoutedModelElement container, Point location) {
+		Point position = location.getCopy();
+		position.translate(LayoutDataUtils.getNodePosition(container)
+				.getNegated());
+		position.translate(LayoutDataUtils.getNodeSize(container).scale(-.5));
+		// store the value in the model
+		LayoutDataUtils.setAngle(layouted, LayoutKeyConstants.CONNECTOR_ANGLE,
+				new Polar(position).angle);
+	}
+
+	/** Layouts the given connector within the surrounding rectangle. */
+	public static void layoutConnectorInRectangle(
+			ILayoutedModelElement layouted, ILayoutedModelElement container,
+			Point location) {
+		Point position = location.getCopy();
+		position.translate(LayoutDataUtils.getNodePosition(container)
+				.getNegated());
+		// do border clamping
+		OffsetOrientation orient = EditPartLayoutUtils
+				.calculateRectangleBorderOrientation(position,
+						LayoutDataUtils.getNodeSize(container),
+						RecommendedLayoutConstants.RECTANGULAR_SHAPE_INSETS);
+		// snap to grid and store the value in the model
+		LayoutDataUtils.setConnectorOrientation(layouted,
+				orient.getOrientation());
+		LayoutDataUtils.setConnectorOffset(layouted,
+				EditPartLayoutUtils.snapToGrid(orient.getOffset()));
+	}
+
+	/** Layouts the given layouted object using the position in the context. */
+	public static void layoutNodeInRoot(ILayoutedModelElement layouted,
+			DropContext context, int positionOffset, boolean snapToGrid) {
+		layoutNodeInRoot(layouted, context.getPosition(), positionOffset,
+				snapToGrid);
+	}
+
+	/** Layouts the given layouted object using the position in the context. */
+	public static void layoutNodeInRoot(ILayoutedModelElement layouted,
+			Point location, int positionOffset, boolean snapToGrid) {
+		Point position = location.getCopy();
+		position.translate(-positionOffset, -positionOffset);
+		if (snapToGrid) {
+			EditPartLayoutUtils.snapToGrid(position);
+		}
+		LayoutDataUtils.setNodePosition(layouted, position);
+	}
+
+	/**
+	 * Class for storing polar coordinates.
+	 * 
+	 * @author wandinger
+	 * @author hummel
+	 * @author $Author$
+	 * @version $Rev$
+	 * @levd.rating YELLOW Rev: 519
+	 */
+	public static class Polar {
+
+		/** The angle */
+		public double angle;
+
+		/** The distance */
+		public double distance;
+
+		/** The constructor */
+		public Polar(double angle, double distance) {
+			this.angle = angle;
+			this.distance = distance;
+		}
+
+		/** Create new polar values from cartesian ones. */
+		public Polar(Point pos) {
+			angle = Math.atan2(pos.y, pos.x);
+			distance = Math.sqrt(pos.x * pos.x + pos.y * pos.y);
+		}
+
+		/** Returns a cartesian representation. */
+		public Point toCartesian() {
+			return new Point(distance * Math.cos(angle), distance
+					* Math.sin(angle));
+		}
+	}
+}
diff --git a/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/layout/util/LayoutDataUtils.java b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/layout/util/LayoutDataUtils.java
new file mode 100644
index 0000000000000000000000000000000000000000..c9c26922727f2c6c25a289f597aec8cf660c14cf
--- /dev/null
+++ b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/layout/util/LayoutDataUtils.java
@@ -0,0 +1,367 @@
+/*--------------------------------------------------------------------------+
+$Id$
+|                                                                          |
+| Copyright 2011 ForTISS GmbH                                              |
+|                                                                          |
+| Licensed under the Apache License, Version 2.0 (the "License");          |
+| you may not use this file except in compliance with the License.         |
+| You may obtain a copy of the License at                                  |
+|                                                                          |
+|    http://www.apache.org/licenses/LICENSE-2.0                            |
+|                                                                          |
+| Unless required by applicable law or agreed to in writing, software      |
+| distributed under the License is distributed on an "AS IS" BASIS,        |
+| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
+| See the License for the specific language governing permissions and      |
+| limitations under the License.                                           |
++--------------------------------------------------------------------------*/
+package org.fortiss.tooling.base.layout.util;
+
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.ecore.EObject;
+import org.fortiss.tooling.base.layout.constants.LayoutKeyConstants;
+import org.fortiss.tooling.base.layout.constants.RecommendedLayoutConstants;
+import org.fortiss.tooling.base.model.layout.Angle;
+import org.fortiss.tooling.base.model.layout.Dimension;
+import org.fortiss.tooling.base.model.layout.EOrientation;
+import org.fortiss.tooling.base.model.layout.ILayoutData;
+import org.fortiss.tooling.base.model.layout.ILayoutedModelElement;
+import org.fortiss.tooling.base.model.layout.LayoutFactory;
+import org.fortiss.tooling.base.model.layout.Offset;
+import org.fortiss.tooling.base.model.layout.Orientation;
+import org.fortiss.tooling.base.model.layout.Point;
+import org.fortiss.tooling.base.model.layout.Points;
+
+/**
+ * Utility methods for {@link ILayoutedModelElement} and {@link ILayoutData}.
+ * 
+ * @author hoelzl
+ * @author wandinger
+ * @author hummel
+ * @author $Author$
+ * @version $Rev$
+ * @ConQAT.Rating YELLOW Hash: 9C4FEB62413E5D5B6355B4A7D2360C09
+ */
+public class LayoutDataUtils {
+
+	/** Returns a {@link Point} layout data object with the given key or null. */
+	public static Point getPoint(ILayoutedModelElement lobject, String key) {
+		for (final ILayoutData ld : lobject.getLayoutDataList()) {
+			if (ld.getKey().equals(key) && ld instanceof Point) {
+				return (Point) ld;
+			}
+		}
+		return null;
+	}
+
+	/** Sets a {@link Point} layout data. */
+	public static void setPoint(ILayoutedModelElement lobject, String key,
+			org.eclipse.draw2d.geometry.Point point) {
+		Point p = getPoint(lobject, key);
+		if (p == null) {
+			p = LayoutFactory.eINSTANCE.createPoint();
+			p.setKey(key);
+			lobject.getLayoutDataList().add(p);
+		}
+		p.setX(point.x);
+		p.setY(point.y);
+	}
+
+	/** Returns a {@link Dimension} layout data object with the given key. */
+	public static Dimension getDimension(ILayoutedModelElement lobject,
+			String key) {
+		for (final ILayoutData ld : lobject.getLayoutDataList()) {
+			if (ld.getKey().equals(key) && ld instanceof Dimension) {
+				return (Dimension) ld;
+			}
+		}
+		return null;
+	}
+
+	/** Sets a {@link Dimension} layout data object with the given key. */
+	public static void setDimension(ILayoutedModelElement lobject, String key,
+			org.eclipse.draw2d.geometry.Dimension size) {
+		Dimension d = getDimension(lobject, key);
+		if (d == null) {
+			d = LayoutFactory.eINSTANCE.createDimension();
+			d.setKey(key);
+			lobject.getLayoutDataList().add(d);
+		}
+		d.setWidth(size.width);
+		d.setHeight(size.height);
+	}
+
+	/** Returns a {@link Orientation} layout data object with the given key. */
+	public static Orientation getOrientation(ILayoutedModelElement lobject,
+			String key) {
+		for (final ILayoutData ld : lobject.getLayoutDataList()) {
+			if (ld.getKey().equals(key) || ld instanceof Orientation) {
+				return (Orientation) ld;
+			}
+		}
+		return null;
+	}
+
+	/** Sets a {@link Orientation} layout data object with the given key. */
+	public static void setOrientation(ILayoutedModelElement lobject,
+			String key, EOrientation orientation) {
+		Orientation o = getOrientation(lobject, key);
+		if (o == null) {
+			o = LayoutFactory.eINSTANCE.createOrientation();
+			o.setKey(key);
+			lobject.getLayoutDataList().add(o);
+		}
+		o.setOrientation(orientation);
+	}
+
+	/** Returns a {@link Offset} layout data object with the given key. */
+	public static Offset getOffset(ILayoutedModelElement lobject, String key) {
+		for (final ILayoutData ld : lobject.getLayoutDataList()) {
+			if (ld.getKey().equals(key) || ld instanceof Offset) {
+				return (Offset) ld;
+			}
+		}
+		return null;
+	}
+
+	/** Sets a {@link Offset} layout data object with the given key. */
+	public static void setOffset(ILayoutedModelElement lobject, String key,
+			int offset) {
+		Offset o = getOffset(lobject, key);
+		if (o == null) {
+			o = LayoutFactory.eINSTANCE.createOffset();
+			o.setKey(key);
+			lobject.getLayoutDataList().add(o);
+		}
+		o.setOffset(offset);
+	}
+
+	/** Returns an angle. */
+	public static Angle getAngle(ILayoutedModelElement lobject, String key) {
+		for (final ILayoutData ld : lobject.getLayoutDataList()) {
+			if (ld.getKey().equals(key) && ld instanceof Angle) {
+				return (Angle) ld;
+			}
+		}
+		return null;
+	}
+
+	/** Returns the angle as double value (0 if not existing). */
+	public static double getAngleAsDouble(ILayoutedModelElement lobject,
+			String key) {
+		final Angle a = getAngle(lobject, key);
+		if (a == null) {
+			return 0;
+		}
+		return a.getAngle();
+	}
+
+	/** Sets a {@link Point} layout data. */
+	public static void setAngle(ILayoutedModelElement lobject, String key,
+			double angle) {
+		Angle a = getAngle(lobject, key);
+		if (a == null) {
+			a = LayoutFactory.eINSTANCE.createAngle();
+			a.setKey(key);
+			lobject.getLayoutDataList().add(a);
+		}
+		a.setAngle(angle);
+	}
+
+	/** Gets the position stored at the given key. */
+	public static org.eclipse.draw2d.geometry.Point getPosition(
+			ILayoutedModelElement layouted, String key) {
+		final Point point = LayoutDataUtils.getPoint(layouted, key);
+
+		if (point == null) {
+			int index = 0;
+			final EObject container = layouted.eContainer();
+			if (container != null) {
+				index = 1 + container.eContents().indexOf(layouted);
+			}
+
+			return new org.eclipse.draw2d.geometry.Point(index * 20, index * 20);
+		}
+
+		return new org.eclipse.draw2d.geometry.Point(point.getX(), point.getY());
+	}
+
+	/** Returns a {@link Points} layout data object with the given key. */
+	public static Points getPoints(ILayoutedModelElement lobject, String key) {
+		for (final ILayoutData ld : lobject.getLayoutDataList()) {
+			if (ld.getKey().equals(key) || ld instanceof Points) {
+				return (Points) ld;
+			}
+		}
+		return null;
+	}
+
+	/**
+	 * Returns the bounds of the given layouted node.
+	 */
+	public static Rectangle getNodeBounds(ILayoutedModelElement layouted) {
+		return new Rectangle(getNodePosition(layouted), getNodeSize(layouted));
+	}
+
+	/**
+	 * Sets the bounds of the given layouted node.
+	 */
+	public static void setNodeBounds(ILayoutedModelElement layouted,
+			Rectangle bounds) {
+		setNodePosition(layouted, bounds.getLocation());
+		setNodeSize(layouted, bounds.getSize());
+	}
+
+	/** Returns the position of the given layouted node. */
+	public static org.eclipse.draw2d.geometry.Point getNodePosition(
+			ILayoutedModelElement layouted) {
+		return getPosition(layouted, LayoutKeyConstants.NODE_POSITION);
+	}
+
+	/**
+	 * Sets the layouted node's position.
+	 */
+	public static void setNodePosition(ILayoutedModelElement layouted,
+			org.eclipse.draw2d.geometry.Point position) {
+		setPoint(layouted, LayoutKeyConstants.NODE_POSITION, position);
+	}
+
+	/** Returns the size of the given layouted node. */
+	public static org.eclipse.draw2d.geometry.Dimension getNodeSize(
+			ILayoutedModelElement layouted) {
+		final Dimension size = LayoutDataUtils.getDimension(layouted,
+				LayoutKeyConstants.NODE_DIMENSION);
+
+		if (size == null) {
+			return new org.eclipse.draw2d.geometry.Dimension(
+					RecommendedLayoutConstants.RECTANGULAR_SHAPE_MINIMUM_WIDTH,
+					RecommendedLayoutConstants.RECTANGULAR_SHAPE_MINIMUM_HEIGHT);
+		}
+		return new org.eclipse.draw2d.geometry.Dimension(size.getWidth(),
+				size.getHeight());
+	}
+
+	/** Sets the layouted node's size. */
+	public static void setNodeSize(ILayoutedModelElement layouted,
+			org.eclipse.draw2d.geometry.Dimension size) {
+		setDimension(layouted, LayoutKeyConstants.NODE_DIMENSION, size);
+	}
+
+	/**
+	 * Returns the layouted connector's position.
+	 */
+	public static org.eclipse.draw2d.geometry.Point getConnectorPosition(
+			ILayoutedModelElement layouted) {
+		return getPosition(layouted, LayoutKeyConstants.CONNECTOR_POSITION);
+	}
+
+	/**
+	 * Sets the layouted connector's position.
+	 */
+	public static void setConnectorPosition(ILayoutedModelElement layouted,
+			org.eclipse.draw2d.geometry.Point position) {
+		setPoint(layouted, LayoutKeyConstants.CONNECTOR_POSITION, position);
+	}
+
+	/**
+	 * Returns the layouted connector's orientation.
+	 */
+	public static EOrientation getConnectorOrientation(
+			ILayoutedModelElement layouted) {
+		final Orientation orientation = getOrientation(layouted,
+				LayoutKeyConstants.CONNECTOR_ORIENTATION);
+		if (orientation == null) {
+			return EOrientation.NORTH;
+		}
+		return orientation.getOrientation();
+	}
+
+	/**
+	 * Sets the layouted connector's orientation.
+	 */
+	public static void setConnectorOrientation(ILayoutedModelElement layouted,
+			EOrientation orientation) {
+		setOrientation(layouted, LayoutKeyConstants.CONNECTOR_ORIENTATION,
+				orientation);
+	}
+
+	/**
+	 * Returns the layouted connector's offset.
+	 */
+	public static int getConnectorOffset(ILayoutedModelElement layouted) {
+		final Offset offset = getOffset(layouted,
+				LayoutKeyConstants.CONNECTOR_OFFSET);
+		if (offset == null) {
+			return 0;
+		}
+		return offset.getOffset();
+	}
+
+	/**
+	 * Sets the layouted connector's angle.
+	 */
+	public static void setConnectorOffset(ILayoutedModelElement layouted,
+			int offset) {
+		setOffset(layouted, LayoutKeyConstants.CONNECTOR_OFFSET, offset);
+	}
+
+	/**
+	 * Sets the layouted connector's offset.
+	 */
+	public static void setConnectorAngle(ILayoutedModelElement layouted,
+			double angle) {
+		setAngle(layouted, LayoutKeyConstants.CONNECTOR_OFFSET, angle);
+	}
+
+	/**
+	 * Returns the layouted connector's angle.
+	 */
+	public static double getConnectorAngle(ILayoutedModelElement layouted) {
+		final Angle angle = getAngle(layouted,
+				LayoutKeyConstants.CONNECTOR_ANGLE);
+		if (angle == null) {
+			return 0;
+		}
+		return angle.getAngle();
+	}
+
+	/**
+	 * Creates a new connection layout.
+	 */
+	public static void createConnectionLayout(ILayoutedModelElement lo) {
+		final Points points = LayoutFactory.eINSTANCE.createPoints();
+		points.setKey(LayoutKeyConstants.CONNECTION_POINTS);
+		lo.getLayoutDataList().add(points);
+	}
+
+	/**
+	 * Creates a new connector layout.
+	 */
+	public static void createConnectorLayout(ILayoutedModelElement lo) {
+		createNodeLayout(lo);
+
+		final Point cpos = LayoutFactory.eINSTANCE.createPoint();
+		cpos.setKey(LayoutKeyConstants.CONNECTOR_POSITION);
+
+		final Dimension cdim = LayoutFactory.eINSTANCE.createDimension();
+		cdim.setKey(LayoutKeyConstants.CONNECTOR_DIMENSION);
+
+		lo.getLayoutDataList().add(cpos);
+		lo.getLayoutDataList().add(cdim);
+	}
+
+	/**
+	 * Creates a new node layout.
+	 */
+	public static void createNodeLayout(ILayoutedModelElement lo) {
+		final Point pos = LayoutFactory.eINSTANCE.createPoint();
+		pos.setKey(LayoutKeyConstants.NODE_POSITION);
+
+		final Dimension dim = LayoutFactory.eINSTANCE.createDimension();
+		dim.setKey(LayoutKeyConstants.NODE_DIMENSION);
+
+		lo.getLayoutDataList().add(pos);
+		lo.getLayoutDataList().add(dim);
+	}
+
+}
diff --git a/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/layout/util/OrientationUtils.java b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/layout/util/OrientationUtils.java
new file mode 100644
index 0000000000000000000000000000000000000000..f3f695910b2810448ca8648d537113e73f8c11d0
--- /dev/null
+++ b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/layout/util/OrientationUtils.java
@@ -0,0 +1,92 @@
+/*--------------------------------------------------------------------------+
+$Id$
+|                                                                          |
+| Copyright 2011 ForTISS GmbH                                              |
+|                                                                          |
+| Licensed under the Apache License, Version 2.0 (the "License");          |
+| you may not use this file except in compliance with the License.         |
+| You may obtain a copy of the License at                                  |
+|                                                                          |
+|    http://www.apache.org/licenses/LICENSE-2.0                            |
+|                                                                          |
+| Unless required by applicable law or agreed to in writing, software      |
+| distributed under the License is distributed on an "AS IS" BASIS,        |
+| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
+| See the License for the specific language governing permissions and      |
+| limitations under the License.                                           |
++--------------------------------------------------------------------------*/
+package org.fortiss.tooling.base.layout.util;
+
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.fortiss.tooling.base.layout.constants.RecommendedLayoutConstants;
+import org.fortiss.tooling.base.model.layout.EOrientation;
+import org.fortiss.tooling.base.model.layout.LayoutFactory;
+import org.fortiss.tooling.base.model.layout.Offset;
+import org.fortiss.tooling.base.model.layout.OffsetOrientation;
+import org.fortiss.tooling.base.model.layout.Orientation;
+
+/**
+ * Class for handling orientation relative coordinates.
+ * 
+ * @author wandinger
+ * @author hoelzl
+ * @author $Author$
+ * @version $Rev$
+ * @ConQAT.Rating YELLOW Hash: F959248D524F8DA65AA76E06A092CD9D
+ */
+public class OrientationUtils {
+
+	/** Key which identifies the class. */
+	public static final String KEY = "ORIENTATION";
+
+	/** Return the absolute position for a given orientation. */
+	public static Point getAbsolute(Orientation orientation, Offset offset,
+			Dimension parentSize, int parentInsets) {
+		Point pos = new Point(0, 0);
+		int offsetValue = offset.getOffset();
+		switch (orientation.getOrientation()) {
+		case NORTH:
+			pos.setLocation(offsetValue, 0);
+			break;
+		case WEST:
+			pos.setLocation(0, offsetValue);
+			break;
+		case SOUTH:
+			pos.setLocation(offsetValue, parentSize.height - 2 * parentInsets);
+			break;
+		case EAST:
+			pos.setLocation(parentSize.width - 2 * parentInsets, offsetValue);
+			break;
+		}
+
+		return pos;
+	}
+
+	/**
+	 * Return the absolute position for the given orientation using default
+	 * insets.
+	 */
+	public static Point getAbsolute(Orientation orientation, Offset offset,
+			Dimension parentSize) {
+		return getAbsolute(orientation, offset, parentSize,
+				RecommendedLayoutConstants.RECTANGULAR_SHAPE_INSETS);
+	}
+
+	/** Returns a new {@link OffsetOrientation} object with the given values. */
+	public static OffsetOrientation createOffsetOrientation(
+			EOrientation orientation, int offset) {
+		OffsetOrientation oo = LayoutFactory.eINSTANCE
+				.createOffsetOrientation();
+		oo.setOrientation(orientation);
+		oo.setOffset(offset);
+		return oo;
+	}
+
+	/** Returns a new Orientation object with the given value. */
+	public static Orientation createOrientation(EOrientation orientation) {
+		Orientation o = LayoutFactory.eINSTANCE.createOrientation();
+		o.setOrientation(orientation);
+		return o;
+	}
+}
diff --git a/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/layout/util/ZoomUtils.java b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/layout/util/ZoomUtils.java
new file mode 100644
index 0000000000000000000000000000000000000000..d58c707dcc63f6d55126e8738209f39d50db7184
--- /dev/null
+++ b/org.fortiss.tooling.base/trunk/src/org/fortiss/tooling/base/layout/util/ZoomUtils.java
@@ -0,0 +1,60 @@
+/*--------------------------------------------------------------------------+
+$Id$
+|                                                                          |
+| Copyright 2011 ForTISS GmbH                                              |
+|                                                                          |
+| Licensed under the Apache License, Version 2.0 (the "License");          |
+| you may not use this file except in compliance with the License.         |
+| You may obtain a copy of the License at                                  |
+|                                                                          |
+|    http://www.apache.org/licenses/LICENSE-2.0                            |
+|                                                                          |
+| Unless required by applicable law or agreed to in writing, software      |
+| distributed under the License is distributed on an "AS IS" BASIS,        |
+| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
+| See the License for the specific language governing permissions and      |
+| limitations under the License.                                           |
++--------------------------------------------------------------------------*/
+package org.fortiss.tooling.base.layout.util;
+
+import org.eclipse.gef.RootEditPart;
+import org.eclipse.gef.editparts.ScalableFreeformRootEditPart;
+import org.eclipse.gef.editparts.ScalableRootEditPart;
+import org.eclipse.gef.requests.ChangeBoundsRequest;
+
+/**
+ * Utility code to support zooming.
+ * 
+ * @author hummel
+ * @author $Author$
+ * @version $Rev$
+ * @ConQAT.Rating YELLOW Hash: 990CC0C860163174B266FAE75C2B3197
+ */
+public class ZoomUtils {
+
+	/** Extracts the current zoom level from the given root edit part. */
+	public static double determineZoom(RootEditPart rootEditPart) {
+		if (rootEditPart instanceof ScalableRootEditPart) {
+			return ((ScalableRootEditPart) rootEditPart).getZoomManager()
+					.getZoom();
+		}
+		if (rootEditPart instanceof ScalableFreeformRootEditPart) {
+			return ((ScalableFreeformRootEditPart) rootEditPart)
+					.getZoomManager().getZoom();
+		}
+		return 1;
+	}
+
+	/**
+	 * Fixes a {@link ChangeBoundsRequest} for the current zoom level. Both the
+	 * move and size delta are changed.
+	 */
+	public static void fixChangeBoundRequest(ChangeBoundsRequest request,
+			double zoom) {
+		if (zoom <= 0 || zoom == 1) {
+			return;
+		}
+		request.getMoveDelta().scale(1 / zoom);
+		request.getSizeDelta().scale(1 / zoom);
+	}
+}