You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gu...@apache.org on 2010/06/09 18:29:16 UTC

svn commit: r953075 [7/17] - in /commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram: edit/policies/ navigator/ providers/ sheet/ view/factories/

Added: commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/ServiceTemplateCanonicalEditPolicy.java
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/ServiceTemplateCanonicalEditPolicy.java?rev=953075&view=auto
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/ServiceTemplateCanonicalEditPolicy.java (added)
+++ commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/ServiceTemplateCanonicalEditPolicy.java Wed Jun  9 16:29:10 2010
@@ -0,0 +1,984 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.commons.scxml.modeling.diagram.edit.policies;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.scxml.modeling.ModelingPackage;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Anchor2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.AnchorEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Assign2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.AssignEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Cancel2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.CancelEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Content2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Content3EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Content4EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Content5EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.ContentEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.DataEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.DataModelEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.DonedataEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.ElseEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.ElseIfEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.ExtenExecContent2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.ExtenExecContentEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.FinalState2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.FinalStateEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.FinalizeEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.HistoryState2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.HistoryStateEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.If2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.IfEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.InitialState2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.InvokeEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Log2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.LogEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.OnEntry2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.OnEntry3EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.OnEntryEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.OnExit2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.OnExit3EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.OnExitEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Parallel2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Parallel3EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.ParallelEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Param2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Param3EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Param4EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Param5EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.ParamEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Raise2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.RaiseEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Script2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Script3EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.ScriptEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Send2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.SendEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.ServiceTemplateEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.State2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.State3EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.StateEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.TransitionEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Validate2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.ValidateEditPart;
+import org.apache.commons.scxml.modeling.diagram.part.ModelingDiagramUpdater;
+import org.apache.commons.scxml.modeling.diagram.part.ModelingLinkDescriptor;
+import org.apache.commons.scxml.modeling.diagram.part.ModelingNodeDescriptor;
+import org.apache.commons.scxml.modeling.diagram.part.ModelingVisualIDRegistry;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.commands.DeferredLayoutCommand;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalConnectionEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class ServiceTemplateCanonicalEditPolicy extends
+		CanonicalConnectionEditPolicy {
+
+	/**
+	 * @generated
+	 */
+	Set myFeaturesToSynchronize;
+
+	/**
+	 * @generated
+	 */
+	protected List getSemanticChildrenList() {
+		View viewObject = (View) getHost().getModel();
+		List result = new LinkedList();
+		for (Iterator it = ModelingDiagramUpdater
+				.getServiceTemplate_1000SemanticChildren(viewObject).iterator(); it
+				.hasNext();) {
+			result.add(((ModelingNodeDescriptor) it.next()).getModelElement());
+		}
+		return result;
+	}
+
+	/**
+	 * @generated
+	 */
+	protected boolean shouldDeleteView(View view) {
+		return true;
+	}
+
+	/**
+	 * @generated
+	 */
+	protected boolean isOrphaned(Collection semanticChildren, final View view) {
+		int visualID = ModelingVisualIDRegistry.getVisualID(view);
+		switch (visualID) {
+		case StateEditPart.VISUAL_ID:
+		case ScriptEditPart.VISUAL_ID:
+		case ParallelEditPart.VISUAL_ID:
+		case DataModelEditPart.VISUAL_ID:
+		case FinalStateEditPart.VISUAL_ID:
+			if (!semanticChildren.contains(view.getElement())) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	/**
+	 * @generated
+	 */
+	protected String getDefaultFactoryHint() {
+		return null;
+	}
+
+	/**
+	 * @generated
+	 */
+	protected Set getFeaturesToSynchronize() {
+		if (myFeaturesToSynchronize == null) {
+			myFeaturesToSynchronize = new HashSet();
+			myFeaturesToSynchronize.add(ModelingPackage.eINSTANCE
+					.getServiceTemplate_StateList());
+			myFeaturesToSynchronize.add(ModelingPackage.eINSTANCE
+					.getServiceTemplate_Script());
+			myFeaturesToSynchronize.add(ModelingPackage.eINSTANCE
+					.getServiceTemplate_Parallel());
+			myFeaturesToSynchronize.add(ModelingPackage.eINSTANCE
+					.getServiceTemplate_DataModel());
+			myFeaturesToSynchronize.add(ModelingPackage.eINSTANCE
+					.getServiceTemplate_FinalState());
+		}
+		return myFeaturesToSynchronize;
+	}
+
+	/**
+	 * @generated
+	 */
+	protected List getSemanticConnectionsList() {
+		return Collections.EMPTY_LIST;
+	}
+
+	/**
+	 * @generated
+	 */
+	protected EObject getSourceElement(EObject relationship) {
+		return null;
+	}
+
+	/**
+	 * @generated
+	 */
+	protected EObject getTargetElement(EObject relationship) {
+		return null;
+	}
+
+	/**
+	 * @generated
+	 */
+	protected boolean shouldIncludeConnection(Edge connector,
+			Collection children) {
+		return false;
+	}
+
+	/**
+	 * @generated
+	 */
+	protected void refreshSemantic() {
+		List createdViews = new LinkedList();
+		createdViews.addAll(refreshSemanticChildren());
+		List createdConnectionViews = new LinkedList();
+		createdConnectionViews.addAll(refreshSemanticConnections());
+		createdConnectionViews.addAll(refreshConnections());
+
+		if (createdViews.size() > 1) {
+			// perform a layout of the container
+			DeferredLayoutCommand layoutCmd = new DeferredLayoutCommand(host()
+					.getEditingDomain(), createdViews, host());
+			executeCommand(new ICommandProxy(layoutCmd));
+		}
+
+		createdViews.addAll(createdConnectionViews);
+		makeViewsImmutable(createdViews);
+	}
+
+	/**
+	 * @generated
+	 */
+	private Diagram getDiagram() {
+		return ((View) getHost().getModel()).getDiagram();
+	}
+
+	/**
+	 * @generated
+	 */
+	private Collection refreshConnections() {
+		Map domain2NotationMap = new HashMap();
+		Collection linkDescriptors = collectAllLinks(getDiagram(),
+				domain2NotationMap);
+		Collection existingLinks = new LinkedList(getDiagram().getEdges());
+		for (Iterator linksIterator = existingLinks.iterator(); linksIterator
+				.hasNext();) {
+			Edge nextDiagramLink = (Edge) linksIterator.next();
+			int diagramLinkVisualID = ModelingVisualIDRegistry
+					.getVisualID(nextDiagramLink);
+			if (diagramLinkVisualID == -1) {
+				if (nextDiagramLink.getSource() != null
+						&& nextDiagramLink.getTarget() != null) {
+					linksIterator.remove();
+				}
+				continue;
+			}
+			EObject diagramLinkObject = nextDiagramLink.getElement();
+			EObject diagramLinkSrc = nextDiagramLink.getSource().getElement();
+			EObject diagramLinkDst = nextDiagramLink.getTarget().getElement();
+			for (Iterator LinkDescriptorsIterator = linkDescriptors.iterator(); LinkDescriptorsIterator
+					.hasNext();) {
+				ModelingLinkDescriptor nextLinkDescriptor = (ModelingLinkDescriptor) LinkDescriptorsIterator
+						.next();
+				if (diagramLinkObject == nextLinkDescriptor.getModelElement()
+						&& diagramLinkSrc == nextLinkDescriptor.getSource()
+						&& diagramLinkDst == nextLinkDescriptor
+								.getDestination()
+						&& diagramLinkVisualID == nextLinkDescriptor
+								.getVisualID()) {
+					linksIterator.remove();
+					LinkDescriptorsIterator.remove();
+				}
+			}
+		}
+		deleteViews(existingLinks.iterator());
+		return createConnections(linkDescriptors, domain2NotationMap);
+	}
+
+	/**
+	 * @generated
+	 */
+	private Collection collectAllLinks(View view, Map domain2NotationMap) {
+		if (!ServiceTemplateEditPart.MODEL_ID.equals(ModelingVisualIDRegistry
+				.getModelID(view))) {
+			return Collections.EMPTY_LIST;
+		}
+		Collection result = new LinkedList();
+		switch (ModelingVisualIDRegistry.getVisualID(view)) {
+		case ServiceTemplateEditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getServiceTemplate_1000ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case StateEditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getState_2001ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case ScriptEditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getScript_2003ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case ParallelEditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getParallel_2004ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case DataModelEditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getDataModel_2005ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case FinalStateEditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getFinalState_2006ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case OnEntryEditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getOnEntry_3001ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case IfEditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getIf_3002ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case ElseIfEditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getElseIf_3003ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case ElseEditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getElse_3004ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case AssignEditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getAssign_3005ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case RaiseEditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getRaise_3006ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case LogEditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getLog_3007ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case ValidateEditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getValidate_3008ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case CancelEditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getCancel_3009ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case SendEditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getSend_3010ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case ParamEditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getParam_3011ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case ContentEditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getContent_3012ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case Content2EditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getContent_3013ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case Param2EditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getParam_3014ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case Script2EditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getScript_3015ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case ExtenExecContentEditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getExtenExecContent_3049ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case OnExitEditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getOnExit_3016ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case If2EditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getIf_3017ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case Assign2EditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getAssign_3018ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case Raise2EditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getRaise_3019ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case Log2EditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getLog_3020ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case Validate2EditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getValidate_3021ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case Cancel2EditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getCancel_3022ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case Param3EditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getParam_3023ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case Send2EditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getSend_3024ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case Script3EditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getScript_3025ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case ExtenExecContent2EditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getExtenExecContent_3050ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case InvokeEditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getInvoke_3026ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case FinalizeEditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getFinalize_3027ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case Param4EditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getParam_3028ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case Content3EditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getContent_3029ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case InitialState2EditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getInitialState_3030ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case HistoryStateEditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getHistoryState_3031ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case Parallel2EditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getParallel_3032ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case HistoryState2EditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getHistoryState_3033ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case AnchorEditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getAnchor_3034ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case Parallel3EditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getParallel_3035ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case OnEntry2EditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getOnEntry_3036ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case OnExit2EditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getOnExit_3037ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case State2EditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getState_3038ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case Anchor2EditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getAnchor_3039ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case FinalState2EditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getFinalState_3040ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case DonedataEditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getDonedata_3041ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case Param5EditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getParam_3042ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case Content4EditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getContent_3043ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case OnEntry3EditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getOnEntry_3044ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case OnExit3EditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getOnExit_3045ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case State3EditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getState_3046ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case DataEditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getData_3047ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case Content5EditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getContent_3048ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case TransitionEditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ModelingDiagramUpdater
+						.getTransition_4001ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		}
+		for (Iterator children = view.getChildren().iterator(); children
+				.hasNext();) {
+			result.addAll(collectAllLinks((View) children.next(),
+					domain2NotationMap));
+		}
+		for (Iterator edges = view.getSourceEdges().iterator(); edges.hasNext();) {
+			result.addAll(collectAllLinks((View) edges.next(),
+					domain2NotationMap));
+		}
+		return result;
+	}
+
+	/**
+	 * @generated
+	 */
+	private Collection createConnections(Collection linkDescriptors,
+			Map domain2NotationMap) {
+		List adapters = new LinkedList();
+		for (Iterator linkDescriptorsIterator = linkDescriptors.iterator(); linkDescriptorsIterator
+				.hasNext();) {
+			final ModelingLinkDescriptor nextLinkDescriptor = (ModelingLinkDescriptor) linkDescriptorsIterator
+					.next();
+			EditPart sourceEditPart = getEditPart(nextLinkDescriptor
+					.getSource(), domain2NotationMap);
+			EditPart targetEditPart = getEditPart(nextLinkDescriptor
+					.getDestination(), domain2NotationMap);
+			if (sourceEditPart == null || targetEditPart == null) {
+				continue;
+			}
+			CreateConnectionViewRequest.ConnectionViewDescriptor descriptor = new CreateConnectionViewRequest.ConnectionViewDescriptor(
+					nextLinkDescriptor.getSemanticAdapter(), null,
+					ViewUtil.APPEND, false, ((IGraphicalEditPart) getHost())
+							.getDiagramPreferencesHint());
+			CreateConnectionViewRequest ccr = new CreateConnectionViewRequest(
+					descriptor);
+			ccr.setType(RequestConstants.REQ_CONNECTION_START);
+			ccr.setSourceEditPart(sourceEditPart);
+			sourceEditPart.getCommand(ccr);
+			ccr.setTargetEditPart(targetEditPart);
+			ccr.setType(RequestConstants.REQ_CONNECTION_END);
+			Command cmd = targetEditPart.getCommand(ccr);
+			if (cmd != null && cmd.canExecute()) {
+				executeCommand(cmd);
+				IAdaptable viewAdapter = (IAdaptable) ccr.getNewObject();
+				if (viewAdapter != null) {
+					adapters.add(viewAdapter);
+				}
+			}
+		}
+		return adapters;
+	}
+
+	/**
+	 * @generated
+	 */
+	private EditPart getEditPart(EObject domainModelElement,
+			Map domain2NotationMap) {
+		View view = (View) domain2NotationMap.get(domainModelElement);
+		if (view != null) {
+			return (EditPart) getHost().getViewer().getEditPartRegistry().get(
+					view);
+		}
+		return null;
+	}
+}

Propchange: commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/ServiceTemplateCanonicalEditPolicy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/ServiceTemplateItemSemanticEditPolicy.java
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/ServiceTemplateItemSemanticEditPolicy.java?rev=953075&view=auto
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/ServiceTemplateItemSemanticEditPolicy.java (added)
+++ commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/ServiceTemplateItemSemanticEditPolicy.java Wed Jun  9 16:29:10 2010
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.commons.scxml.modeling.diagram.edit.policies;
+
+import org.apache.commons.scxml.modeling.ModelingPackage;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.DataModelCreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.FinalStateCreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.ParallelCreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.ScriptCreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.StateCreateCommand;
+import org.apache.commons.scxml.modeling.diagram.providers.ModelingElementTypes;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.emf.commands.core.commands.DuplicateEObjectsCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest;
+
+/**
+ * @generated
+ */
+public class ServiceTemplateItemSemanticEditPolicy extends
+		ModelingBaseItemSemanticEditPolicy {
+
+	/**
+	 * @generated
+	 */
+	protected Command getCreateCommand(CreateElementRequest req) {
+		if (ModelingElementTypes.State_2001 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ModelingPackage.eINSTANCE
+						.getServiceTemplate_StateList());
+			}
+			return getGEFWrapper(new StateCreateCommand(req));
+		}
+		if (ModelingElementTypes.Script_2003 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ModelingPackage.eINSTANCE
+						.getServiceTemplate_Script());
+			}
+			return getGEFWrapper(new ScriptCreateCommand(req));
+		}
+		if (ModelingElementTypes.Parallel_2004 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ModelingPackage.eINSTANCE
+						.getServiceTemplate_Parallel());
+			}
+			return getGEFWrapper(new ParallelCreateCommand(req));
+		}
+		if (ModelingElementTypes.DataModel_2005 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ModelingPackage.eINSTANCE
+						.getServiceTemplate_DataModel());
+			}
+			return getGEFWrapper(new DataModelCreateCommand(req));
+		}
+		if (ModelingElementTypes.FinalState_2006 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ModelingPackage.eINSTANCE
+						.getServiceTemplate_FinalState());
+			}
+			return getGEFWrapper(new FinalStateCreateCommand(req));
+		}
+		return super.getCreateCommand(req);
+	}
+
+	/**
+	 * @generated
+	 */
+	protected Command getDuplicateCommand(DuplicateElementsRequest req) {
+		TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost())
+				.getEditingDomain();
+		return getGEFWrapper(new DuplicateAnythingCommand(editingDomain, req));
+	}
+
+	/**
+	 * @generated
+	 */
+	private static class DuplicateAnythingCommand extends
+			DuplicateEObjectsCommand {
+
+		/**
+		 * @generated
+		 */
+		public DuplicateAnythingCommand(
+				TransactionalEditingDomain editingDomain,
+				DuplicateElementsRequest req) {
+			super(editingDomain, req.getLabel(), req
+					.getElementsToBeDuplicated(), req
+					.getAllDuplicatedElementsMap());
+		}
+
+	}
+
+}

