ASSIGNED - bug 336488: move DiagramEditor base classes to public API 
https://bugs.eclipse.org/bugs/show_bug.cgi?id=336488

Signed-off-by: tkaiser <tim.kaiser@sap.com>
diff --git a/examples/org.eclipse.graphiti.examples.common/src/org/eclipse/graphiti/examples/common/FileService.java b/examples/org.eclipse.graphiti.examples.common/src/org/eclipse/graphiti/examples/common/FileService.java
index 99858ea..de0bdbf 100644
--- a/examples/org.eclipse.graphiti.examples.common/src/org/eclipse/graphiti/examples/common/FileService.java
+++ b/examples/org.eclipse.graphiti.examples.common/src/org/eclipse/graphiti/examples/common/FileService.java
@@ -40,14 +40,14 @@
 import org.eclipse.emf.transaction.TransactionalEditingDomain;
 import org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl;
 import org.eclipse.graphiti.mm.pictograms.Diagram;
-import org.eclipse.graphiti.ui.editor.DiagramEditorFactory;
+import org.eclipse.graphiti.ui.internal.services.GraphitiUiInternal;
 
 public class FileService {
 
 	public static TransactionalEditingDomain createEmfFileForDiagram(URI diagramResourceUri, final Diagram diagram) {
 
 		// Create a resource set and EditingDomain
-		final TransactionalEditingDomain editingDomain = DiagramEditorFactory.createResourceSetAndEditingDomain();
+		final TransactionalEditingDomain editingDomain = GraphitiUiInternal.getEmfService().createResourceSetAndEditingDomain();
 		final ResourceSet resourceSet = editingDomain.getResourceSet();
 		// Create a resource for this file.
 		final Resource resource = resourceSet.createResource(diagramResourceUri);
diff --git a/plugins/org.eclipse.graphiti.ui/.settings/.api_filters b/plugins/org.eclipse.graphiti.ui/.settings/.api_filters
index dee1674..c5e1bcc 100644
--- a/plugins/org.eclipse.graphiti.ui/.settings/.api_filters
+++ b/plugins/org.eclipse.graphiti.ui/.settings/.api_filters
@@ -1,13 +1,37 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>

 <component id="org.eclipse.graphiti.ui" version="2">

-    <resource path="src/org/eclipse/graphiti/ui/editor/DiagramEditorFactory.java" type="org.eclipse.graphiti.ui.editor.DiagramEditorFactory">

-        <filter comment="DiagramEditorMatchingStrategy moved to own file" id="338886760">

+    <resource path="META-INF/MANIFEST.MF">

+        <filter id="923795461">

             <message_arguments>

-                <message_argument value="org.eclipse.graphiti.ui.editor.DiagramEditorFactory.DiagramEditorMatchingStrategy"/>

+                <message_argument value="0.9.0"/>

+                <message_argument value="0.8.0"/>

+            </message_arguments>

+        </filter>

+    </resource>

+    <resource path="META-INF/MANIFEST.MF" type="org.eclipse.graphiti.ui.editor.DiagramEditorFactory">

+        <filter id="305324134">

+            <message_arguments>

+                <message_argument value="org.eclipse.graphiti.ui.editor.DiagramEditorFactory"/>

                 <message_argument value="org.eclipse.graphiti.ui_0.9.0"/>

             </message_arguments>

         </filter>

     </resource>

+    <resource path="src/org/eclipse/graphiti/ui/editor/DiagramEditor.java" type="org.eclipse.graphiti.ui.editor.DiagramEditor">

+        <filter id="576720909">

+            <message_arguments>

+                <message_argument value="DiagramEditorInternal"/>

+                <message_argument value="DiagramEditor"/>

+            </message_arguments>

+        </filter>

+    </resource>

+    <resource path="src/org/eclipse/graphiti/ui/editor/DiagramEditorContextMenuProvider.java" type="org.eclipse.graphiti.ui.editor.DiagramEditorContextMenuProvider">

+        <filter id="338722907">

+            <message_arguments>

+                <message_argument value="org.eclipse.graphiti.ui.editor.DiagramEditorContextMenuProvider"/>

+                <message_argument value="DiagramEditorContextMenuProvider(EditPartViewer, ActionRegistry, IConfigurationProvider)"/>

+            </message_arguments>

+        </filter>

+    </resource>

     <resource path="src/org/eclipse/graphiti/ui/features/AbstractCopyFeature.java" type="org.eclipse.graphiti.ui.features.AbstractCopyFeature">

         <filter id="574619656">

             <message_arguments>

diff --git a/plugins/org.eclipse.graphiti.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.graphiti.ui/META-INF/MANIFEST.MF
index 8012bbc..74d3964 100644
--- a/plugins/org.eclipse.graphiti.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.graphiti.ui/META-INF/MANIFEST.MF
@@ -34,7 +34,7 @@
  org.eclipse.graphiti.ui.internal.platform;version="0.9.0";x-internal:=true,
  org.eclipse.graphiti.ui.internal.policy;version="0.9.0";x-friends:="org.eclipse.graphiti.bot.tests",
  org.eclipse.graphiti.ui.internal.requests;version="0.9.0";x-friends:="org.eclipse.graphiti.ui.tests",
- org.eclipse.graphiti.ui.internal.services;version="0.9.0";x-friends:="org.eclipse.graphiti.bot.tests, org.eclipse.graphiti.export.batik",
+ org.eclipse.graphiti.ui.internal.services;version="0.9.0";x-friends:="org.eclipse.graphiti.bot.tests,org.eclipse.graphiti.export.batik",
  org.eclipse.graphiti.ui.internal.services.impl;version="0.9.0";x-internal:=true,
  org.eclipse.graphiti.ui.internal.util;version="0.9.0";x-friends:="org.eclipse.graphiti.ui.tests",
  org.eclipse.graphiti.ui.internal.util.clipboard;version="0.9.0";x-friends:="org.eclipse.graphiti.bot.tests",
diff --git a/plugins/org.eclipse.graphiti.ui/plugin.properties b/plugins/org.eclipse.graphiti.ui/plugin.properties
index 99e76ef..bab650b 100644
--- a/plugins/org.eclipse.graphiti.ui/plugin.properties
+++ b/plugins/org.eclipse.graphiti.ui/plugin.properties
@@ -28,7 +28,7 @@
 _extension_point_diagram_types = Diagram Types
 _extension_point_diagram_exporter = Diagram Exporter
 
-_diagram_editor_factory = DiagramEditorFactory
+_diagram_editor_input_factory = DiagramEditorInputFactory
 
 _key_binding_category = Edit
 _command_name_update = Update
diff --git a/plugins/org.eclipse.graphiti.ui/plugin.xml b/plugins/org.eclipse.graphiti.ui/plugin.xml
index 4e57cb7..82bd6da 100644
--- a/plugins/org.eclipse.graphiti.ui/plugin.xml
+++ b/plugins/org.eclipse.graphiti.ui/plugin.xml
Binary files differ
diff --git a/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/editor/DiagramEditorContextMenuProvider.java b/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/editor/DiagramEditorContextMenuProvider.java
index 3b52326..5b41fdb 100644
--- a/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/editor/DiagramEditorContextMenuProvider.java
+++ b/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/editor/DiagramEditorContextMenuProvider.java
@@ -23,6 +23,7 @@
 import org.eclipse.gef.ui.actions.ActionRegistry;
 import org.eclipse.gef.ui.actions.GEFActionConstants;
 import org.eclipse.graphiti.datatypes.ILocation;
+import org.eclipse.graphiti.dt.IDiagramTypeProvider;
 import org.eclipse.graphiti.features.IFeature;
 import org.eclipse.graphiti.features.IFeatureProvider;
 import org.eclipse.graphiti.features.IPrintFeature;
@@ -45,7 +46,6 @@
 import org.eclipse.graphiti.ui.internal.action.RemoveAction;
 import org.eclipse.graphiti.ui.internal.action.SaveImageAction;
 import org.eclipse.graphiti.ui.internal.action.UpdateAction;
-import org.eclipse.graphiti.ui.internal.config.IConfigurationProvider;
 import org.eclipse.graphiti.ui.internal.editor.DiagramEditorInternal;
 import org.eclipse.graphiti.ui.internal.feature.DebugFeature;
 import org.eclipse.graphiti.ui.services.GraphitiUi;
@@ -71,7 +71,7 @@
 
 	private final ActionRegistry actionRegistry;
 
-	private final IConfigurationProvider configurationProvider;
+	private final IDiagramTypeProvider diagramTypeProvider;
 
 	/**
 	 * Creates a new DiagramEditorContextMenuProvider.
@@ -84,17 +84,18 @@
 	 *            to the menu-items.
 	 * @param configurationProvider
 	 *            the configuration provider
+	 * @since 0.9
 	 */
-	public DiagramEditorContextMenuProvider(EditPartViewer viewer, ActionRegistry registry, IConfigurationProvider configurationProvider) {
+	public DiagramEditorContextMenuProvider(EditPartViewer viewer, ActionRegistry registry, IDiagramTypeProvider diagramTypeProvider) {
 		super(viewer);
 		if (registry == null) {
 			throw new IllegalArgumentException("Argument registry must not be null"); //$NON-NLS-1$
 		}
 		this.actionRegistry = registry;
-		if (configurationProvider == null) {
+		if (diagramTypeProvider == null) {
 			throw new IllegalArgumentException("Argument configurationProvider must not be null"); //$NON-NLS-1$
 		}
-		this.configurationProvider = configurationProvider;
+		this.diagramTypeProvider = diagramTypeProvider;
 	}
 
 	/**
@@ -156,7 +157,7 @@
 	 *            the manager
 	 */
 	protected void addDefaultMenuGroupPrint(IMenuManager manager) {
-		IFeatureProvider fp = getConfigurationProvider().getDiagramTypeProvider().getFeatureProvider();
+		IFeatureProvider fp = getDiagramTypeProvider().getFeatureProvider();
 		if (fp != null) {
 			IPrintFeature pf = fp.getPrintFeature();
 
@@ -186,12 +187,12 @@
 			extendCustomContext(pes[0], (CustomContext) context);
 		}
 
-		IToolBehaviorProvider tb = getConfigurationProvider().getDiagramTypeProvider().getCurrentToolBehaviorProvider();
+		IToolBehaviorProvider tb = getDiagramTypeProvider().getCurrentToolBehaviorProvider();
 
 		IContextMenuEntry[] contextMenuEntries = tb.getContextMenu(context);
 
 		if (GFPreferences.getInstance().areDebugActionsActive()) {
-			IFeatureProvider fp = getConfigurationProvider().getFeatureProvider();
+			IFeatureProvider fp = getDiagramTypeProvider().getFeatureProvider();
 			ContextMenuEntry debugEntry = new ContextMenuEntry(null, context);
 			debugEntry.setText("Debug"); //$NON-NLS-1$
 			debugEntry.setSubmenu(true);
@@ -397,11 +398,11 @@
 		return ret;
 	}
 
-	private IConfigurationProvider getConfigurationProvider() {
-		return this.configurationProvider;
+	private IDiagramTypeProvider getDiagramTypeProvider() {
+		return this.diagramTypeProvider;
 	}
 
 	private DiagramEditorInternal getEditor() {
-		return getConfigurationProvider().getDiagramEditor();
+		return (DiagramEditorInternal) getDiagramTypeProvider().getDiagramEditor();
 	}
 }
\ No newline at end of file
diff --git a/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/editor/DiagramEditorFactory.java b/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/editor/DiagramEditorFactory.java
deleted file mode 100644
index 1919feb..0000000
--- a/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/editor/DiagramEditorFactory.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * <copyright>
- *
- * Copyright (c) 2005, 2010 SAP AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *    SAP AG - initial API, implementation and documentation
- *    mwenz - Bug 336075 - DiagramEditor accepts URIEditorInput
- *    mwenz - Bug 346932 - Navigation history broken
- *
- * </copyright>
- *
- *******************************************************************************/
-package org.eclipse.graphiti.ui.editor;
-
-import org.eclipse.core.commands.operations.DefaultOperationHistory;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.emf.common.ui.URIEditorInput;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl;
-import org.eclipse.emf.workspace.IWorkspaceCommandStack;
-import org.eclipse.emf.workspace.WorkspaceEditingDomainFactory;
-import org.eclipse.graphiti.ui.internal.editor.GFWorkspaceCommandStackImpl;
-import org.eclipse.graphiti.ui.internal.services.GraphitiUiInternal;
-import org.eclipse.graphiti.ui.internal.util.ReflectionUtil;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IElementFactory;
-import org.eclipse.ui.IMemento;
-
-/**
- * The Class DiagramEditorFactory.
- * 
- * A factory for creating DiagramEditorInternal objects.
- * 
- * @see {@link DiagramEditorFactory}
- * @see {@link DiagramEditorInput}
- */
-public class DiagramEditorFactory implements IElementFactory {
-
-
-	/**
-	 * Creates a new {@link DiagramEditorInput} with a self created
-	 * {@link TransactionalEditingDomain} in case the passed
-	 * {@link IEditorInput} is either a {@link IFileEditorInput} or a
-	 * {@link URIEditorInput}. It returns otherInput, if it is a
-	 * {@link DiagramEditorInput}. The created editor input object will care
-	 * about the disposal of the editing domain.
-	 * 
-	 * @param otherInput
-	 *            an {@link IEditorInput} editor input
-	 * @return a {@link DiagramEditorInput} editor input if the conversion is
-	 *         supported and succeeded, otherwise <code>null</code>.
-	 */
-	public DiagramEditorInput createEditorInput(IEditorInput otherInput) {
-		if (otherInput instanceof DiagramEditorInput) {
-			DiagramEditorInput input = (DiagramEditorInput) otherInput;
-			if (input.getAdapter(TransactionalEditingDomain.class) == null) {
-				// This might happen in case the editor input comes from the
-				// navigation history: there the editing domain is disposed and
-				// the diagram can no longer be resolved. Simply create a new
-				// transactional editing domain
-				// See Bug 346932
-				TransactionalEditingDomain ed = DiagramEditorFactory.createResourceSetAndEditingDomain();
-				input.setEditingDomain(ed);
-			}
-			return input;
-		}
-		IFile file = ReflectionUtil.getFile(otherInput);
-		if (file != null) {
-			final TransactionalEditingDomain domain = createResourceSetAndEditingDomain();
-			URI diagramFileUri = GraphitiUiInternal.getEmfService().getFileURI(file, domain.getResourceSet());
-			if (diagramFileUri != null) {
-				// the file's first base node has to be a diagram
-				URI diagramUri = GraphitiUiInternal.getEmfService().mapDiagramFileUriToDiagramUri(diagramFileUri);
-				return new DiagramEditorInput(diagramUri, domain, null, true);
-			}
-		}
-		if (otherInput instanceof URIEditorInput) {
-			final URIEditorInput uriInput = (URIEditorInput) otherInput;
-			final TransactionalEditingDomain domain = createResourceSetAndEditingDomain();
-			URI diagramFileUri = uriInput.getURI();
-			if (diagramFileUri != null) {
-				// the file's first base node has to be a diagram
-				URI diagramUri = GraphitiUiInternal.getEmfService().mapDiagramFileUriToDiagramUri(diagramFileUri);
-				return new DiagramEditorInput(diagramUri, domain, null, true);
-			}
-		}
-
-		return null;
-	}
-
-	@Override
-	public IAdaptable createElement(IMemento memento) {
-		// get diagram URI
-		final String diagramUriString = memento.getString(DiagramEditorInput.KEY_URI);
-		if (diagramUriString == null) {
-			return null;
-		}
-
-		// get diagram type provider id
-		final String providerID = memento.getString(DiagramEditorInput.KEY_PROVIDER_ID);
-		// TODO if (providerID == null)
-		// return null;
-
-		final TransactionalEditingDomain domain = createResourceSetAndEditingDomain();
-		return new DiagramEditorInput(diagramUriString, domain, providerID, true);
-	}
-
-	/**
-	 * Creates a {@link TransactionalEditingDomain} with a {@link ResourceSet}
-	 * resource set and a {@link IWorkspaceCommandStack} command stack.
-	 * 
-	 * @return a {@link TransactionalEditingDomain} editing domain
-	 */
-	public static TransactionalEditingDomain createResourceSetAndEditingDomain() {
-		final ResourceSet resourceSet = new ResourceSetImpl();
-		final IWorkspaceCommandStack workspaceCommandStack = new GFWorkspaceCommandStackImpl(new DefaultOperationHistory());
-
-		final TransactionalEditingDomainImpl editingDomain = new TransactionalEditingDomainImpl(new ComposedAdapterFactory(
-				ComposedAdapterFactory.Descriptor.Registry.INSTANCE), workspaceCommandStack, resourceSet);
-		WorkspaceEditingDomainFactory.INSTANCE.mapResourceSet(editingDomain);
-		return editingDomain;
-	}
-
-}
\ No newline at end of file
diff --git a/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/editor/DiagramEditorInput.java b/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/editor/DiagramEditorInput.java
index e2d3070..1a8e351 100644
--- a/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/editor/DiagramEditorInput.java
+++ b/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/editor/DiagramEditorInput.java
@@ -20,6 +20,7 @@
 
 import org.eclipse.core.resources.IFile;
 import org.eclipse.emf.common.command.CommandStack;
+import org.eclipse.emf.common.ui.URIEditorInput;
 import org.eclipse.emf.common.util.URI;
 import org.eclipse.emf.common.util.WrappedException;
 import org.eclipse.emf.ecore.EObject;
@@ -34,8 +35,11 @@
 import org.eclipse.graphiti.ui.internal.T;
 import org.eclipse.graphiti.ui.internal.editor.DiagramEditorInternal;
 import org.eclipse.graphiti.ui.internal.services.GraphitiUiInternal;
+import org.eclipse.graphiti.ui.internal.util.ReflectionUtil;
+import org.eclipse.graphiti.ui.services.GraphitiUi;
 import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IFileEditorInput;
 import org.eclipse.ui.IMemento;
 import org.eclipse.ui.IPersistableElement;
 
@@ -56,7 +60,7 @@
  * 
  * @see {@link IEditorInput}
  * @see {@link IPersistableElement}
- * @see {@link DiagramEditorFactory}
+ * @see {@link DiagramEditorInputFactory}
  * @see {@link DiagramEditor}
  */
 public class DiagramEditorInput implements IEditorInput, IPersistableElement {
@@ -350,7 +354,7 @@
 	 */
 	@Override
 	public String getFactoryId() {
-		return DiagramEditorFactory.class.getName();
+		return DiagramEditorInputFactory.class.getName();
 	}
 
 	public void dispose() {
@@ -822,4 +826,56 @@
 		this.uriName = fileString;
 		this.normalizedUri = createNormalizedUri();
 	}
+	
+	/**
+	 * Creates a new {@link DiagramEditorInput} with a self created
+	 * {@link TransactionalEditingDomain} in case the passed
+	 * {@link IEditorInput} is either a {@link IFileEditorInput} or a
+	 * {@link URIEditorInput}. It returns otherInput, if it is a
+	 * {@link DiagramEditorInput}. The created editor input object will care
+	 * about the disposal of the editing domain.
+	 * 
+	 * @param otherInput
+	 *            an {@link IEditorInput} editor input
+	 * @return a {@link DiagramEditorInput} editor input if the conversion is
+	 *         supported and succeeded, otherwise <code>null</code>.
+	 * @since 0.9
+	 */
+	public static DiagramEditorInput createEditorInput(IEditorInput otherInput) {
+		if (otherInput instanceof DiagramEditorInput) {
+			DiagramEditorInput input = (DiagramEditorInput) otherInput;
+			if (input.getAdapter(TransactionalEditingDomain.class) == null) {
+				// This might happen in case the editor input comes from the
+				// navigation history: there the editing domain is disposed and
+				// the diagram can no longer be resolved. Simply create a new
+				// transactional editing domain
+				// See Bug 346932
+				TransactionalEditingDomain ed = GraphitiUi.getEmfService().createResourceSetAndEditingDomain();
+				input.setEditingDomain(ed);
+			}
+			return input;
+		}
+		IFile file = ReflectionUtil.getFile(otherInput);
+		if (file != null) {
+			final TransactionalEditingDomain domain = GraphitiUi.getEmfService().createResourceSetAndEditingDomain();
+			URI diagramFileUri = GraphitiUiInternal.getEmfService().getFileURI(file, domain.getResourceSet());
+			if (diagramFileUri != null) {
+				// the file's first base node has to be a diagram
+				URI diagramUri = GraphitiUiInternal.getEmfService().mapDiagramFileUriToDiagramUri(diagramFileUri);
+				return new DiagramEditorInput(diagramUri, domain, null, true);
+			}
+		}
+		if (otherInput instanceof URIEditorInput) {
+			final URIEditorInput uriInput = (URIEditorInput) otherInput;
+			final TransactionalEditingDomain domain = GraphitiUi.getEmfService().createResourceSetAndEditingDomain();
+			URI diagramFileUri = uriInput.getURI();
+			if (diagramFileUri != null) {
+				// the file's first base node has to be a diagram
+				URI diagramUri = GraphitiUiInternal.getEmfService().mapDiagramFileUriToDiagramUri(diagramFileUri);
+				return new DiagramEditorInput(diagramUri, domain, null, true);
+			}
+		}
+
+		return null;
+	}
 }
\ No newline at end of file
diff --git a/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/editor/DiagramEditorInputFactory.java b/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/editor/DiagramEditorInputFactory.java
new file mode 100644
index 0000000..34e72cc
--- /dev/null
+++ b/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/editor/DiagramEditorInputFactory.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2005, 2010 SAP AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    SAP AG - initial API, implementation and documentation
+ *    mwenz - Bug 336075 - DiagramEditor accepts URIEditorInput
+ *    mwenz - Bug 346932 - Navigation history broken
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+package org.eclipse.graphiti.ui.editor;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.graphiti.ui.services.GraphitiUi;
+import org.eclipse.ui.IElementFactory;
+import org.eclipse.ui.IMemento;
+
+/**
+ * The Class DiagramEditorFactory.
+ * 
+ * A factory for creating DiagramEditorInput objects.
+ * 
+ * @see {@link DiagramEditorInputFactory}
+ * @see {@link DiagramEditorInput}
+ * @since 0.9 results from renaming DiagramEditorFactory
+ */
+public class DiagramEditorInputFactory implements IElementFactory {
+
+
+	@Override
+	public IAdaptable createElement(IMemento memento) {
+		// get diagram URI
+		final String diagramUriString = memento.getString(DiagramEditorInput.KEY_URI);
+		if (diagramUriString == null) {
+			return null;
+		}
+
+		// get diagram type provider id
+		final String providerID = memento.getString(DiagramEditorInput.KEY_PROVIDER_ID);
+		// TODO if (providerID == null)
+		// return null;
+
+		final TransactionalEditingDomain domain = GraphitiUi.getEmfService().createResourceSetAndEditingDomain();
+		return new DiagramEditorInput(diagramUriString, domain, providerID, true);
+	}
+
+}
\ No newline at end of file
diff --git a/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/features/AbstractDrillDownFeature.java b/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/features/AbstractDrillDownFeature.java
index a00485f..f5d3d70 100644
--- a/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/features/AbstractDrillDownFeature.java
+++ b/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/features/AbstractDrillDownFeature.java
@@ -31,7 +31,6 @@
 import org.eclipse.graphiti.mm.pictograms.PictogramElement;
 import org.eclipse.graphiti.platform.IPlatformImageConstants;
 import org.eclipse.graphiti.ui.editor.DiagramEditor;
-import org.eclipse.graphiti.ui.editor.DiagramEditorFactory;
 import org.eclipse.graphiti.ui.internal.services.GraphitiUiInternal;
 import org.eclipse.graphiti.ui.services.GraphitiUi;
 import org.eclipse.jface.viewers.IStructuredContentProvider;
@@ -245,7 +244,7 @@
 	}
 
 	protected TransactionalEditingDomain getTransActionalEditingDomainForNewDiagram() {
-		return DiagramEditorFactory.createResourceSetAndEditingDomain();
+		return GraphitiUi.getEmfService().createResourceSetAndEditingDomain();
 	}
 
 }
diff --git a/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/editor/DiagramEditorInternal.java b/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/editor/DiagramEditorInternal.java
index 130f677..879e527 100644
--- a/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/editor/DiagramEditorInternal.java
+++ b/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/editor/DiagramEditorInternal.java
@@ -118,7 +118,7 @@
 import org.eclipse.graphiti.tb.DefaultToolBehaviorProvider;
 import org.eclipse.graphiti.tb.IToolBehaviorProvider;
 import org.eclipse.graphiti.ui.editor.DiagramEditorContextMenuProvider;
-import org.eclipse.graphiti.ui.editor.DiagramEditorFactory;
+import org.eclipse.graphiti.ui.editor.DiagramEditorInputFactory;
 import org.eclipse.graphiti.ui.editor.DiagramEditorInput;
 import org.eclipse.graphiti.ui.internal.GraphitiUIPlugin;
 import org.eclipse.graphiti.ui.internal.IResourceRegistry;
@@ -406,7 +406,7 @@
 	 * @return A new ContextMenuProvider.
 	 */
 	protected ContextMenuProvider createContextMenuProvider() {
-		return new DiagramEditorContextMenuProvider(getGraphicalViewer(), getActionRegistry(), getConfigurationProvider());
+		return new DiagramEditorContextMenuProvider(getGraphicalViewer(), getActionRegistry(), getDiagramTypeProvider());
 	}
 
 	/**
@@ -1091,7 +1091,7 @@
 		// may be handed in (see Bug 346932). Try to convert this to a
 		// valid diagram input.
 		if (!(input instanceof DiagramEditorInput) || ((DiagramEditorInput) input).getAdapter(TransactionalEditingDomain.class) == null) {
-			IEditorInput newInput = new DiagramEditorFactory().createEditorInput(input);
+			IEditorInput newInput = DiagramEditorInput.createEditorInput(input);
 			if (!(newInput instanceof DiagramEditorInput)) {
 				// give up
 				throw new PartInitException("Unknown editor input: " + input); //$NON-NLS-1$
diff --git a/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/services/IEmfService.java b/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/services/IEmfService.java
index 260bc08..18ea3b7 100644
--- a/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/services/IEmfService.java
+++ b/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/services/IEmfService.java
@@ -37,7 +37,7 @@
  * @noimplement This interface is not intended to be implemented by clients.
  * @noextend This class is not intended to be subclassed by clients.
  */
-public interface IEmfService {
+public interface IEmfService extends org.eclipse.graphiti.ui.services.IEmfService{
 
 	/**
 	 * Returns the human readable name of a given object or the EMF id if no
diff --git a/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/services/impl/EmfService.java b/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/services/impl/EmfService.java
index 5682f91..208630f 100644
--- a/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/services/impl/EmfService.java
+++ b/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/services/impl/EmfService.java
@@ -29,6 +29,7 @@
 import java.util.Set;
 import java.util.TreeMap;
 
+import org.eclipse.core.commands.operations.DefaultOperationHistory;
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.resources.IWorkspaceRoot;
@@ -47,11 +48,16 @@
 import org.eclipse.emf.ecore.EObject;
 import org.eclipse.emf.ecore.resource.Resource;
 import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
 import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
 import org.eclipse.emf.transaction.Transaction;
 import org.eclipse.emf.transaction.TransactionalEditingDomain;
 import org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl;
+import org.eclipse.emf.workspace.IWorkspaceCommandStack;
+import org.eclipse.emf.workspace.WorkspaceEditingDomainFactory;
 import org.eclipse.graphiti.mm.pictograms.Diagram;
+import org.eclipse.graphiti.ui.internal.editor.GFWorkspaceCommandStackImpl;
 import org.eclipse.graphiti.ui.internal.services.IEmfService;
 import org.eclipse.graphiti.ui.internal.util.ModelElementNameComparator;
 import org.eclipse.jface.viewers.IStructuredSelection;
@@ -391,5 +397,16 @@
 	public URI mapDiagramFileUriToDiagramUri(URI diagramFileUri) {
 		return diagramFileUri.appendFragment("/0"); //$NON-NLS-1$
 	}
+	
+	@Override
+	public TransactionalEditingDomain createResourceSetAndEditingDomain() {
+		final ResourceSet resourceSet = new ResourceSetImpl();
+		final IWorkspaceCommandStack workspaceCommandStack = new GFWorkspaceCommandStackImpl(new DefaultOperationHistory());
+	
+		final TransactionalEditingDomainImpl editingDomain = new TransactionalEditingDomainImpl(new ComposedAdapterFactory(
+				ComposedAdapterFactory.Descriptor.Registry.INSTANCE), workspaceCommandStack, resourceSet);
+		WorkspaceEditingDomainFactory.INSTANCE.mapResourceSet(editingDomain);
+		return editingDomain;
+	}
 
 }
diff --git a/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/services/GraphitiUi.java b/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/services/GraphitiUi.java
index c26a042..3c571d9 100644
--- a/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/services/GraphitiUi.java
+++ b/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/services/GraphitiUi.java
@@ -20,6 +20,7 @@
 import org.eclipse.graphiti.services.ILinkService;
 import org.eclipse.graphiti.services.IPeService;
 import org.eclipse.graphiti.ui.internal.platform.ExtensionManager;
+import org.eclipse.graphiti.ui.internal.services.GraphitiUiInternal;
 import org.eclipse.graphiti.ui.internal.services.impl.ImageService;
 import org.eclipse.graphiti.ui.internal.services.impl.UiLayoutService;
 
@@ -73,6 +74,16 @@
 	}
 	
 	/**
+	 * Provides the EMF service.
+	 * 
+	 * @return the EMF service 
+	 * @since 0.9
+	 */
+	public static IEmfService getEmfService() {
+		return GraphitiUiInternal.getEmfService();
+	}
+	
+	/**
 	 * 
 	 * @return the full service for GraphicsAlgoritm's
 	 */
diff --git a/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/services/IEmfService.java b/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/services/IEmfService.java
new file mode 100644
index 0000000..1fe04bd
--- /dev/null
+++ b/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/services/IEmfService.java
@@ -0,0 +1,24 @@
+package org.eclipse.graphiti.ui.services;

+

+import org.eclipse.emf.ecore.resource.ResourceSet;

+import org.eclipse.emf.transaction.TransactionalEditingDomain;

+import org.eclipse.emf.workspace.IWorkspaceCommandStack;

+

+/**

+ * Services regarding EMF.

+ * 

+ * @noimplement This interface is not intended to be implemented by clients.

+ * @noextend This interface is not intended to be extended by clients.

+ * @since 0.9

+ */

+public interface IEmfService {

+	

+	/**

+	 * Creates a {@link TransactionalEditingDomain} with a {@link ResourceSet}

+	 * resource set and a {@link IWorkspaceCommandStack} command stack.

+	 * 

+	 * @return a {@link TransactionalEditingDomain} editing domain

+	 */

+	public abstract TransactionalEditingDomain createResourceSetAndEditingDomain();

+

+}

diff --git a/tests/org.eclipse.graphiti.bot.tests/src/org/eclipse/graphiti/bot/tests/GFOtherTests.java b/tests/org.eclipse.graphiti.bot.tests/src/org/eclipse/graphiti/bot/tests/GFOtherTests.java
index 52116af..f7161c7 100644
--- a/tests/org.eclipse.graphiti.bot.tests/src/org/eclipse/graphiti/bot/tests/GFOtherTests.java
+++ b/tests/org.eclipse.graphiti.bot.tests/src/org/eclipse/graphiti/bot/tests/GFOtherTests.java
@@ -111,7 +111,7 @@
 import org.eclipse.graphiti.services.Graphiti;
 import org.eclipse.graphiti.services.IGaService;
 import org.eclipse.graphiti.ui.editor.DiagramEditor;
-import org.eclipse.graphiti.ui.editor.DiagramEditorFactory;
+import org.eclipse.graphiti.ui.editor.DiagramEditorInputFactory;
 import org.eclipse.graphiti.ui.editor.DiagramEditorInput;
 import org.eclipse.graphiti.ui.features.AbstractDrillDownFeature;
 import org.eclipse.graphiti.ui.internal.IResourceRegistry;
@@ -667,7 +667,7 @@
 
 	@Test
 	public void testUtils() throws Exception {
-		TransactionalEditingDomain editingDomain = DiagramEditorFactory.createResourceSetAndEditingDomain();
+		TransactionalEditingDomain editingDomain = GraphitiUiInternal.getEmfService().createResourceSetAndEditingDomain();
 		ed.setEditingDomain(editingDomain);
 		ResourceSet resourceSet = editingDomain.getResourceSet();
 		URI diagramFileUri = URI.createPlatformPluginURI(
@@ -902,14 +902,14 @@
 		{
 			IMemento memento = createNiceMock(IMemento.class);
 			replay(memento);
-			IAdaptable element = new DiagramEditorFactory().createElement(memento);
+			IAdaptable element = new DiagramEditorInputFactory().createElement(memento);
 			assertNull(element);
 		}
 		{
 			IMemento memento = createNiceMock(IMemento.class);
 			expect(memento.getString(DiagramEditorInput.KEY_URI)).andStubReturn(diagramUri);
 			replay(memento);
-			IAdaptable element = new DiagramEditorFactory().createElement(memento);
+			IAdaptable element = new DiagramEditorInputFactory().createElement(memento);
 			assertNotNull(element);
 		}
 		{
@@ -918,7 +918,7 @@
 			expect(memento.getString(DiagramEditorInput.KEY_PROVIDER_ID)).andStubReturn("myProviderId");
 			// expect(memento.getString(ModelObjectElementFactory.KEY_PROJECTNAME)).andStubReturn(getProject().getName());
 			replay(memento);
-			IAdaptable element = new DiagramEditorFactory().createElement(memento);
+			IAdaptable element = new DiagramEditorInputFactory().createElement(memento);
 			assertNotNull(element);
 			assertTrue(element instanceof DiagramEditorInput);
 		}
diff --git a/tests/org.eclipse.graphiti.ui.tests/src/org/eclipse/graphiti/ui/tests/CommandStackTest.java b/tests/org.eclipse.graphiti.ui.tests/src/org/eclipse/graphiti/ui/tests/CommandStackTest.java
index e362d78..a967857 100644
--- a/tests/org.eclipse.graphiti.ui.tests/src/org/eclipse/graphiti/ui/tests/CommandStackTest.java
+++ b/tests/org.eclipse.graphiti.ui.tests/src/org/eclipse/graphiti/ui/tests/CommandStackTest.java
@@ -46,13 +46,13 @@
 import org.eclipse.graphiti.tb.IContextEntry;
 import org.eclipse.graphiti.tb.IToolBehaviorProvider;
 import org.eclipse.graphiti.tests.reuse.GFAbstractTestCase;
-import org.eclipse.graphiti.ui.editor.DiagramEditorFactory;
 import org.eclipse.graphiti.ui.features.DefaultDeleteFeature;
 import org.eclipse.graphiti.ui.internal.command.AddModelObjectCommand;
 import org.eclipse.graphiti.ui.internal.command.ContextEntryCommand;
 import org.eclipse.graphiti.ui.internal.command.GefCommandWrapper;
 import org.eclipse.graphiti.ui.internal.config.IConfigurationProvider;
 import org.eclipse.graphiti.ui.internal.editor.GFCommandStack;
+import org.eclipse.graphiti.ui.services.GraphitiUi;
 import org.eclipse.jface.viewers.StructuredSelection;
 import org.junit.After;
 import org.junit.Before;
@@ -72,7 +72,7 @@
 
 	@Before
 	public void beforeTest() {
-		editingDomain = DiagramEditorFactory.createResourceSetAndEditingDomain();
+		editingDomain = GraphitiUi.getEmfService().createResourceSetAndEditingDomain();
 		configurationProvider = initConfigurationProviderForHasDoneChangesTests(editingDomain);
 		commandStack = new GFCommandStack(configurationProvider, editingDomain);
 	}
diff --git a/tests/org.eclipse.graphiti.ui.tests/src/org/eclipse/graphiti/ui/tests/CustomUndoableFeatureTest.java b/tests/org.eclipse.graphiti.ui.tests/src/org/eclipse/graphiti/ui/tests/CustomUndoableFeatureTest.java
index 61c540f..abf3780 100644
--- a/tests/org.eclipse.graphiti.ui.tests/src/org/eclipse/graphiti/ui/tests/CustomUndoableFeatureTest.java
+++ b/tests/org.eclipse.graphiti.ui.tests/src/org/eclipse/graphiti/ui/tests/CustomUndoableFeatureTest.java
@@ -30,10 +30,10 @@
 import org.eclipse.graphiti.internal.command.GenericFeatureCommandWithContext;
 import org.eclipse.graphiti.tb.IToolBehaviorProvider;
 import org.eclipse.graphiti.tests.reuse.GFAbstractTestCase;
-import org.eclipse.graphiti.ui.editor.DiagramEditorFactory;
 import org.eclipse.graphiti.ui.internal.command.GefCommandWrapper;
 import org.eclipse.graphiti.ui.internal.config.IConfigurationProvider;
 import org.eclipse.graphiti.ui.internal.editor.GFCommandStack;
+import org.eclipse.graphiti.ui.services.GraphitiUi;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -54,7 +54,7 @@
 
 	@Test
 	public void testPositive() {
-		TransactionalEditingDomain editingDomain = DiagramEditorFactory.createResourceSetAndEditingDomain();
+		TransactionalEditingDomain editingDomain = GraphitiUi.getEmfService().createResourceSetAndEditingDomain();
 		IToolBehaviorProvider toolBehaviorProvider = EasyMock.createNiceMock(IToolBehaviorProvider.class);
 		EasyMock.replay(toolBehaviorProvider);
 
diff --git a/tests/org.eclipse.graphiti.ui.tests/src/org/eclipse/graphiti/ui/tests/MigrationServiceTest.java b/tests/org.eclipse.graphiti.ui.tests/src/org/eclipse/graphiti/ui/tests/MigrationServiceTest.java
index 5f9a4b8..6646b46 100644
--- a/tests/org.eclipse.graphiti.ui.tests/src/org/eclipse/graphiti/ui/tests/MigrationServiceTest.java
+++ b/tests/org.eclipse.graphiti.ui.tests/src/org/eclipse/graphiti/ui/tests/MigrationServiceTest.java
@@ -34,7 +34,7 @@
 import org.eclipse.graphiti.mm.pictograms.PictogramsPackage;
 import org.eclipse.graphiti.services.Graphiti;
 import org.eclipse.graphiti.tests.reuse.GFAbstractTestCase;
-import org.eclipse.graphiti.ui.editor.DiagramEditorFactory;
+import org.eclipse.graphiti.ui.services.GraphitiUi;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -48,7 +48,7 @@
 
 	@BeforeClass
 	public static void before() {
-		editingDomain = DiagramEditorFactory.createResourceSetAndEditingDomain();
+		editingDomain = GraphitiUi.getEmfService().createResourceSetAndEditingDomain();
 		ResourceSet resourceSet = editingDomain.getResourceSet();
 		resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("diagram", new XMIResourceFactoryImpl()); //$NON-NLS-1$
 
diff --git a/tests/org.eclipse.graphiti.ui.tests/src/org/eclipse/graphiti/ui/tests/PackageTest.java b/tests/org.eclipse.graphiti.ui.tests/src/org/eclipse/graphiti/ui/tests/PackageTest.java
index 7e2473c..6062a4e 100644
--- a/tests/org.eclipse.graphiti.ui.tests/src/org/eclipse/graphiti/ui/tests/PackageTest.java
+++ b/tests/org.eclipse.graphiti.ui.tests/src/org/eclipse/graphiti/ui/tests/PackageTest.java
@@ -119,7 +119,6 @@
 import org.eclipse.graphiti.tb.IContextEntry;
 import org.eclipse.graphiti.tb.ImageDecorator;
 import org.eclipse.graphiti.tests.reuse.GFAbstractTestCase;
-import org.eclipse.graphiti.ui.editor.DiagramEditorFactory;
 import org.eclipse.graphiti.ui.internal.command.AddModelObjectCommand;
 import org.eclipse.graphiti.ui.internal.command.ContextEntryCommand;
 import org.eclipse.graphiti.ui.internal.command.CreateModelObjectCommand;
@@ -129,6 +128,7 @@
 import org.eclipse.graphiti.ui.internal.requests.ContextButtonDragRequest;
 import org.eclipse.graphiti.ui.internal.requests.GFDirectEditRequest;
 import org.eclipse.graphiti.ui.internal.util.DataTypeTransformation;
+import org.eclipse.graphiti.ui.services.GraphitiUi;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.swt.graphics.FontData;
@@ -1535,7 +1535,7 @@
 
 	@Test
 	public void testDiagramEditorFactory() {
-		TransactionalEditingDomain ted = DiagramEditorFactory.createResourceSetAndEditingDomain();
+		TransactionalEditingDomain ted = GraphitiUi.getEmfService().createResourceSetAndEditingDomain();
 		assertNotNull(ted);
 		ResourceSet rSet = ted.getResourceSet();
 		TransactionalEditingDomain ted2 = TransactionUtil.getEditingDomain(rSet);
diff --git a/tests/org.eclipse.graphiti.ui.tests/src/org/eclipse/graphiti/ui/tests/RollbackTest.java b/tests/org.eclipse.graphiti.ui.tests/src/org/eclipse/graphiti/ui/tests/RollbackTest.java
index 73740c2..04b0088 100644
--- a/tests/org.eclipse.graphiti.ui.tests/src/org/eclipse/graphiti/ui/tests/RollbackTest.java
+++ b/tests/org.eclipse.graphiti.ui.tests/src/org/eclipse/graphiti/ui/tests/RollbackTest.java
@@ -43,10 +43,10 @@
 import org.eclipse.graphiti.mm.pictograms.PictogramsPackage;
 import org.eclipse.graphiti.tb.IToolBehaviorProvider;
 import org.eclipse.graphiti.tests.reuse.GFAbstractTestCase;
-import org.eclipse.graphiti.ui.editor.DiagramEditorFactory;
 import org.eclipse.graphiti.ui.internal.command.GefCommandWrapper;
 import org.eclipse.graphiti.ui.internal.config.IConfigurationProvider;
 import org.eclipse.graphiti.ui.internal.editor.GFCommandStack;
+import org.eclipse.graphiti.ui.services.GraphitiUi;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -61,7 +61,7 @@
 
 	@BeforeClass
 	public static void before() {
-		editingDomain = DiagramEditorFactory.createResourceSetAndEditingDomain();
+		editingDomain = GraphitiUi.getEmfService().createResourceSetAndEditingDomain();
 		ResourceSet resourceSet = editingDomain.getResourceSet();
 		resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("diagram", new XMIResourceFactoryImpl()); //$NON-NLS-1$