Bug 527119 - Access to IEditingDomain in IToolbarActions for
GenericEditor

Change-Id: I78e2fc6928b01b57f7045747bb5ed7396b08ab3d
Signed-off-by: Eugen Neufeld <eneufeld@eclipsesource.com>
diff --git a/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/spi/editor/GenericEditor.java b/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/spi/editor/GenericEditor.java
index 0c16919..aed004c 100644
--- a/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/spi/editor/GenericEditor.java
+++ b/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/spi/editor/GenericEditor.java
@@ -440,6 +440,12 @@
 		final TreeMasterDetailComposite treeMasterDetail = createTreeMasterDetail(composite, editorInput,
 			createElementCallback);
 		treeMasterDetail.setLayoutData(treeMasterDetailLayoutData);
+
+		for (final Action action : toolbarActions) {
+			if (action instanceof IEditingDomainAware) {
+				((IEditingDomainAware) action).setEditingDomain(getEditingDomain());
+			}
+		}
 		return treeMasterDetail;
 	}
 
diff --git a/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/spi/editor/IEditingDomainAware.java b/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/spi/editor/IEditingDomainAware.java
new file mode 100644
index 0000000..fbda2cc
--- /dev/null
+++ b/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/spi/editor/IEditingDomainAware.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2011-2018 EclipseSource Muenchen GmbH and others.
+ *
+ * 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:
+ * Eugen Neufeld - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.emfforms.spi.editor;
+
+import org.eclipse.emf.edit.domain.EditingDomain;
+
+/**
+ * The GenericEditor sets the current EditingDomain.
+ * 
+ * @author Eugen Neufeld
+ * @since 1.18
+ *
+ */
+public interface IEditingDomainAware {
+
+	/**
+	 * Called by the framework to set the EditingDomain.
+	 *
+	 * @param editingDomain The {@link EditingDomain} set by the framework
+	 */
+	void setEditingDomain(EditingDomain editingDomain);
+}