Propchange: commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/ServiceTemplateItemSemanticEditPolicy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/State2ItemSemanticEditPolicy.java
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/State2ItemSemanticEditPolicy.java?rev=953075&view=auto
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/State2ItemSemanticEditPolicy.java (added)
+++ commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/State2ItemSemanticEditPolicy.java Wed Jun  9 16:29:10 2010
@@ -0,0 +1,163 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.commons.scxml.modeling.diagram.edit.policies;
+
+import java.util.Iterator;
+
+import org.apache.commons.scxml.modeling.diagram.edit.commands.TransitionCreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.TransitionReorientCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Anchor2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.FinalState2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.HistoryStateEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.InitialState2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.InvokeEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.OnEntryEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.OnExitEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Parallel2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.State3EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.StateStateCompartment2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.TransitionEditPart;
+import org.apache.commons.scxml.modeling.diagram.part.ModelingVisualIDRegistry;
+import org.apache.commons.scxml.modeling.diagram.providers.ModelingElementTypes;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class State2ItemSemanticEditPolicy extends
+		ModelingBaseItemSemanticEditPolicy {
+
+	/**
+	 * @generated
+	 */
+	protected Command getDestroyElementCommand(DestroyElementRequest req) {
+		CompoundCommand cc = getDestroyEdgesCommand();
+		addDestroyChildNodesCommand(cc);
+		addDestroyShortcutsCommand(cc);
+		cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+		return cc.unwrap();
+	}
+
+	/**
+	 * @generated
+	 */
+	protected void addDestroyChildNodesCommand(CompoundCommand cmd) {
+		View view = (View) getHost().getModel();
+		EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+		if (annotation != null) {
+			return;
+		}
+		for (Iterator it = view.getChildren().iterator(); it.hasNext();) {
+			Node node = (Node) it.next();
+			switch (ModelingVisualIDRegistry.getVisualID(node)) {
+			case StateStateCompartment2EditPart.VISUAL_ID:
+				for (Iterator cit = node.getChildren().iterator(); cit
+						.hasNext();) {
+					Node cnode = (Node) cit.next();
+					switch (ModelingVisualIDRegistry.getVisualID(cnode)) {
+					case OnEntryEditPart.VISUAL_ID:
+						cmd.add(getDestroyElementCommand(cnode));
+						break;
+					case OnExitEditPart.VISUAL_ID:
+						cmd.add(getDestroyElementCommand(cnode));
+						break;
+					case InvokeEditPart.VISUAL_ID:
+						cmd.add(getDestroyElementCommand(cnode));
+						break;
+					case InitialState2EditPart.VISUAL_ID:
+						cmd.add(getDestroyElementCommand(cnode));
+						break;
+					case HistoryStateEditPart.VISUAL_ID:
+						cmd.add(getDestroyElementCommand(cnode));
+						break;
+					case Parallel2EditPart.VISUAL_ID:
+						cmd.add(getDestroyElementCommand(cnode));
+						break;
+					case Anchor2EditPart.VISUAL_ID:
+						cmd.add(getDestroyElementCommand(cnode));
+						break;
+					case FinalState2EditPart.VISUAL_ID:
+						cmd.add(getDestroyElementCommand(cnode));
+						break;
+					case State3EditPart.VISUAL_ID:
+						cmd.add(getDestroyElementCommand(cnode));
+						break;
+					}
+				}
+				break;
+			}
+		}
+	}
+
+	/**
+	 * @generated
+	 */
+	protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+		Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req)
+				: getCompleteCreateRelationshipCommand(req);
+		return command != null ? command : super
+				.getCreateRelationshipCommand(req);
+	}
+
+	/**
+	 * @generated
+	 */
+	protected Command getStartCreateRelationshipCommand(
+			CreateRelationshipRequest req) {
+		if (ModelingElementTypes.Transition_4001 == req.getElementType()) {
+			return getGEFWrapper(new TransitionCreateCommand(req, req
+					.getSource(), req.getTarget()));
+		}
+		return null;
+	}
+
+	/**
+	 * @generated
+	 */
+	protected Command getCompleteCreateRelationshipCommand(
+			CreateRelationshipRequest req) {
+		if (ModelingElementTypes.Transition_4001 == req.getElementType()) {
+			return getGEFWrapper(new TransitionCreateCommand(req, req
+					.getSource(), req.getTarget()));
+		}
+		return null;
+	}
+
+	/**
+	 * Returns command to reorient EClass based link. New link target or source
+	 * should be the domain model element associated with this node.
+	 * 
+	 * @generated
+	 */
+	protected Command getReorientRelationshipCommand(
+			ReorientRelationshipRequest req) {
+		switch (getVisualID(req)) {
+		case TransitionEditPart.VISUAL_ID:
+			return getGEFWrapper(new TransitionReorientCommand(req));
+		}
+		return super.getReorientRelationshipCommand(req);
+	}
+
+}

