From aab105f52e80dd2b06217fa81d7602fc64abe06a Mon Sep 17 00:00:00 2001
From: Florian Hoelzl <hoelzl@fortiss.org>
Date: Fri, 1 Jul 2011 12:37:24 +0000
Subject: [PATCH] renamed ICompositor to IElementCompositor renamed
 ICompositionContext to IElementCompositionContext replaced IRemovable with
 decomposition feature of IElementCompositor fixed existing compositors

---
 .../ui/action/CopyModelElementsAction.java    |  2 +-
 .../base/ui/action/CopyPasteUtils.java        |  6 +-
 .../ui/action/CutModelElementsAction.java     | 13 ++--
 .../ui/action/PasteModelElementAction.java    |  2 +-
 ...archicElementConnectionCompositorBase.java |  6 +-
 .../tooling/base/ui/dnd/DropContext.java      |  4 +-
 .../base/ui/editor/TreeViewerEditorBase.java  |  8 +--
 .../editpart/policy/LayoutEditPolicyBase.java | 10 +--
 .../ui/editpart/policy/RemoveEditPolicy.java  | 27 +++++---
 .../kernel/ui/internal/ActionService.java     | 17 +++--
 .../kernel/ui/internal/views/NewMenu.java     |  6 +-
 .../trunk/model/kernel.ecore                  | 17 -----
 org.fortiss.tooling.kernel/trunk/plugin.xml   |  2 +-
 ...or.exsd => modelConnectionCompositor.exsd} |  0
 .../trunk/schema/modelElementCompositor.exsd  |  2 +-
 ...t.java => IElementCompositionContext.java} |  6 +-
 ...ompositor.java => IElementCompositor.java} | 40 ++++++++----
 ...ice.java => ElementCompositorService.java} | 62 ++++++++++++-------
 .../kernel/internal/PrototypeService.java     |  4 +-
 .../model/impl/IRemovableStaticImpl.java      | 51 ---------------
 .../tooling/kernel/model/impl/package.html    |  8 ---
 ...ce.java => IElementCompositorService.java} | 38 ++++++++----
 22 files changed, 153 insertions(+), 178 deletions(-)
 rename org.fortiss.tooling.kernel/trunk/schema/{modelElementConnectionCompositor.exsd => modelConnectionCompositor.exsd} (100%)
 rename org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/interfaces/{ICompositionContext.java => IElementCompositionContext.java} (89%)
 rename org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/interfaces/{ICompositor.java => IElementCompositor.java} (73%)
 rename org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/{CompositorService.java => ElementCompositorService.java} (60%)
 delete mode 100644 org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/model/impl/IRemovableStaticImpl.java
 delete mode 100644 org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/model/impl/package.html
 rename org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/services/{ICompositorService.java => IElementCompositorService.java} (63%)

diff --git a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/action/CopyModelElementsAction.java b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/action/CopyModelElementsAction.java
index c3b1a7b78..592e9c39d 100644
--- a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/action/CopyModelElementsAction.java
+++ b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/action/CopyModelElementsAction.java
@@ -61,7 +61,7 @@ public class CopyModelElementsAction extends ModelElementsActionBase {
 					CopyPasteUtils.copyToClipboard(selection);
 				} catch (IOException e) {
 					LoggingUtils.error(ToolingBaseUIActivator.getDefault(),
-							"Had problems during copy", e);
+							"Had problems during copy operation", e);
 				}
 			}
 
diff --git a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/action/CopyPasteUtils.java b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/action/CopyPasteUtils.java
index bed9dd92b..c88e03fa1 100644
--- a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/action/CopyPasteUtils.java
+++ b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/action/CopyPasteUtils.java
@@ -35,7 +35,7 @@ import org.eclipse.swt.dnd.DND;
 import org.eclipse.swt.dnd.TextTransfer;
 import org.eclipse.swt.dnd.Transfer;
 import org.eclipse.swt.widgets.Display;
