Example for dark feature processing
diff --git a/examples/org.eclipse.graphiti.examples.tutorial/META-INF/MANIFEST.MF b/examples/org.eclipse.graphiti.examples.tutorial/META-INF/MANIFEST.MF
index abb3c84..f2da22c 100644
--- a/examples/org.eclipse.graphiti.examples.tutorial/META-INF/MANIFEST.MF
+++ b/examples/org.eclipse.graphiti.examples.tutorial/META-INF/MANIFEST.MF
@@ -11,7 +11,9 @@
  org.eclipse.graphiti.examples.common;bundle-version="0.7.0",
  org.eclipse.core.resources,
  org.eclipse.core.runtime,
- org.eclipse.ui.views.properties.tabbed
+ org.eclipse.emf.transaction;bundle-version="1.4.0",
+ org.eclipse.ui.views.properties.tabbed,
+ org.eclipse.ui.ide;bundle-version="3.5.2"
 Bundle-ActivationPolicy: lazy
 Export-Package: org.eclipse.graphiti.examples.tutorial,
  org.eclipse.graphiti.examples.tutorial.diagram,
diff --git a/examples/org.eclipse.graphiti.examples.tutorial/plugin.xml b/examples/org.eclipse.graphiti.examples.tutorial/plugin.xml
index 5a88eb8..0ef9368 100644
--- a/examples/org.eclipse.graphiti.examples.tutorial/plugin.xml
+++ b/examples/org.eclipse.graphiti.examples.tutorial/plugin.xml
Binary files differ
diff --git a/examples/org.eclipse.graphiti.examples.tutorial/src/org/eclipse/graphiti/examples/tutorial/handlers/AddAllClassesCommand.java b/examples/org.eclipse.graphiti.examples.tutorial/src/org/eclipse/graphiti/examples/tutorial/handlers/AddAllClassesCommand.java
new file mode 100644
index 0000000..54c7f77
--- /dev/null
+++ b/examples/org.eclipse.graphiti.examples.tutorial/src/org/eclipse/graphiti/examples/tutorial/handlers/AddAllClassesCommand.java
@@ -0,0 +1,77 @@
+package org.eclipse.graphiti.examples.tutorial.handlers;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.graphiti.dt.IDiagramTypeProvider;
+import org.eclipse.graphiti.examples.common.util.Util;
+import org.eclipse.graphiti.features.IAddFeature;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.impl.AddContext;
+import org.eclipse.graphiti.mm.pictograms.Diagram;
+import org.eclipse.graphiti.services.Graphiti;
+import org.eclipse.graphiti.ui.services.GraphitiUi;
+
+public class AddAllClassesCommand extends RecordingCommand {
+
+	private IProject project;
+	private TransactionalEditingDomain editingDomain;
+	private String diagramName;
+	private Resource createdResource;
+
+	public AddAllClassesCommand(IProject project, TransactionalEditingDomain editingDomain, String diagramName) {
+		super(editingDomain);
+		this.project = project;
+		this.editingDomain = editingDomain;
+		this.diagramName = diagramName;
+	}
+
+	@Override
+	protected void doExecute() {
+		// Get all EClasses
+		EClass[] allClasses = Util.getAllClasses(project, editingDomain.getResourceSet());
+
+		// Create the diagram and its file
+		Diagram diagram = Graphiti.getPeCreateService().createDiagram("tutorial", diagramName, true);
+		IFolder diagramFolder = project.getFolder("src/diagrams/");
+		IFile diagramFile = diagramFolder.getFile(diagramName + ".diagram");
+		URI uri = URI.createPlatformResourceURI(diagramFile.getFullPath().toString(), true);
+		createdResource = editingDomain.getResourceSet().createResource(uri);
+		createdResource.getContents().add(diagram);
+
+		IDiagramTypeProvider dtp = GraphitiUi.getExtensionManager().createDiagramTypeProvider(diagram,
+				"org.eclipse.graphiti.examples.tutorial.diagram.TutorialDiagramTypeProvider");
+		IFeatureProvider featureProvider = dtp.getFeatureProvider();
+
+		// Add all classes to diagram
+		int x = 20;
+		int y = 20;
+		for (int i = 0; i < allClasses.length; i++) {
+			// Create the context information
+			AddContext addContext = new AddContext();
+			addContext.setNewObject(allClasses[i]);
+			addContext.setTargetContainer(diagram);
+			addContext.setX(x);
+			addContext.setY(y);
+			x = x + 20;
+			y = y + 20;
+
+			IAddFeature addFeature = featureProvider.getAddFeature(addContext);
+			if (addFeature.canAdd(addContext)) {
+				addFeature.add(addContext);
+			}
+		}
+	}
+
+	/**
+	 * @return the createdResource
+	 */
+	public Resource getCreatedResource() {
+		return createdResource;
+	}
+}
diff --git a/examples/org.eclipse.graphiti.examples.tutorial/src/org/eclipse/graphiti/examples/tutorial/handlers/CreateDiagramWithAllClassesHandler.java b/examples/org.eclipse.graphiti.examples.tutorial/src/org/eclipse/graphiti/examples/tutorial/handlers/CreateDiagramWithAllClassesHandler.java
new file mode 100644
index 0000000..7a862c8
--- /dev/null
+++ b/examples/org.eclipse.graphiti.examples.tutorial/src/org/eclipse/graphiti/examples/tutorial/handlers/CreateDiagramWithAllClassesHandler.java
@@ -0,0 +1,104 @@
+package org.eclipse.graphiti.examples.tutorial.handlers;
+
+import java.io.IOException;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.graphiti.examples.common.navigator.nodes.EClassesNode;
+import org.eclipse.graphiti.ui.editor.DiagramEditor;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.part.FileEditorInput;
+
+/**
+ * Creates sample data
+ */
+public final class CreateDiagramWithAllClassesHandler extends AbstractHandler {
+
+	public Object execute(final ExecutionEvent event) throws ExecutionException {
+
+		// Get the current selection
+		ISelection selection = HandlerUtil.getCurrentSelection(event);
+		if (!(selection instanceof IStructuredSelection)) {
+			return null;
+		}
+
+		// Operation must be started on ECLasses node -> cancel if not
+		Object first = ((IStructuredSelection) selection).getFirstElement();
+		if (!(first instanceof EClassesNode)) {
+			return null;
+		}
+
+		// Retrieve the project from the selected node
+		EClassesNode node = (EClassesNode) first;
+		IProject project = node.getProject();
+		if (project == null) {
+			return null;
+		}
+
+		// Ask for the name of the new diagram
+		InputDialog dialog = new InputDialog(Display.getCurrent().getActiveShell(), "New Diagram", "Enter the name for the new diagram",
+				null, null);
+		if (dialog.open() != Dialog.OK) {
+			return null;
+		}
+		String diagramName = dialog.getValue();
+
+		// Get the default resource set to hold the new resource
+		ResourceSet resourceSet = new ResourceSetImpl();
+		TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(resourceSet);
+		if (editingDomain == null) {
+			// Not yet existing, create one
+			editingDomain = TransactionalEditingDomain.Factory.INSTANCE.createEditingDomain(resourceSet);
+		}
+
+		// Create the data within a command and save (must not happen inside
+		// the command since finishing the command will trigger setting the 
+		// modification flag on the resource which will be used by the save
+		// operation to determine which resources need to be saved)
+		AddAllClassesCommand operation = new AddAllClassesCommand(project, editingDomain, diagramName);
+		editingDomain.getCommandStack().execute(operation);
+		try {
+			operation.getCreatedResource().save(null);
+		} catch (IOException e) {
+			IStatus status = new Status(IStatus.ERROR, "org.eclipse.graphiti.examples.tutorial", e.getMessage(), e);
+			ErrorDialog.openError(Display.getCurrent().getActiveShell(), "Error Occured", e.getMessage(), status);
+			return null;
+		}
+
+		// Dispose the editing domain to eliminate memory leak
+		editingDomain.dispose();
+
+		// Open the editor
+		String platformString = operation.getCreatedResource().getURI().toPlatformString(true);
+		IFile file = project.getParent().getFile(new Path(platformString));
+		IFileEditorInput input = new FileEditorInput(file);
+		try {
+			PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(input, DiagramEditor.DIAGRAM_EDITOR_ID);
+		} catch (PartInitException e) {
+			IStatus status = new Status(IStatus.ERROR, "org.eclipse.graphiti.examples.tutorial", e.getMessage(), e);
+			ErrorDialog.openError(Display.getCurrent().getActiveShell(), "Error Occured", e.getMessage(), status);
+			return null;
+		}
+
+		return null;
+	}
+}
\ No newline at end of file