Propchange: commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/State2ItemSemanticEditPolicy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/State3ItemSemanticEditPolicy.java
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/State3ItemSemanticEditPolicy.java?rev=953075&view=auto
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/State3ItemSemanticEditPolicy.java (added)
+++ commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/State3ItemSemanticEditPolicy.java Wed Jun  9 16:29:10 2010
@@ -0,0 +1,163 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.commons.scxml.modeling.diagram.edit.policies;
+
+import java.util.Iterator;
+
+import org.apache.commons.scxml.modeling.diagram.edit.commands.TransitionCreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.TransitionReorientCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Anchor2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.FinalState2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.HistoryStateEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.InitialState2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.InvokeEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.OnEntryEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.OnExitEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Parallel2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.State3EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.StateStateCompartment3EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.TransitionEditPart;
+import org.apache.commons.scxml.modeling.diagram.part.ModelingVisualIDRegistry;
+import org.apache.commons.scxml.modeling.diagram.providers.ModelingElementTypes;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class State3ItemSemanticEditPolicy extends
+		ModelingBaseItemSemanticEditPolicy {
+
+	/**
+	 * @generated
+	 */
+	protected Command getDestroyElementCommand(DestroyElementRequest req) {
+		CompoundCommand cc = getDestroyEdgesCommand();
+		addDestroyChildNodesCommand(cc);
+		addDestroyShortcutsCommand(cc);
+		cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+		return cc.unwrap();
+	}
+
+	/**
+	 * @generated
+	 */
+	protected void addDestroyChildNodesCommand(CompoundCommand cmd) {
+		View view = (View) getHost().getModel();
+		EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+		if (annotation != null) {
+			return;
+		}
+		for (Iterator it = view.getChildren().iterator(); it.hasNext();) {
+			Node node = (Node) it.next();
+			switch (ModelingVisualIDRegistry.getVisualID(node)) {
+			case StateStateCompartment3EditPart.VISUAL_ID:
+				for (Iterator cit = node.getChildren().iterator(); cit
+						.hasNext();) {
+					Node cnode = (Node) cit.next();
+					switch (ModelingVisualIDRegistry.getVisualID(cnode)) {
+					case OnEntryEditPart.VISUAL_ID:
+						cmd.add(getDestroyElementCommand(cnode));
+						break;
+					case OnExitEditPart.VISUAL_ID:
+						cmd.add(getDestroyElementCommand(cnode));
+						break;
+					case InvokeEditPart.VISUAL_ID:
+						cmd.add(getDestroyElementCommand(cnode));
+						break;
+					case InitialState2EditPart.VISUAL_ID:
+						cmd.add(getDestroyElementCommand(cnode));
+						break;
+					case HistoryStateEditPart.VISUAL_ID:
+						cmd.add(getDestroyElementCommand(cnode));
+						break;
+					case Parallel2EditPart.VISUAL_ID:
+						cmd.add(getDestroyElementCommand(cnode));
+						break;
+					case Anchor2EditPart.VISUAL_ID:
+						cmd.add(getDestroyElementCommand(cnode));
+						break;
+					case FinalState2EditPart.VISUAL_ID:
+						cmd.add(getDestroyElementCommand(cnode));
+						break;
+					case State3EditPart.VISUAL_ID:
+						cmd.add(getDestroyElementCommand(cnode));
+						break;
+					}
+				}
+				break;
+			}
+		}
+	}
+
+	/**
+	 * @generated
+	 */
+	protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+		Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req)
+				: getCompleteCreateRelationshipCommand(req);
+		return command != null ? command : super
+				.getCreateRelationshipCommand(req);
+	}
+
+	/**
+	 * @generated
+	 */
+	protected Command getStartCreateRelationshipCommand(
+			CreateRelationshipRequest req) {
+		if (ModelingElementTypes.Transition_4001 == req.getElementType()) {
+			return getGEFWrapper(new TransitionCreateCommand(req, req
+					.getSource(), req.getTarget()));
+		}
+		return null;
+	}
+
+	/**
+	 * @generated
+	 */
+	protected Command getCompleteCreateRelationshipCommand(
+			CreateRelationshipRequest req) {
+		if (ModelingElementTypes.Transition_4001 == req.getElementType()) {
+			return getGEFWrapper(new TransitionCreateCommand(req, req
+					.getSource(), req.getTarget()));
+		}
+		return null;
+	}
+
+	/**
+	 * Returns command to reorient EClass based link. New link target or source
+	 * should be the domain model element associated with this node.
+	 * 
+	 * @generated
+	 */
+	protected Command getReorientRelationshipCommand(
+			ReorientRelationshipRequest req) {
+		switch (getVisualID(req)) {
+		case TransitionEditPart.VISUAL_ID:
+			return getGEFWrapper(new TransitionReorientCommand(req));
+		}
+		return super.getReorientRelationshipCommand(req);
+	}
+
+}