-import org.fortiss.tooling.kernel.services.ICompositorService;
+import org.fortiss.tooling.kernel.services.IElementCompositorService;
 import org.fortiss.tooling.kernel.util.EMFResourceUtils;
 
 /**
@@ -97,14 +97,14 @@ final class CopyPasteUtils {
 		}
 
 		for (EObject insertObj : contents) {
-			if (!ICompositorService.INSTANCE
+			if (!IElementCompositorService.INSTANCE
 					.canCompose(target, insertObj, null)) {
 				return;
 			}
 		}
 
 		for (EObject insertObj : contents) {
-			ICompositorService.INSTANCE.compose(target, insertObj, null);
+			IElementCompositorService.INSTANCE.compose(target, insertObj, null);
 			// LibrarySupport.activateAllElements(insertObj);
 		}
 	}
diff --git a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/action/CutModelElementsAction.java b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/action/CutModelElementsAction.java
index 7ff197e0d..8575e66a0 100644
--- a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/action/CutModelElementsAction.java
+++ b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/action/CutModelElementsAction.java
@@ -27,7 +27,7 @@ import org.eclipse.ui.ISharedImages;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.actions.ActionFactory;
 import org.fortiss.tooling.base.ui.ToolingBaseUIActivator;
-import org.fortiss.tooling.kernel.model.IRemovable;
+import org.fortiss.tooling.kernel.services.IElementCompositorService;
 import org.fortiss.tooling.kernel.util.LoggingUtils;
 
 /**
@@ -60,11 +60,12 @@ public class CutModelElementsAction extends ModelElementsActionBase {
 				try {
 					CopyPasteUtils.copyToClipboard(selection);
 					for (EObject o : selection) {
-						((IRemovable) o).remove();
+						IElementCompositorService.INSTANCE.decompose(
+								o.eContainer(), o, null);
 					}
 				} catch (IOException e) {
 					LoggingUtils.error(ToolingBaseUIActivator.getDefault(),
-							"Had problems during copy", e);
+							"Had problems during cut operation", e);
 				}
 			}
 
@@ -77,10 +78,8 @@ public class CutModelElementsAction extends ModelElementsActionBase {
 			@Override
 			public boolean canExecute() {
 				for (EObject o : selection) {
-					if (!(o instanceof IRemovable)) {
-						return false;
-					}
-					if (!((IRemovable) o).canRemove()) {
+					if (!IElementCompositorService.INSTANCE.canDecompose(
+							o.eContainer(), o, null)) {
 						return false;
 					}
 				}
diff --git a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/action/PasteModelElementAction.java b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/action/PasteModelElementAction.java
index 7a1a01bcb..2f85e8689 100644
--- a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/action/PasteModelElementAction.java
+++ b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/action/PasteModelElementAction.java
@@ -50,7 +50,7 @@ public class PasteModelElementAction extends ModelElementsActionBase {
 	/** {@inheritDoc} */
 	@Override
 	protected Command createCommand(final Collection<EObject> selection) {
-		return new AbstractCommand("Copy") {
+		return new AbstractCommand("Paste") {
 
 			@Override
 			public void execute() {
diff --git a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/compose/HierarchicElementConnectionCompositorBase.java b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/compose/HierarchicElementConnectionCompositorBase.java
index d13947521..c29d0efe9 100644
--- a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/compose/HierarchicElementConnectionCompositorBase.java
+++ b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/compose/HierarchicElementConnectionCompositorBase.java
@@ -27,7 +27,7 @@ import org.fortiss.tooling.base.ui.dnd.DropContext;
 import org.fortiss.tooling.base.ui.editpart.RootEditPartBase;
 import org.fortiss.tooling.kernel.interfaces.IConnectionCompositionContext;
 import org.fortiss.tooling.kernel.interfaces.IConnectionCompositor;
-import org.fortiss.tooling.kernel.services.ICompositorService;
+import org.fortiss.tooling.kernel.services.IElementCompositorService;
 
 /**
  * Base implementation for supporting direct connection of two
@@ -124,13 +124,13 @@ public abstract class HierarchicElementConnectionCompositorBase<HE extends IHier
 		// drop source connector
 		DropContext sourceDrop = context instanceof DragContext ? ((DragContext) context)
 				.getSourceDropContext() : null;
-		ICompositorService.INSTANCE
+		IElementCompositorService.INSTANCE
 				.compose(source, sourceConnector, sourceDrop);
 
 		// drop target target connector
 		DropContext targetDrop = context instanceof DragContext ? ((DragContext) context)
 				.getTargetDropContext() : null;
-		ICompositorService.INSTANCE
+		IElementCompositorService.INSTANCE
 				.compose(target, targetConnector, targetDrop);
 
 		// link connection to connectors
diff --git a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/dnd/DropContext.java b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/dnd/DropContext.java
index 123d4083e..c9d21b1c4 100644
--- a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/dnd/DropContext.java
+++ b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/dnd/DropContext.java
@@ -20,7 +20,7 @@ package org.fortiss.tooling.base.ui.dnd;
 import org.eclipse.draw2d.geometry.Point;
 import org.eclipse.gef.EditPart;
 import org.fortiss.tooling.base.ui.editpart.RootEditPartBase;
-import org.fortiss.tooling.kernel.interfaces.ICompositionContext;
+import org.fortiss.tooling.kernel.interfaces.IElementCompositionContext;
 
 /**
  * Composition context for GEF edit parts initiated by a drop gesture. The
@@ -35,7 +35,7 @@ import org.fortiss.tooling.kernel.interfaces.ICompositionContext;
  * @version $Rev$
  * @ConQAT.Rating YELLOW Hash: F41CA022ECFE85D93C254EFB2BE6D7BE
  */
-public class DropContext implements ICompositionContext {
+public class DropContext implements IElementCompositionContext {
 
 	/** Drop target edit part */
 	private final EditPart dropTarget;
diff --git a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/editor/TreeViewerEditorBase.java b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/editor/TreeViewerEditorBase.java
index 42e2924a0..be65a5100 100644
--- a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/editor/TreeViewerEditorBase.java
+++ b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/editor/TreeViewerEditorBase.java
@@ -37,7 +37,7 @@ import org.eclipse.swt.dnd.Transfer;
 import org.eclipse.swt.dnd.TransferData;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Menu;
-import org.fortiss.tooling.kernel.services.ICompositorService;
+import org.fortiss.tooling.kernel.services.IElementCompositorService;
 import org.fortiss.tooling.kernel.ui.base.EditorBase;
 import org.fortiss.tooling.kernel.ui.util.DragAndDropUtils;
 import org.fortiss.tooling.kernel.ui.util.EObjectSelectionUtils;
@@ -174,7 +174,7 @@ public abstract class TreeViewerEditorBase<T extends EObject> extends
 						.extractDroppedEObject(LocalSelectionTransfer
 								.getTransfer().getSelection());
 
-				return ICompositorService.INSTANCE.canCompose(
+				return IElementCompositorService.INSTANCE.canCompose(
 						(EObject) lastTarget, dropped, null);
 			}
 			return false;
@@ -186,12 +186,12 @@ public abstract class TreeViewerEditorBase<T extends EObject> extends
 			if (lastTarget instanceof EObject) {
 				final EObject dropped = DragAndDropUtils
 						.extractDroppedEObject(data);
-				if (ICompositorService.INSTANCE.canCompose(
+				if (IElementCompositorService.INSTANCE.canCompose(
 						(EObject) lastTarget, dropped, null)) {
 					TreeViewerEditorBase.this.executeCommand(new Runnable() {
 						@Override
 						public void run() {
-							ICompositorService.INSTANCE.compose(
+							IElementCompositorService.INSTANCE.compose(
 									(EObject) lastTarget, dropped, null);
 						}
 					});
diff --git a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/editpart/policy/LayoutEditPolicyBase.java b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/editpart/policy/LayoutEditPolicyBase.java
index 206405650..8f583273e 100644
--- a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/editpart/policy/LayoutEditPolicyBase.java
+++ b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/editpart/policy/LayoutEditPolicyBase.java
@@ -24,8 +24,8 @@ import org.eclipse.gef.commands.Command;
 import org.eclipse.gef.editpolicies.LayoutEditPolicy;
 import org.eclipse.gef.requests.CreateRequest;
 import org.fortiss.tooling.base.ui.dnd.DropContext;
-import org.fortiss.tooling.kernel.interfaces.ICompositionContext;
-import org.fortiss.tooling.kernel.services.ICompositorService;
+import org.fortiss.tooling.kernel.interfaces.IElementCompositionContext;
+import org.fortiss.tooling.kernel.services.IElementCompositorService;
 import org.fortiss.tooling.kernel.ui.util.DragAndDropUtils;
 
 /**
@@ -64,20 +64,20 @@ public abstract class LayoutEditPolicyBase extends LayoutEditPolicy {
 		}
 		final EObject model = (EObject) getHost().getModel();
 
-		final ICompositionContext context = new DropContext(getHost(), location);
+		final IElementCompositionContext context = new DropContext(getHost(), location);
 
 		final EObject dropped = DragAndDropUtils.extractDroppedEObject(request
 				.getNewObject());
 		return new Command() {
 			@Override
 			public boolean canExecute() {
-				return ICompositorService.INSTANCE.canCompose(model, dropped,
+				return IElementCompositorService.INSTANCE.canCompose(model, dropped,
 						context);
 			}
 
 			@Override
 			public void execute() {
-				ICompositorService.INSTANCE.compose(model, dropped, context);
+				IElementCompositorService.INSTANCE.compose(model, dropped, context);
 			}
 		};
 	}
diff --git a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/editpart/policy/RemoveEditPolicy.java b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/editpart/policy/RemoveEditPolicy.java
index 239c69335..3106bcb52 100644
--- a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/editpart/policy/RemoveEditPolicy.java
+++ b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/editpart/policy/RemoveEditPolicy.java
@@ -19,17 +19,18 @@ package org.fortiss.tooling.base.ui.editpart.policy;
 
 import java.util.List;
 
+import org.eclipse.emf.ecore.EObject;
 import org.eclipse.gef.EditPart;
 import org.eclipse.gef.commands.Command;
 import org.eclipse.gef.commands.CompoundCommand;
 import org.eclipse.gef.commands.UnexecutableCommand;
 import org.eclipse.gef.editpolicies.ComponentEditPolicy;
 import org.eclipse.gef.requests.GroupRequest;
-import org.fortiss.tooling.kernel.model.IRemovable;
+import org.fortiss.tooling.kernel.services.IElementCompositorService;
 
 /**
- * An edit policy for {@link IRemovable}. This is not a singleton, as the
- * editpart will call various setters on its instance.
+ * An edit policy for removing model elements. Delete commands are redirected to
+ * {@link IElementCompositorService} to determine the model change.
  * 
  * @author hoelzl
  * @author $Author$
@@ -44,10 +45,14 @@ public final class RemoveEditPolicy extends ComponentEditPolicy {
 	public Command createDeleteCommand(GroupRequest request) {
 		CompoundCommand compound = new CompoundCommand();
 		for (EditPart ep : (List<EditPart>) request.getEditParts()) {
-			if (!(ep.getModel() instanceof IRemovable)) {
+			EObject model = (EObject) ep.getModel();
+			boolean canDelete = IElementCompositorService.INSTANCE
+					.canDecompose(model.eContainer(), model, null);
+			if (canDelete) {
+				compound.add(new RemoveCommand(model));
+			} else {
 				return UnexecutableCommand.INSTANCE;
 			}
-			compound.add(new RemoveCommand((IRemovable) ep.getModel()));
 		}
 		return compound;
 	}
@@ -56,23 +61,25 @@ public final class RemoveEditPolicy extends ComponentEditPolicy {
 	public static class RemoveCommand extends Command {
 
 		/** The entity to be removed. */
-		private final IRemovable toRemove;
+		private final EObject toRemove;
 
-		/** Creates a command to remove a subcomponent. */
-		public RemoveCommand(IRemovable toRemove) {
+		/** Creates a command to remove an element. */
+		public RemoveCommand(EObject toRemove) {
 			this.toRemove = toRemove;
 		}
 
 		/** {@inheritDoc} */
 		@Override
 		public void execute() {
-			toRemove.remove();
+			IElementCompositorService.INSTANCE.decompose(toRemove.eContainer(),
+					toRemove, null);
 		}
 
 		/** {@inheritDoc} */
 		@Override
 		public boolean canExecute() {
-			return toRemove.canRemove();
+			return IElementCompositorService.INSTANCE.canDecompose(
+					toRemove.eContainer(), toRemove, null);
 		}
 	}
 }
diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/ActionService.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/ActionService.java
index 0580ef230..bc911d6ba 100644
--- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/ActionService.java
+++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/ActionService.java
@@ -21,7 +21,6 @@ import java.util.EventObject;
 
 import org.eclipse.emf.common.command.CommandStackListener;
 import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.util.EcoreUtil;
 import org.eclipse.jface.action.IMenuManager;
 import org.eclipse.ui.IActionBars;
 import org.eclipse.ui.ISharedImages;
@@ -29,8 +28,8 @@ import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.actions.ActionFactory;
 import org.fortiss.tooling.kernel.interfaces.ITopLevelElementChangeListener;
 import org.fortiss.tooling.kernel.interfaces.ITopLevelElementContext;
-import org.fortiss.tooling.kernel.model.IRemovable;
 import org.fortiss.tooling.kernel.services.ICommandStackService;
+import org.fortiss.tooling.kernel.services.IElementCompositorService;
 import org.fortiss.tooling.kernel.services.IPersistencyService;
 import org.fortiss.tooling.kernel.ui.base.EObjectActionBase;
 import org.fortiss.tooling.kernel.ui.services.IActionService;
@@ -90,11 +89,9 @@ public class ActionService implements IActionService,
 					new Runnable() {
 						@Override
 						public void run() {
-							if (selectedObject instanceof IRemovable) {
-								((IRemovable) selectedObject).remove();
-							} else {
-								EcoreUtil.delete(selectedObject, true);
-							}
+							IElementCompositorService.INSTANCE.decompose(
+									selectedObject.eContainer(),
+									selectedObject, null);
 						}
 					});
 		}
@@ -158,10 +155,10 @@ public class ActionService implements IActionService,
 		globalRedoAction.setEnabled(ICommandStackService.INSTANCE
 				.canRedo(target));
 
-		boolean canDelete = (target instanceof IRemovable)
-				&& ((IRemovable) target).canRemove();
+		boolean canDelete = IElementCompositorService.INSTANCE.canDecompose(
+				target.eContainer(), target, null);
 		canDelete = canDelete
-				|| !IPersistencyService.INSTANCE.isTopLevelElement(target);
+				&& !IPersistencyService.INSTANCE.isTopLevelElement(target);
 		globalDeleteAction.setTarget(target);
 		globalDeleteAction.setEnabled(canDelete);
 	}
diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/NewMenu.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/NewMenu.java
index 44615b738..66b1f956a 100644
--- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/NewMenu.java
+++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/NewMenu.java
@@ -24,7 +24,7 @@ import org.eclipse.jface.action.IContributionItem;
 import org.eclipse.ui.actions.CompoundContributionItem;
 import org.fortiss.tooling.kernel.interfaces.IPrototypeProvider;
 import org.fortiss.tooling.kernel.services.ICommandStackService;
-import org.fortiss.tooling.kernel.services.ICompositorService;
+import org.fortiss.tooling.kernel.services.IElementCompositorService;
 import org.fortiss.tooling.kernel.services.IPrototypeService;
 import org.fortiss.tooling.kernel.services.IPrototypeService.Prototype;
 import org.fortiss.tooling.kernel.ui.services.IEditorService;
@@ -105,7 +105,7 @@ public class NewMenu extends CompoundContributionItem {
 						@Override
 						public void run() {
 							EObject newObject = prototype.getPrototypeCopy();
-							if (ICompositorService.INSTANCE.compose(container,
+							if (IElementCompositorService.INSTANCE.compose(container,
 									newObject, null)) {
 								IEditorService.INSTANCE.openInEditor(newObject);
 							}
@@ -119,7 +119,7 @@ public class NewMenu extends CompoundContributionItem {
 		 */
 		public boolean prepare(EObject container) {
 			this.container = container;
-			return ICompositorService.INSTANCE.canCompose(container,
+			return IElementCompositorService.INSTANCE.canCompose(container,
 					prototype.getPrototype(), null);
 		}
 
diff --git a/org.fortiss.tooling.kernel/trunk/model/kernel.ecore b/org.fortiss.tooling.kernel/trunk/model/kernel.ecore
index 520d37b47..d1afbf198 100644
--- a/org.fortiss.tooling.kernel/trunk/model/kernel.ecore
+++ b/org.fortiss.tooling.kernel/trunk/model/kernel.ecore
@@ -41,21 +41,4 @@
       </eAnnotations>
     </eStructuralFeatures>
   </eClassifiers>
-  <eClassifiers xsi:type="ecore:EClass" name="IRemovable" abstract="true" interface="true">
-    <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
-      <details key="documentation" value="Model elements implementing this interface can provide a custom remove operatoin."/>
-    </eAnnotations>
-    <eOperations name="canRemove" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean">
-      <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
-        <details key="documentation" value="Returns whether the current model element can be removed."/>
-        <details key="body" value="return IRemovableStaticImpl.canRemove(this);"/>
-      </eAnnotations>
-    </eOperations>
-    <eOperations name="remove" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean">
-      <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
-        <details key="documentation" value="Removes the current model element from its parent."/>
-        <details key="body" value="return IRemovableStaticImpl.remove(this);"/>
-      </eAnnotations>
-    </eOperations>
-  </eClassifiers>
 </ecore:EPackage>
diff --git a/org.fortiss.tooling.kernel/trunk/plugin.xml b/org.fortiss.tooling.kernel/trunk/plugin.xml
index ec578c5ad..63eaaaa97 100644
--- a/org.fortiss.tooling.kernel/trunk/plugin.xml
+++ b/org.fortiss.tooling.kernel/trunk/plugin.xml
@@ -6,7 +6,7 @@
    <extension-point id="modelStorageProvider" name="Model Storage Provider" schema="schema/modelStorageProvider.exsd"/>
    <extension-point id="modelConstraintChecker" name="Model Constraint Checker" schema="schema/modelConstraintChecker.exsd"/>
    <extension-point id="eclipseResourceStorageLocationProvider" name="Eclipse Resource Storage Location Provider" schema="schema/eclipseResourceStorageLocationProvider.exsd"/>
-   <extension-point id="modelElementConnectionCompositor" name="Model Element Connection Compositor" schema="schema/modelElementConnectionCompositor.exsd"/>
+   <extension-point id="modelConnectionCompositor" name="Model Connection Compositor" schema="schema/modelConnectionCompositor.exsd"/>
    <extension
          point="org.eclipse.emf.ecore.generated_package">
       <package
diff --git a/org.fortiss.tooling.kernel/trunk/schema/modelElementConnectionCompositor.exsd b/org.fortiss.tooling.kernel/trunk/schema/modelConnectionCompositor.exsd
similarity index 100%
rename from org.fortiss.tooling.kernel/trunk/schema/modelElementConnectionCompositor.exsd
rename to org.fortiss.tooling.kernel/trunk/schema/modelConnectionCompositor.exsd
diff --git a/org.fortiss.tooling.kernel/trunk/schema/modelElementCompositor.exsd b/org.fortiss.tooling.kernel/trunk/schema/modelElementCompositor.exsd
index eb349afe2..24e2730b8 100644
--- a/org.fortiss.tooling.kernel/trunk/schema/modelElementCompositor.exsd
+++ b/org.fortiss.tooling.kernel/trunk/schema/modelElementCompositor.exsd
@@ -60,7 +60,7 @@
                   The model element compositor.
                </documentation>
                <appinfo>
-                  <meta.attribute kind="java" basedOn=":org.fortiss.tooling.kernel.interfaces.ICompositor"/>
+                  <meta.attribute kind="java" basedOn=":org.fortiss.tooling.kernel.interfaces.IElementCompositor"/>
                </appinfo>
             </annotation>
          </attribute>
diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/interfaces/ICompositionContext.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/interfaces/IElementCompositionContext.java
similarity index 89%
rename from org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/interfaces/ICompositionContext.java
rename to org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/interfaces/IElementCompositionContext.java
index 18becd197..ae63f5ba2 100644
--- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/interfaces/ICompositionContext.java
+++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/interfaces/IElementCompositionContext.java
@@ -19,8 +19,8 @@ $Id$
 package org.fortiss.tooling.kernel.interfaces;
 
 /**
- * An {@link ICompositionContext} provides additional information like drop
- * point positions to an {@link ICompositor}.
+ * An {@link IElementCompositionContext} provides additional information like drop
+ * point positions to an {@link IElementCompositor}.
  * 
  * @FloH: what is a "drop point" position?
  * 
@@ -29,6 +29,6 @@ package org.fortiss.tooling.kernel.interfaces;
  * @version $Rev$
  * @ConQAT.Rating RED Hash: D85BD49FE3F70C2C4AF5B5B9250C0863
  */
-public interface ICompositionContext {
+public interface IElementCompositionContext {
 	// this is just a marker interface
 }
diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/interfaces/ICompositor.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/interfaces/IElementCompositor.java
similarity index 73%
rename from org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/interfaces/ICompositor.java
rename to org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/interfaces/IElementCompositor.java
index 09000d1cf..37d4cef21 100644
--- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/interfaces/ICompositor.java
+++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/interfaces/IElementCompositor.java
@@ -21,23 +21,30 @@ import org.eclipse.emf.ecore.EObject;
 import org.fortiss.tooling.kernel.services.IPrototypeService.Prototype;
 
 /**
- * Interface for compositors, i.e. classes which know how to compose
- * {@link EObject}s.
- * 
- * @TODO: rename to "ElementCompositor"
+ * Interface for compositors, i.e. classes which know how to compose and
+ * decompose {@link EObject}s.
  * 
  * @author hoelzl
  * @author $Author$
  * @version $Rev$
  * @ConQAT.Rating YELLOW Hash: 75F650B0058B591BE903CC45C0AB9876
  */
-public interface ICompositor<T extends EObject> extends IEObjectAware<T> {
+public interface IElementCompositor<T extends EObject> extends IEObjectAware<T> {
 	/**
 	 * Returns whether the given container may include the given contained
 	 * object.
 	 */
 	boolean canCompose(T container, EObject contained,
-			ICompositionContext context);
+			IElementCompositionContext context);
+
+	/**
+	 * Returns whether this compositor is able to compose the given prototype.
+	 * While {@link #canCompose(EObject, EObject, IElementCompositionContext)}
+	 * considers a concrete composition between the container and contained
+	 * element, this method returns this compositor's ability to accept the
+	 * given prototype in general.
+	 */
+	boolean canComposePrototype(Prototype prototype);
 
 	/**
 	 * Asks the compositor to insert the contained object into the container.
@@ -45,14 +52,21 @@ public interface ICompositor<T extends EObject> extends IEObjectAware<T> {
 	 * This method returns a boolean, since user-interaction during compose
 	 * might cancel the command.
 	 */
-	boolean compose(T container, EObject contained, ICompositionContext context);
+	boolean compose(T container, EObject contained,
+			IElementCompositionContext context);
 
 	/**
-	 * Returns whether this compositor is able to compose the given prototype.
-	 * While {@link #canCompose(EObject, EObject, ICompositionContext)}
-	 * considers a concrete composition between the container and contained
-	 * element, this method returns this compositor's ability to accept the
-	 * given prototype in general.
+	 * Returns whether the given contained element may be removed from the given
+	 * container element.
 	 */
-	boolean canComposePrototype(Prototype prototype);
+	boolean canDecompose(T container, EObject contained,
+			IElementCompositionContext context);
+
+	/**
+	 * Asks the compositor to remove the contained object from the container.
+	 * This method returns a boolean, since user-interaction during compose
+	 * might cancel the command.
+	 */
+	boolean decompose(T container, EObject contained,
+			IElementCompositionContext context);
 }
diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/CompositorService.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/ElementCompositorService.java
similarity index 60%
rename from org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/CompositorService.java
rename to org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/ElementCompositorService.java
index 25378ba5b..770e6e9c1 100644
--- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/CompositorService.java
+++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/ElementCompositorService.java
@@ -21,22 +21,22 @@ import java.util.List;
 
 import org.eclipse.emf.ecore.EObject;
 import org.fortiss.tooling.kernel.base.EObjectAwareServiceBase;
-import org.fortiss.tooling.kernel.interfaces.ICompositionContext;
-import org.fortiss.tooling.kernel.interfaces.ICompositor;
-import org.fortiss.tooling.kernel.services.ICompositorService;
+import org.fortiss.tooling.kernel.interfaces.IElementCompositionContext;
+import org.fortiss.tooling.kernel.interfaces.IElementCompositor;
+import org.fortiss.tooling.kernel.services.IElementCompositorService;
 import org.fortiss.tooling.kernel.services.IPrototypeService.Prototype;
 
 /**
- * This class implements the {@link ICompositorService} interface.
+ * This class implements the {@link IElementCompositorService} interface.
  * 
  * @author hoelzl
  * @author $Author$
  * @version $Rev$
  * @ConQAT.Rating YELLOW Hash: 1AB8E5D4937CE2C77649035548CA11DF
  */
-public final class CompositorService extends
-		EObjectAwareServiceBase<ICompositor<EObject>> implements
-		ICompositorService {
+public final class ElementCompositorService extends
+		EObjectAwareServiceBase<IElementCompositor<EObject>> implements
+		IElementCompositorService {
 
 	/** The compositor extension point ID. */
 	private static final String EXTENSION_POINT_NAME = "org.fortiss.tooling.kernel.modelElementCompositor";
@@ -50,27 +50,27 @@ public final class CompositorService extends
 	/** {@inheritDoc} */
 	@Override
 	public boolean canCompose(EObject container, EObject element,
-			ICompositionContext context) {
-		return findWorkingCompositor(container, element, context) != null;
+			IElementCompositionContext context) {
+		return findWorkingCompositor(container, element, context, false) != null;
 	}
 
 	/** {@inheritDoc} */
 	@Override
 	public boolean compose(EObject container, EObject element,
-			ICompositionContext context) {
-		return findWorkingCompositor(container, element, context).compose(
-				container, element, context);
+			IElementCompositionContext context) {
+		return findWorkingCompositor(container, element, context, false)
+				.compose(container, element, context);
 	}
 
 	/** {@inheritDoc} */
 	@Override
 	public boolean canComposePrototype(Class<? extends EObject> containerClass,
 			Prototype prototype) {
-		List<ICompositor<EObject>> list = getRegisteredHandlers(containerClass);
+		List<IElementCompositor<EObject>> list = getRegisteredHandlers(containerClass);
 		if (list == null) {
 			return false;
 		}
-		for (ICompositor<EObject> compositor : list) {
+		for (IElementCompositor<EObject> compositor : list) {
 			if (compositor.canComposePrototype(prototype)) {
 				return true;
 			}
@@ -78,19 +78,39 @@ public final class CompositorService extends
 		return false;
 	}
 
+	/** {@inheritDoc} */
+	@Override
+	public boolean canDecompose(EObject container, EObject contained,
+			IElementCompositionContext context) {
+		return findWorkingCompositor(container, contained, context, true) != null;
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public boolean decompose(EObject container, EObject contained,
+			IElementCompositionContext context) {
+		return findWorkingCompositor(container, contained, context, true)
+				.decompose(container, contained, context);
+	}
+
 	/**
-	 * Returns the first {@link ICompositor} which can compose the given element
-	 * (or <code>null</code>).
+	 * Returns the first {@link IElementCompositor} which can compose the given
+	 * element (or <code>null</code>).
 	 */
-	private ICompositor<EObject> findWorkingCompositor(EObject container,
-			EObject contained, ICompositionContext context) {
-		List<ICompositor<EObject>> list = getRegisteredHandlers(container
+	private IElementCompositor<EObject> findWorkingCompositor(
+			EObject container, EObject contained,
+			IElementCompositionContext context, boolean decompose) {
+		List<IElementCompositor<EObject>> list = getRegisteredHandlers(container
 				.getClass());
 		if (list == null) {
 			return null;
 		}
-		for (ICompositor<EObject> compositor : list) {
-			if (compositor.canCompose(container, contained, context)) {
+		for (IElementCompositor<EObject> compositor : list) {
+			if (!decompose
+					&& compositor.canCompose(container, contained, context)) {
+				return compositor;
+			} else if (decompose
+					&& compositor.canDecompose(container, contained, context)) {
 				return compositor;
 			}
 		}
diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/PrototypeService.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/PrototypeService.java
index 0e7daf3e7..1b6cba833 100644
--- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/PrototypeService.java
+++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/PrototypeService.java
@@ -27,7 +27,7 @@ import org.eclipse.core.runtime.IConfigurationElement;
 import org.eclipse.emf.ecore.EObject;
 import org.fortiss.tooling.kernel.ToolingKernelActivator;
 import org.fortiss.tooling.kernel.interfaces.IPrototypeProvider;
-import org.fortiss.tooling.kernel.services.ICompositorService;
+import org.fortiss.tooling.kernel.services.IElementCompositorService;
 import org.fortiss.tooling.kernel.services.IPrototypeService;
 import org.fortiss.tooling.kernel.util.ExtensionPointUtils;
 import org.fortiss.tooling.kernel.util.LoggingUtils;
@@ -98,7 +98,7 @@ public class PrototypeService implements IPrototypeService {
 			Class<? extends EObject> modelElementType) {
 		List<Prototype> result = new LinkedList<Prototype>();
 		for (Prototype prototype : getAllPrototypes()) {
-			if (ICompositorService.INSTANCE.canComposePrototype(
+			if (IElementCompositorService.INSTANCE.canComposePrototype(
 					modelElementType, prototype)) {
 				result.add(prototype);
 			}
diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/model/impl/IRemovableStaticImpl.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/model/impl/IRemovableStaticImpl.java
deleted file mode 100644
index e9c696215..000000000
--- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/model/impl/IRemovableStaticImpl.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*--------------------------------------------------------------------------+
-$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.kernel.model.impl;
-
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.fortiss.tooling.kernel.model.IRemovable;
-
-/**
- * Static implementations for {@link IRemovable}.
- * 
- * @author hoelzl
- * @author $Author$
- * @version $Rev$
- * @ConQAT.Rating YELLOW Hash: 5B3BFFF46645CA9E7A150552528C27B9
- */
-public final class IRemovableStaticImpl {
-
-	/** Constructor. */
-	private IRemovableStaticImpl() {
-		// class not intended to be instantiated.
-	}
-
-	/** Returns true, if a parent exists. */
-	public static boolean canRemove(IRemovable element) {
-		return element.eContainer() != null;
-	}
-
-	/**
-	 * Removes element from its parent container and deletes all references to
-	 * it and its children.
-	 */
-	public static boolean remove(IRemovable element) {
-		EcoreUtil.delete(element, true);
-		return true;
-	}
-}
diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/model/impl/package.html b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/model/impl/package.html
deleted file mode 100644
index 3b352be40..000000000
--- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/model/impl/package.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<!--  
-  $Id$
-  @version $Rev$
-  @ConQAT.Rating YELLOW Hash: BB6887C456481D9CAC1639E1D772BB0F
--->
-<body>
-Static implementations of EMF operations defined in the <code>kernel.ecore</code> meta-model.
-</body>
diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/services/ICompositorService.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/services/IElementCompositorService.java
similarity index 63%
rename from org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/services/ICompositorService.java
rename to org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/services/IElementCompositorService.java
index 09c0087e4..7b6989390 100644
--- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/services/ICompositorService.java
+++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/services/IElementCompositorService.java
@@ -18,46 +18,60 @@ $Id$
 package org.fortiss.tooling.kernel.services;
 
 import org.eclipse.emf.ecore.EObject;
-import org.fortiss.tooling.kernel.interfaces.ICompositionContext;
-import org.fortiss.tooling.kernel.interfaces.ICompositor;
-import org.fortiss.tooling.kernel.internal.CompositorService;
+import org.fortiss.tooling.kernel.interfaces.IElementCompositionContext;
+import org.fortiss.tooling.kernel.interfaces.IElementCompositor;
+import org.fortiss.tooling.kernel.internal.ElementCompositorService;
 import org.fortiss.tooling.kernel.services.IPrototypeService.Prototype;
 
 /**
- * The compositor service provides registration and access to model element
- * compositors.
+ * The element compositor service provides registration and access to model
+ * element compositors.
  * 
  * @author hoelzl
  * @author $Author$
  * @version $Rev$
  * @ConQAT.Rating YELLOW Hash: 4F6FF89C40A2BCE2A0310068028A0567
  */
-public interface ICompositorService {
+public interface IElementCompositorService {
 
 	/** Returns the singleton instance of the service. */
-	public static final ICompositorService INSTANCE = new CompositorService();
+	public static final IElementCompositorService INSTANCE = new ElementCompositorService();
 
 	/**
 	 * Determines if there is a compositor that allows the composition of the
 	 * container and the prototype {@link EObject}.
 	 */
 	boolean canCompose(EObject container, EObject element,
-			ICompositionContext context);
+			IElementCompositionContext context);
 
 	/**
 	 * Composes the container and the element. Since this operation may be
 	 * canceled by the user, it returns a boolean value.
 	 */
 	boolean compose(EObject container, EObject element,
-			ICompositionContext context);
+			IElementCompositionContext context);
 
 	/**
 	 * Returns whether given prototype can be composed with containers of the
-	 * given class. This method searches for an {@link ICompositor} that is able
-	 * to handle the composition in general.
+	 * given class. This method searches for an {@link IElementCompositor} that
+	 * is able to handle the composition in general.
 	 * 
-	 * @see ICompositor#canComposePrototype(org.fortiss.tooling.kernel.services.IPrototypeService.Prototype)
+	 * @see IElementCompositor#canComposePrototype(org.fortiss.tooling.kernel.services.IPrototypeService.Prototype)
 	 */
 	boolean canComposePrototype(Class<? extends EObject> containerClass,
 			Prototype prototype);
+
+	/**
+	 * Determines if there is a compositor that allows the decomposition of the
+	 * container and the contained {@link EObject}.
+	 */
+	boolean canDecompose(EObject container, EObject contained,
+			IElementCompositionContext context);
+
+	/**
+	 * Decomposes the container and the element. Since this operation may be
+	 * canceled by the user, it returns a boolean value.
+	 */
+	boolean decompose(EObject container, EObject contained,
+			IElementCompositionContext context);
 }
-- 
GitLab