Propchange: commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/State3ItemSemanticEditPolicy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/StateItemSemanticEditPolicy.java
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/StateItemSemanticEditPolicy.java?rev=953075&view=auto
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/StateItemSemanticEditPolicy.java (added)
+++ commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/StateItemSemanticEditPolicy.java Wed Jun  9 16:29:10 2010
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.commons.scxml.modeling.diagram.edit.policies;
+
+import java.util.Iterator;
+
+import org.apache.commons.scxml.modeling.diagram.edit.commands.TransitionCreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.TransitionReorientCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Anchor2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.FinalState2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.HistoryStateEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.InitialState2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.InvokeEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.OnEntryEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.OnExitEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Parallel2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.State3EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.StateStateCompartmentEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.TransitionEditPart;
+import org.apache.commons.scxml.modeling.diagram.part.ModelingVisualIDRegistry;
+import org.apache.commons.scxml.modeling.diagram.providers.ModelingElementTypes;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class StateItemSemanticEditPolicy extends
+		ModelingBaseItemSemanticEditPolicy {
+
+	/**
+	 * @generated
+	 */
+	protected Command getDestroyElementCommand(DestroyElementRequest req) {
+		CompoundCommand cc = getDestroyEdgesCommand();
+		addDestroyChildNodesCommand(cc);
+		addDestroyShortcutsCommand(cc);
+		View view = (View) getHost().getModel();
+		if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
+			req.setElementToDestroy(view);
+		}
+		cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+		return cc.unwrap();
+	}
+
+	/**
+	 * @generated
+	 */
+	protected void addDestroyChildNodesCommand(CompoundCommand cmd) {
+		View view = (View) getHost().getModel();
+		EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+		if (annotation != null) {
+			return;
+		}
+		for (Iterator it = view.getChildren().iterator(); it.hasNext();) {
+			Node node = (Node) it.next();
+			switch (ModelingVisualIDRegistry.getVisualID(node)) {
+			case StateStateCompartmentEditPart.VISUAL_ID:
+				for (Iterator cit = node.getChildren().iterator(); cit
+						.hasNext();) {
+					Node cnode = (Node) cit.next();
+					switch (ModelingVisualIDRegistry.getVisualID(cnode)) {
+					case OnEntryEditPart.VISUAL_ID:
+						cmd.add(getDestroyElementCommand(cnode));
+						break;
+					case OnExitEditPart.VISUAL_ID:
+						cmd.add(getDestroyElementCommand(cnode));
+						break;
+					case InvokeEditPart.VISUAL_ID:
+						cmd.add(getDestroyElementCommand(cnode));
+						break;
+					case InitialState2EditPart.VISUAL_ID:
+						cmd.add(getDestroyElementCommand(cnode));
+						break;
+					case HistoryStateEditPart.VISUAL_ID:
+						cmd.add(getDestroyElementCommand(cnode));
+						break;
+					case Parallel2EditPart.VISUAL_ID:
+						cmd.add(getDestroyElementCommand(cnode));
+						break;
+					case Anchor2EditPart.VISUAL_ID:
+						cmd.add(getDestroyElementCommand(cnode));
+						break;
+					case FinalState2EditPart.VISUAL_ID:
+						cmd.add(getDestroyElementCommand(cnode));
+						break;
+					case State3EditPart.VISUAL_ID:
+						cmd.add(getDestroyElementCommand(cnode));
+						break;
+					}
+				}
+				break;
+			}
+		}
+	}
+
+	/**
+	 * @generated
+	 */
+	protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+		Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req)
+				: getCompleteCreateRelationshipCommand(req);
+		return command != null ? command : super
+				.getCreateRelationshipCommand(req);
+	}
+
+	/**
+	 * @generated
+	 */
+	protected Command getStartCreateRelationshipCommand(
+			CreateRelationshipRequest req) {
+		if (ModelingElementTypes.Transition_4001 == req.getElementType()) {
+			return getGEFWrapper(new TransitionCreateCommand(req, req
+					.getSource(), req.getTarget()));
+		}
+		return null;
+	}
+
+	/**
+	 * @generated
+	 */
+	protected Command getCompleteCreateRelationshipCommand(
+			CreateRelationshipRequest req) {
+		if (ModelingElementTypes.Transition_4001 == req.getElementType()) {
+			return getGEFWrapper(new TransitionCreateCommand(req, req
+					.getSource(), req.getTarget()));
+		}
+		return null;
+	}
+
+	/**
+	 * Returns command to reorient EClass based link. New link target or source
+	 * should be the domain model element associated with this node.
+	 * 
+	 * @generated
+	 */
+	protected Command getReorientRelationshipCommand(
+			ReorientRelationshipRequest req) {
+		switch (getVisualID(req)) {
+		case TransitionEditPart.VISUAL_ID:
+			return getGEFWrapper(new TransitionReorientCommand(req));
+		}
+		return super.getReorientRelationshipCommand(req);
+	}
+
+}

Propchange: commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/StateItemSemanticEditPolicy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/StateStateCompartment2CanonicalEditPolicy.java
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/StateStateCompartment2CanonicalEditPolicy.java?rev=953075&view=auto
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/StateStateCompartment2CanonicalEditPolicy.java (added)
+++ commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/StateStateCompartment2CanonicalEditPolicy.java Wed Jun  9 16:29:10 2010
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.commons.scxml.modeling.diagram.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.commons.scxml.modeling.ModelingPackage;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Anchor2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.FinalState2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.HistoryStateEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.InitialState2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.InvokeEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.OnEntryEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.OnExitEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Parallel2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.State3EditPart;
+import org.apache.commons.scxml.modeling.diagram.part.ModelingDiagramUpdater;
+import org.apache.commons.scxml.modeling.diagram.part.ModelingNodeDescriptor;
+import org.apache.commons.scxml.modeling.diagram.part.ModelingVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class StateStateCompartment2CanonicalEditPolicy extends
+		CanonicalEditPolicy {
+
+	/**
+	 * @generated
+	 */
+	Set myFeaturesToSynchronize;
+
+	/**
+	 * @generated
+	 */
+	protected List getSemanticChildrenList() {
+		View viewObject = (View) getHost().getModel();
+		List result = new LinkedList();
+		for (Iterator it = ModelingDiagramUpdater
+				.getStateStateCompartment_7016SemanticChildren(viewObject)
+				.iterator(); it.hasNext();) {
+			result.add(((ModelingNodeDescriptor) it.next()).getModelElement());
+		}
+		return result;
+	}
+
+	/**
+	 * @generated
+	 */
+	protected boolean isOrphaned(Collection semanticChildren, final View view) {
+		int visualID = ModelingVisualIDRegistry.getVisualID(view);
+		switch (visualID) {
+		case OnEntryEditPart.VISUAL_ID:
+		case OnExitEditPart.VISUAL_ID:
+		case InvokeEditPart.VISUAL_ID:
+		case InitialState2EditPart.VISUAL_ID:
+		case HistoryStateEditPart.VISUAL_ID:
+		case Parallel2EditPart.VISUAL_ID:
+		case Anchor2EditPart.VISUAL_ID:
+		case FinalState2EditPart.VISUAL_ID:
+		case State3EditPart.VISUAL_ID:
+			if (!semanticChildren.contains(view.getElement())) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	/**
+	 * @generated
+	 */
+	protected String getDefaultFactoryHint() {
+		return null;
+	}
+
+	/**
+	 * @generated
+	 */
+	protected Set getFeaturesToSynchronize() {
+		if (myFeaturesToSynchronize == null) {
+			myFeaturesToSynchronize = new HashSet();
+			myFeaturesToSynchronize.add(ModelingPackage.eINSTANCE
+					.getState_OnEntry());
+			myFeaturesToSynchronize.add(ModelingPackage.eINSTANCE
+					.getState_OnExit());
+			myFeaturesToSynchronize.add(ModelingPackage.eINSTANCE
+					.getState_Invoke());
+			myFeaturesToSynchronize.add(ModelingPackage.eINSTANCE
+					.getState_InitState());
+			myFeaturesToSynchronize.add(ModelingPackage.eINSTANCE
+					.getState_HistoryState());
+			myFeaturesToSynchronize.add(ModelingPackage.eINSTANCE
+					.getState_SubParallel());
+			myFeaturesToSynchronize.add(ModelingPackage.eINSTANCE
+					.getState_Anchor());
+			myFeaturesToSynchronize.add(ModelingPackage.eINSTANCE
+					.getState_FinalState());
+			myFeaturesToSynchronize.add(ModelingPackage.eINSTANCE
+					.getState_SubState());
+		}
+		return myFeaturesToSynchronize;
+	}
+
+}

Propchange: commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/StateStateCompartment2CanonicalEditPolicy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/StateStateCompartment2ItemSemanticEditPolicy.java
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/StateStateCompartment2ItemSemanticEditPolicy.java?rev=953075&view=auto
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/StateStateCompartment2ItemSemanticEditPolicy.java (added)
+++ commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/StateStateCompartment2ItemSemanticEditPolicy.java Wed Jun  9 16:29:10 2010
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.commons.scxml.modeling.diagram.edit.policies;
+
+import org.apache.commons.scxml.modeling.ModelingPackage;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.Anchor2CreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.FinalState2CreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.HistoryStateCreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.InitialState2CreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.InvokeCreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.OnEntryCreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.OnExitCreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.Parallel2CreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.State3CreateCommand;
+import org.apache.commons.scxml.modeling.diagram.providers.ModelingElementTypes;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+
+/**
+ * @generated
+ */
+public class StateStateCompartment2ItemSemanticEditPolicy extends
+		ModelingBaseItemSemanticEditPolicy {
+
+	/**
+	 * @generated
+	 */
+	protected Command getCreateCommand(CreateElementRequest req) {
+		if (ModelingElementTypes.OnEntry_3001 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ModelingPackage.eINSTANCE
+						.getState_OnEntry());
+			}
+			return getGEFWrapper(new OnEntryCreateCommand(req));
+		}
+		if (ModelingElementTypes.OnExit_3016 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ModelingPackage.eINSTANCE
+						.getState_OnExit());
+			}
+			return getGEFWrapper(new OnExitCreateCommand(req));
+		}
+		if (ModelingElementTypes.Invoke_3026 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ModelingPackage.eINSTANCE
+						.getState_Invoke());
+			}
+			return getGEFWrapper(new InvokeCreateCommand(req));
+		}
+		if (ModelingElementTypes.InitialState_3030 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ModelingPackage.eINSTANCE
+						.getState_InitState());
+			}
+			return getGEFWrapper(new InitialState2CreateCommand(req));
+		}
+		if (ModelingElementTypes.HistoryState_3031 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ModelingPackage.eINSTANCE
+						.getState_HistoryState());
+			}
+			return getGEFWrapper(new HistoryStateCreateCommand(req));
+		}
+		if (ModelingElementTypes.Parallel_3032 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ModelingPackage.eINSTANCE
+						.getState_SubParallel());
+			}
+			return getGEFWrapper(new Parallel2CreateCommand(req));
+		}
+		if (ModelingElementTypes.Anchor_3039 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ModelingPackage.eINSTANCE
+						.getState_Anchor());
+			}
+			return getGEFWrapper(new Anchor2CreateCommand(req));
+		}
+		if (ModelingElementTypes.FinalState_3040 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ModelingPackage.eINSTANCE
+						.getState_FinalState());
+			}
+			return getGEFWrapper(new FinalState2CreateCommand(req));
+		}
+		if (ModelingElementTypes.State_3046 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ModelingPackage.eINSTANCE
+						.getState_SubState());
+			}
+			return getGEFWrapper(new State3CreateCommand(req));
+		}
+		return super.getCreateCommand(req);
+	}
+
+}

Propchange: commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/StateStateCompartment2ItemSemanticEditPolicy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/StateStateCompartment3CanonicalEditPolicy.java
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/StateStateCompartment3CanonicalEditPolicy.java?rev=953075&view=auto
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/StateStateCompartment3CanonicalEditPolicy.java (added)
+++ commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/StateStateCompartment3CanonicalEditPolicy.java Wed Jun  9 16:29:10 2010
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.commons.scxml.modeling.diagram.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.commons.scxml.modeling.ModelingPackage;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Anchor2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.FinalState2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.HistoryStateEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.InitialState2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.InvokeEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.OnEntryEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.OnExitEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Parallel2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.State3EditPart;
+import org.apache.commons.scxml.modeling.diagram.part.ModelingDiagramUpdater;
+import org.apache.commons.scxml.modeling.diagram.part.ModelingNodeDescriptor;
+import org.apache.commons.scxml.modeling.diagram.part.ModelingVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class StateStateCompartment3CanonicalEditPolicy extends
+		CanonicalEditPolicy {
+
+	/**
+	 * @generated
+	 */
+	Set myFeaturesToSynchronize;
+
+	/**
+	 * @generated
+	 */
+	protected List getSemanticChildrenList() {
+		View viewObject = (View) getHost().getModel();
+		List result = new LinkedList();
+		for (Iterator it = ModelingDiagramUpdater
+				.getStateStateCompartment_7022SemanticChildren(viewObject)
+				.iterator(); it.hasNext();) {
+			result.add(((ModelingNodeDescriptor) it.next()).getModelElement());
+		}
+		return result;
+	}
+
+	/**
+	 * @generated
+	 */
+	protected boolean isOrphaned(Collection semanticChildren, final View view) {
+		int visualID = ModelingVisualIDRegistry.getVisualID(view);
+		switch (visualID) {
+		case OnEntryEditPart.VISUAL_ID:
+		case OnExitEditPart.VISUAL_ID:
+		case InvokeEditPart.VISUAL_ID:
+		case InitialState2EditPart.VISUAL_ID:
+		case HistoryStateEditPart.VISUAL_ID:
+		case Parallel2EditPart.VISUAL_ID:
+		case Anchor2EditPart.VISUAL_ID:
+		case FinalState2EditPart.VISUAL_ID:
+		case State3EditPart.VISUAL_ID:
+			if (!semanticChildren.contains(view.getElement())) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	/**
+	 * @generated
+	 */
+	protected String getDefaultFactoryHint() {
+		return null;
+	}
+
+	/**
+	 * @generated
+	 */
+	protected Set getFeaturesToSynchronize() {
+		if (myFeaturesToSynchronize == null) {
+			myFeaturesToSynchronize = new HashSet();
+			myFeaturesToSynchronize.add(ModelingPackage.eINSTANCE
+					.getState_OnEntry());
+			myFeaturesToSynchronize.add(ModelingPackage.eINSTANCE
+					.getState_OnExit());
+			myFeaturesToSynchronize.add(ModelingPackage.eINSTANCE
+					.getState_Invoke());
+			myFeaturesToSynchronize.add(ModelingPackage.eINSTANCE
+					.getState_InitState());
+			myFeaturesToSynchronize.add(ModelingPackage.eINSTANCE
+					.getState_HistoryState());
+			myFeaturesToSynchronize.add(ModelingPackage.eINSTANCE
+					.getState_SubParallel());
+			myFeaturesToSynchronize.add(ModelingPackage.eINSTANCE
+					.getState_Anchor());
+			myFeaturesToSynchronize.add(ModelingPackage.eINSTANCE
+					.getState_FinalState());
+			myFeaturesToSynchronize.add(ModelingPackage.eINSTANCE
+					.getState_SubState());
+		}
+		return myFeaturesToSynchronize;
+	}
+
+}

Propchange: commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/StateStateCompartment3CanonicalEditPolicy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/StateStateCompartment3ItemSemanticEditPolicy.java
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/StateStateCompartment3ItemSemanticEditPolicy.java?rev=953075&view=auto
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/StateStateCompartment3ItemSemanticEditPolicy.java (added)
+++ commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/StateStateCompartment3ItemSemanticEditPolicy.java Wed Jun  9 16:29:10 2010
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.commons.scxml.modeling.diagram.edit.policies;
+
+import org.apache.commons.scxml.modeling.ModelingPackage;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.Anchor2CreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.FinalState2CreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.HistoryStateCreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.InitialState2CreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.InvokeCreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.OnEntryCreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.OnExitCreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.Parallel2CreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.State3CreateCommand;
+import org.apache.commons.scxml.modeling.diagram.providers.ModelingElementTypes;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+
+/**
+ * @generated
+ */
+public class StateStateCompartment3ItemSemanticEditPolicy extends
+		ModelingBaseItemSemanticEditPolicy {
+
+	/**
+	 * @generated
+	 */
+	protected Command getCreateCommand(CreateElementRequest req) {
+		if (ModelingElementTypes.OnEntry_3001 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ModelingPackage.eINSTANCE
+						.getState_OnEntry());
+			}
+			return getGEFWrapper(new OnEntryCreateCommand(req));
+		}
+		if (ModelingElementTypes.OnExit_3016 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ModelingPackage.eINSTANCE
+						.getState_OnExit());
+			}
+			return getGEFWrapper(new OnExitCreateCommand(req));
+		}
+		if (ModelingElementTypes.Invoke_3026 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ModelingPackage.eINSTANCE
+						.getState_Invoke());
+			}
+			return getGEFWrapper(new InvokeCreateCommand(req));
+		}
+		if (ModelingElementTypes.InitialState_3030 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ModelingPackage.eINSTANCE
+						.getState_InitState());
+			}
+			return getGEFWrapper(new InitialState2CreateCommand(req));
+		}
+		if (ModelingElementTypes.HistoryState_3031 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ModelingPackage.eINSTANCE
+						.getState_HistoryState());
+			}
+			return getGEFWrapper(new HistoryStateCreateCommand(req));
+		}
+		if (ModelingElementTypes.Parallel_3032 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ModelingPackage.eINSTANCE
+						.getState_SubParallel());
+			}
+			return getGEFWrapper(new Parallel2CreateCommand(req));
+		}
+		if (ModelingElementTypes.Anchor_3039 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ModelingPackage.eINSTANCE
+						.getState_Anchor());
+			}
+			return getGEFWrapper(new Anchor2CreateCommand(req));
+		}
+		if (ModelingElementTypes.FinalState_3040 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ModelingPackage.eINSTANCE
+						.getState_FinalState());
+			}
+			return getGEFWrapper(new FinalState2CreateCommand(req));
+		}
+		if (ModelingElementTypes.State_3046 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ModelingPackage.eINSTANCE
+						.getState_SubState());
+			}
+			return getGEFWrapper(new State3CreateCommand(req));
+		}
+		return super.getCreateCommand(req);
+	}
+
+}