commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gu...@apache.org
Subject svn commit: r945185 [28/42] - in /commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.diagram: ./ META-INF/ bin/ icons/ icons/obj16/ icons/wizban/ src/ src/org/ src/org/apache/ src/org/apache/commons/ src/org/apache/com...
Date Mon, 17 May 2010 14:38:59 GMT
Added: commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.diagram/src/org/apache/commons/scxml/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.diagram/src/org/apache/commons/scxml/diagram/edit/policies/ServiceTemplateCanonicalEditPolicy.java?rev=945185&view=auto
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.diagram/src/org/apache/commons/scxml/diagram/edit/policies/ServiceTemplateCanonicalEditPolicy.java (added)
+++ commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.diagram/src/org/apache/commons/scxml/diagram/edit/policies/ServiceTemplateCanonicalEditPolicy.java Mon May 17 14:38:45 2010
@@ -0,0 +1,975 @@
+/*
+ * 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.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.ScxmlPackage;
+import org.apache.commons.scxml.diagram.edit.parts.Anchor2EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.AnchorEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.Assign2EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.AssignEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.Cancel2EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.CancelEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.Content2EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.Content3EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.Content4EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.Content5EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.ContentEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.DataEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.DataModelEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.DonedataEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.ElseEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.ElseIfEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.FinalState2EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.FinalStateEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.FinalizeEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.HistoryState2EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.HistoryStateEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.If2EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.IfEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.InitialState2EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.InitialStateEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.InvokeEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.Log2EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.LogEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.OnEntry2EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.OnEntry3EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.OnEntryEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.OnExit2EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.OnExit3EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.OnExitEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.Parallel2EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.Parallel3EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.ParallelEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.Param2EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.Param3EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.Param4EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.Param5EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.ParamEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.Raise2EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.RaiseEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.Script2EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.Script3EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.ScriptEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.Send2EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.SendEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.ServiceTemplateEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.State2EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.State3EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.StateEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.TranslationEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.Validate2EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.ValidateEditPart;
+import org.apache.commons.scxml.diagram.part.ScxmlDiagramUpdater;
+import org.apache.commons.scxml.diagram.part.ScxmlLinkDescriptor;
+import org.apache.commons.scxml.diagram.part.ScxmlNodeDescriptor;
+import org.apache.commons.scxml.diagram.part.ScxmlVisualIDRegistry;
+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 = ScxmlDiagramUpdater
+				.getServiceTemplate_79SemanticChildren(viewObject).iterator(); it
+				.hasNext();) {
+			result.add(((ScxmlNodeDescriptor) it.next()).getModelElement());
+		}
+		return result;
+	}
+
+	/**
+	 * @generated
+	 */
+	protected boolean shouldDeleteView(View view) {
+		return true;
+	}
+
+	/**
+	 * @generated
+	 */
+	protected boolean isOrphaned(Collection semanticChildren, final View view) {
+		int visualID = ScxmlVisualIDRegistry.getVisualID(view);
+		switch (visualID) {
+		case StateEditPart.VISUAL_ID:
+		case InitialStateEditPart.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(ScxmlPackage.eINSTANCE
+					.getServiceTemplate_StateList());
+			myFeaturesToSynchronize.add(ScxmlPackage.eINSTANCE
+					.getServiceTemplate_InitialState());
+			myFeaturesToSynchronize.add(ScxmlPackage.eINSTANCE
+					.getServiceTemplate_Script());
+			myFeaturesToSynchronize.add(ScxmlPackage.eINSTANCE
+					.getServiceTemplate_Parallel());
+			myFeaturesToSynchronize.add(ScxmlPackage.eINSTANCE
+					.getServiceTemplate_DataModel());
+			myFeaturesToSynchronize.add(ScxmlPackage.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 = ScxmlVisualIDRegistry
+					.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();) {
+				ScxmlLinkDescriptor nextLinkDescriptor = (ScxmlLinkDescriptor) 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(ScxmlVisualIDRegistry
+				.getModelID(view))) {
+			return Collections.EMPTY_LIST;
+		}
+		Collection result = new LinkedList();
+		switch (ScxmlVisualIDRegistry.getVisualID(view)) {
+		case ServiceTemplateEditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ScxmlDiagramUpdater
+						.getServiceTemplate_79ContainedLinks(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(ScxmlDiagramUpdater
+						.getState_1001ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case InitialStateEditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ScxmlDiagramUpdater
+						.getInitialState_1002ContainedLinks(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(ScxmlDiagramUpdater
+						.getScript_1003ContainedLinks(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(ScxmlDiagramUpdater
+						.getParallel_1004ContainedLinks(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(ScxmlDiagramUpdater
+						.getDataModel_1005ContainedLinks(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(ScxmlDiagramUpdater
+						.getFinalState_1006ContainedLinks(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(ScxmlDiagramUpdater
+						.getOnEntry_2001ContainedLinks(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(ScxmlDiagramUpdater
+						.getIf_2002ContainedLinks(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(ScxmlDiagramUpdater
+						.getElseIf_2003ContainedLinks(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(ScxmlDiagramUpdater
+						.getElse_2004ContainedLinks(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(ScxmlDiagramUpdater
+						.getAssign_2005ContainedLinks(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(ScxmlDiagramUpdater
+						.getRaise_2006ContainedLinks(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(ScxmlDiagramUpdater
+						.getLog_2007ContainedLinks(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(ScxmlDiagramUpdater
+						.getValidate_2008ContainedLinks(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(ScxmlDiagramUpdater
+						.getCancel_2009ContainedLinks(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(ScxmlDiagramUpdater
+						.getSend_2010ContainedLinks(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(ScxmlDiagramUpdater
+						.getParam_2011ContainedLinks(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(ScxmlDiagramUpdater
+						.getContent_2012ContainedLinks(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(ScxmlDiagramUpdater
+						.getContent_2013ContainedLinks(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(ScxmlDiagramUpdater
+						.getParam_2014ContainedLinks(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(ScxmlDiagramUpdater
+						.getScript_2015ContainedLinks(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(ScxmlDiagramUpdater
+						.getOnExit_2016ContainedLinks(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(ScxmlDiagramUpdater
+						.getIf_2017ContainedLinks(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(ScxmlDiagramUpdater
+						.getAssign_2018ContainedLinks(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(ScxmlDiagramUpdater
+						.getRaise_2019ContainedLinks(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(ScxmlDiagramUpdater
+						.getLog_2020ContainedLinks(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(ScxmlDiagramUpdater
+						.getValidate_2021ContainedLinks(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(ScxmlDiagramUpdater
+						.getCancel_2022ContainedLinks(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(ScxmlDiagramUpdater
+						.getParam_2023ContainedLinks(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(ScxmlDiagramUpdater
+						.getSend_2024ContainedLinks(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(ScxmlDiagramUpdater
+						.getScript_2025ContainedLinks(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(ScxmlDiagramUpdater
+						.getInvoke_2026ContainedLinks(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(ScxmlDiagramUpdater
+						.getFinalize_2027ContainedLinks(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(ScxmlDiagramUpdater
+						.getParam_2028ContainedLinks(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(ScxmlDiagramUpdater
+						.getContent_2029ContainedLinks(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(ScxmlDiagramUpdater
+						.getInitialState_2030ContainedLinks(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(ScxmlDiagramUpdater
+						.getHistoryState_2031ContainedLinks(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(ScxmlDiagramUpdater
+						.getParallel_2032ContainedLinks(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(ScxmlDiagramUpdater
+						.getHistoryState_2033ContainedLinks(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(ScxmlDiagramUpdater
+						.getAnchor_2034ContainedLinks(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(ScxmlDiagramUpdater
+						.getParallel_2035ContainedLinks(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(ScxmlDiagramUpdater
+						.getOnEntry_2036ContainedLinks(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(ScxmlDiagramUpdater
+						.getOnExit_2037ContainedLinks(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(ScxmlDiagramUpdater
+						.getState_2038ContainedLinks(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(ScxmlDiagramUpdater
+						.getAnchor_2039ContainedLinks(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(ScxmlDiagramUpdater
+						.getFinalState_2040ContainedLinks(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(ScxmlDiagramUpdater
+						.getDonedata_2041ContainedLinks(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(ScxmlDiagramUpdater
+						.getParam_2042ContainedLinks(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(ScxmlDiagramUpdater
+						.getContent_2043ContainedLinks(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(ScxmlDiagramUpdater
+						.getOnEntry_2044ContainedLinks(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(ScxmlDiagramUpdater
+						.getOnExit_2045ContainedLinks(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(ScxmlDiagramUpdater
+						.getState_2046ContainedLinks(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(ScxmlDiagramUpdater
+						.getData_2047ContainedLinks(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(ScxmlDiagramUpdater
+						.getContent_2048ContainedLinks(view));
+			}
+			if (!domain2NotationMap.containsKey(view.getElement())
+					|| view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+				domain2NotationMap.put(view.getElement(), view);
+			}
+			break;
+		}
+		case TranslationEditPart.VISUAL_ID: {
+			if (!domain2NotationMap.containsKey(view.getElement())) {
+				result.addAll(ScxmlDiagramUpdater
+						.getTranslation_3001ContainedLinks(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 ScxmlLinkDescriptor nextLinkDescriptor = (ScxmlLinkDescriptor) 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.diagram/src/org/apache/commons/scxml/diagram/edit/policies/ServiceTemplateCanonicalEditPolicy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.diagram/src/org/apache/commons/scxml/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.diagram/src/org/apache/commons/scxml/diagram/edit/policies/ServiceTemplateItemSemanticEditPolicy.java?rev=945185&view=auto
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.diagram/src/org/apache/commons/scxml/diagram/edit/policies/ServiceTemplateItemSemanticEditPolicy.java (added)
+++ commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.diagram/src/org/apache/commons/scxml/diagram/edit/policies/ServiceTemplateItemSemanticEditPolicy.java Mon May 17 14:38:45 2010
@@ -0,0 +1,117 @@
+/*
+ * 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.diagram.edit.policies;
+
+import org.apache.commons.scxml.ScxmlPackage;
+import org.apache.commons.scxml.diagram.edit.commands.DataModelCreateCommand;
+import org.apache.commons.scxml.diagram.edit.commands.FinalStateCreateCommand;
+import org.apache.commons.scxml.diagram.edit.commands.InitialStateCreateCommand;
+import org.apache.commons.scxml.diagram.edit.commands.ParallelCreateCommand;
+import org.apache.commons.scxml.diagram.edit.commands.ScriptCreateCommand;
+import org.apache.commons.scxml.diagram.edit.commands.StateCreateCommand;
+import org.apache.commons.scxml.diagram.providers.ScxmlElementTypes;
+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
+		ScxmlBaseItemSemanticEditPolicy {
+
+	/**
+	 * @generated
+	 */
+	protected Command getCreateCommand(CreateElementRequest req) {
+		if (ScxmlElementTypes.State_1001 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ScxmlPackage.eINSTANCE
+						.getServiceTemplate_StateList());
+			}
+			return getGEFWrapper(new StateCreateCommand(req));
+		}
+		if (ScxmlElementTypes.InitialState_1002 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ScxmlPackage.eINSTANCE
+						.getServiceTemplate_InitialState());
+			}
+			return getGEFWrapper(new InitialStateCreateCommand(req));
+		}
+		if (ScxmlElementTypes.Script_1003 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ScxmlPackage.eINSTANCE
+						.getServiceTemplate_Script());
+			}
+			return getGEFWrapper(new ScriptCreateCommand(req));
+		}
+		if (ScxmlElementTypes.Parallel_1004 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ScxmlPackage.eINSTANCE
+						.getServiceTemplate_Parallel());
+			}
+			return getGEFWrapper(new ParallelCreateCommand(req));
+		}
+		if (ScxmlElementTypes.DataModel_1005 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ScxmlPackage.eINSTANCE
+						.getServiceTemplate_DataModel());
+			}
+			return getGEFWrapper(new DataModelCreateCommand(req));
+		}
+		if (ScxmlElementTypes.FinalState_1006 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ScxmlPackage.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.diagram/src/org/apache/commons/scxml/diagram/edit/policies/ServiceTemplateItemSemanticEditPolicy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.diagram/src/org/apache/commons/scxml/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.diagram/src/org/apache/commons/scxml/diagram/edit/policies/State2ItemSemanticEditPolicy.java?rev=945185&view=auto
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.diagram/src/org/apache/commons/scxml/diagram/edit/policies/State2ItemSemanticEditPolicy.java (added)
+++ commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.diagram/src/org/apache/commons/scxml/diagram/edit/policies/State2ItemSemanticEditPolicy.java Mon May 17 14:38:45 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.diagram.edit.policies;
+
+import java.util.Iterator;
+
+import org.apache.commons.scxml.diagram.edit.commands.TranslationCreateCommand;
+import org.apache.commons.scxml.diagram.edit.commands.TranslationReorientCommand;
+import org.apache.commons.scxml.diagram.edit.parts.Anchor2EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.FinalState2EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.HistoryStateEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.InitialState2EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.InvokeEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.OnEntryEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.OnExitEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.Parallel2EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.State3EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.StateStateCompartment2EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.TranslationEditPart;
+import org.apache.commons.scxml.diagram.part.ScxmlVisualIDRegistry;
+import org.apache.commons.scxml.diagram.providers.ScxmlElementTypes;
+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
+		ScxmlBaseItemSemanticEditPolicy {
+
+	/**
+	 * @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 (ScxmlVisualIDRegistry.getVisualID(node)) {
+			case StateStateCompartment2EditPart.VISUAL_ID:
+				for (Iterator cit = node.getChildren().iterator(); cit
+						.hasNext();) {
+					Node cnode = (Node) cit.next();
+					switch (ScxmlVisualIDRegistry.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 (ScxmlElementTypes.Translation_3001 == req.getElementType()) {
+			return getGEFWrapper(new TranslationCreateCommand(req, req
+					.getSource(), req.getTarget()));
+		}
+		return null;
+	}
+
+	/**
+	 * @generated
+	 */
+	protected Command getCompleteCreateRelationshipCommand(
+			CreateRelationshipRequest req) {
+		if (ScxmlElementTypes.Translation_3001 == req.getElementType()) {
+			return getGEFWrapper(new TranslationCreateCommand(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 TranslationEditPart.VISUAL_ID:
+			return getGEFWrapper(new TranslationReorientCommand(req));
+		}
+		return super.getReorientRelationshipCommand(req);
+	}
+
+}

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

Added: commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.diagram/src/org/apache/commons/scxml/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.diagram/src/org/apache/commons/scxml/diagram/edit/policies/State3ItemSemanticEditPolicy.java?rev=945185&view=auto
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.diagram/src/org/apache/commons/scxml/diagram/edit/policies/State3ItemSemanticEditPolicy.java (added)
+++ commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.diagram/src/org/apache/commons/scxml/diagram/edit/policies/State3ItemSemanticEditPolicy.java Mon May 17 14:38:45 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.diagram.edit.policies;
+
+import java.util.Iterator;
+
+import org.apache.commons.scxml.diagram.edit.commands.TranslationCreateCommand;
+import org.apache.commons.scxml.diagram.edit.commands.TranslationReorientCommand;
+import org.apache.commons.scxml.diagram.edit.parts.Anchor2EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.FinalState2EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.HistoryStateEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.InitialState2EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.InvokeEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.OnEntryEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.OnExitEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.Parallel2EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.State3EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.StateStateCompartment3EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.TranslationEditPart;
+import org.apache.commons.scxml.diagram.part.ScxmlVisualIDRegistry;
+import org.apache.commons.scxml.diagram.providers.ScxmlElementTypes;
+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
+		ScxmlBaseItemSemanticEditPolicy {
+
+	/**
+	 * @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 (ScxmlVisualIDRegistry.getVisualID(node)) {
+			case StateStateCompartment3EditPart.VISUAL_ID:
+				for (Iterator cit = node.getChildren().iterator(); cit
+						.hasNext();) {
+					Node cnode = (Node) cit.next();
+					switch (ScxmlVisualIDRegistry.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 (ScxmlElementTypes.Translation_3001 == req.getElementType()) {
+			return getGEFWrapper(new TranslationCreateCommand(req, req
+					.getSource(), req.getTarget()));
+		}
+		return null;
+	}
+
+	/**
+	 * @generated
+	 */
+	protected Command getCompleteCreateRelationshipCommand(
+			CreateRelationshipRequest req) {
+		if (ScxmlElementTypes.Translation_3001 == req.getElementType()) {
+			return getGEFWrapper(new TranslationCreateCommand(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 TranslationEditPart.VISUAL_ID:
+			return getGEFWrapper(new TranslationReorientCommand(req));
+		}
+		return super.getReorientRelationshipCommand(req);
+	}
+
+}

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

Added: commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.diagram/src/org/apache/commons/scxml/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.diagram/src/org/apache/commons/scxml/diagram/edit/policies/StateItemSemanticEditPolicy.java?rev=945185&view=auto
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.diagram/src/org/apache/commons/scxml/diagram/edit/policies/StateItemSemanticEditPolicy.java (added)
+++ commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.diagram/src/org/apache/commons/scxml/diagram/edit/policies/StateItemSemanticEditPolicy.java Mon May 17 14:38:45 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.diagram.edit.policies;
+
+import java.util.Iterator;
+
+import org.apache.commons.scxml.diagram.edit.commands.TranslationCreateCommand;
+import org.apache.commons.scxml.diagram.edit.commands.TranslationReorientCommand;
+import org.apache.commons.scxml.diagram.edit.parts.Anchor2EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.FinalState2EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.HistoryStateEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.InitialState2EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.InvokeEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.OnEntryEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.OnExitEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.Parallel2EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.State3EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.StateStateCompartmentEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.TranslationEditPart;
+import org.apache.commons.scxml.diagram.part.ScxmlVisualIDRegistry;
+import org.apache.commons.scxml.diagram.providers.ScxmlElementTypes;
+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
+		ScxmlBaseItemSemanticEditPolicy {
+
+	/**
+	 * @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 (ScxmlVisualIDRegistry.getVisualID(node)) {
+			case StateStateCompartmentEditPart.VISUAL_ID:
+				for (Iterator cit = node.getChildren().iterator(); cit
+						.hasNext();) {
+					Node cnode = (Node) cit.next();
+					switch (ScxmlVisualIDRegistry.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 (ScxmlElementTypes.Translation_3001 == req.getElementType()) {
+			return getGEFWrapper(new TranslationCreateCommand(req, req
+					.getSource(), req.getTarget()));
+		}
+		return null;
+	}
+
+	/**
+	 * @generated
+	 */
+	protected Command getCompleteCreateRelationshipCommand(
+			CreateRelationshipRequest req) {
+		if (ScxmlElementTypes.Translation_3001 == req.getElementType()) {
+			return getGEFWrapper(new TranslationCreateCommand(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 TranslationEditPart.VISUAL_ID:
+			return getGEFWrapper(new TranslationReorientCommand(req));
+		}
+		return super.getReorientRelationshipCommand(req);
+	}
+
+}

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

Added: commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.diagram/src/org/apache/commons/scxml/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.diagram/src/org/apache/commons/scxml/diagram/edit/policies/StateStateCompartment2CanonicalEditPolicy.java?rev=945185&view=auto
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.diagram/src/org/apache/commons/scxml/diagram/edit/policies/StateStateCompartment2CanonicalEditPolicy.java (added)
+++ commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.diagram/src/org/apache/commons/scxml/diagram/edit/policies/StateStateCompartment2CanonicalEditPolicy.java Mon May 17 14:38:45 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.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.ScxmlPackage;
+import org.apache.commons.scxml.diagram.edit.parts.Anchor2EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.FinalState2EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.HistoryStateEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.InitialState2EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.InvokeEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.OnEntryEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.OnExitEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.Parallel2EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.State3EditPart;
+import org.apache.commons.scxml.diagram.part.ScxmlDiagramUpdater;
+import org.apache.commons.scxml.diagram.part.ScxmlNodeDescriptor;
+import org.apache.commons.scxml.diagram.part.ScxmlVisualIDRegistry;
+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 = ScxmlDiagramUpdater
+				.getStateStateCompartment_5016SemanticChildren(viewObject)
+				.iterator(); it.hasNext();) {
+			result.add(((ScxmlNodeDescriptor) it.next()).getModelElement());
+		}
+		return result;
+	}
+
+	/**
+	 * @generated
+	 */
+	protected boolean isOrphaned(Collection semanticChildren, final View view) {
+		int visualID = ScxmlVisualIDRegistry.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(ScxmlPackage.eINSTANCE
+					.getState_OnEntry());
+			myFeaturesToSynchronize.add(ScxmlPackage.eINSTANCE
+					.getState_OnExit());
+			myFeaturesToSynchronize.add(ScxmlPackage.eINSTANCE
+					.getState_Invoke());
+			myFeaturesToSynchronize.add(ScxmlPackage.eINSTANCE
+					.getState_InitState());
+			myFeaturesToSynchronize.add(ScxmlPackage.eINSTANCE
+					.getState_HistoryState());
+			myFeaturesToSynchronize.add(ScxmlPackage.eINSTANCE
+					.getState_SubParallel());
+			myFeaturesToSynchronize.add(ScxmlPackage.eINSTANCE
+					.getState_Anchor());
+			myFeaturesToSynchronize.add(ScxmlPackage.eINSTANCE
+					.getState_FinalState());
+			myFeaturesToSynchronize.add(ScxmlPackage.eINSTANCE
+					.getState_SubState());
+		}
+		return myFeaturesToSynchronize;
+	}
+
+}

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

Added: commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.diagram/src/org/apache/commons/scxml/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.diagram/src/org/apache/commons/scxml/diagram/edit/policies/StateStateCompartment2ItemSemanticEditPolicy.java?rev=945185&view=auto
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.diagram/src/org/apache/commons/scxml/diagram/edit/policies/StateStateCompartment2ItemSemanticEditPolicy.java (added)
+++ commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.diagram/src/org/apache/commons/scxml/diagram/edit/policies/StateStateCompartment2ItemSemanticEditPolicy.java Mon May 17 14:38:45 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.diagram.edit.policies;
+
+import org.apache.commons.scxml.ScxmlPackage;
+import org.apache.commons.scxml.diagram.edit.commands.Anchor2CreateCommand;
+import org.apache.commons.scxml.diagram.edit.commands.FinalState2CreateCommand;
+import org.apache.commons.scxml.diagram.edit.commands.HistoryStateCreateCommand;
+import org.apache.commons.scxml.diagram.edit.commands.InitialState2CreateCommand;
+import org.apache.commons.scxml.diagram.edit.commands.InvokeCreateCommand;
+import org.apache.commons.scxml.diagram.edit.commands.OnEntryCreateCommand;
+import org.apache.commons.scxml.diagram.edit.commands.OnExitCreateCommand;
+import org.apache.commons.scxml.diagram.edit.commands.Parallel2CreateCommand;
+import org.apache.commons.scxml.diagram.edit.commands.State3CreateCommand;
+import org.apache.commons.scxml.diagram.providers.ScxmlElementTypes;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+
+/**
+ * @generated
+ */
+public class StateStateCompartment2ItemSemanticEditPolicy extends
+		ScxmlBaseItemSemanticEditPolicy {
+
+	/**
+	 * @generated
+	 */
+	protected Command getCreateCommand(CreateElementRequest req) {
+		if (ScxmlElementTypes.OnEntry_2001 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ScxmlPackage.eINSTANCE
+						.getState_OnEntry());
+			}
+			return getGEFWrapper(new OnEntryCreateCommand(req));
+		}
+		if (ScxmlElementTypes.OnExit_2016 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ScxmlPackage.eINSTANCE
+						.getState_OnExit());
+			}
+			return getGEFWrapper(new OnExitCreateCommand(req));
+		}
+		if (ScxmlElementTypes.Invoke_2026 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ScxmlPackage.eINSTANCE
+						.getState_Invoke());
+			}
+			return getGEFWrapper(new InvokeCreateCommand(req));
+		}
+		if (ScxmlElementTypes.InitialState_2030 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ScxmlPackage.eINSTANCE
+						.getState_InitState());
+			}
+			return getGEFWrapper(new InitialState2CreateCommand(req));
+		}
+		if (ScxmlElementTypes.HistoryState_2031 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ScxmlPackage.eINSTANCE
+						.getState_HistoryState());
+			}
+			return getGEFWrapper(new HistoryStateCreateCommand(req));
+		}
+		if (ScxmlElementTypes.Parallel_2032 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ScxmlPackage.eINSTANCE
+						.getState_SubParallel());
+			}
+			return getGEFWrapper(new Parallel2CreateCommand(req));
+		}
+		if (ScxmlElementTypes.Anchor_2039 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ScxmlPackage.eINSTANCE
+						.getState_Anchor());
+			}
+			return getGEFWrapper(new Anchor2CreateCommand(req));
+		}
+		if (ScxmlElementTypes.FinalState_2040 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ScxmlPackage.eINSTANCE
+						.getState_FinalState());
+			}
+			return getGEFWrapper(new FinalState2CreateCommand(req));
+		}
+		if (ScxmlElementTypes.State_2046 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ScxmlPackage.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.diagram/src/org/apache/commons/scxml/diagram/edit/policies/StateStateCompartment2ItemSemanticEditPolicy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.diagram/src/org/apache/commons/scxml/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.diagram/src/org/apache/commons/scxml/diagram/edit/policies/StateStateCompartment3CanonicalEditPolicy.java?rev=945185&view=auto
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.diagram/src/org/apache/commons/scxml/diagram/edit/policies/StateStateCompartment3CanonicalEditPolicy.java (added)
+++ commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.diagram/src/org/apache/commons/scxml/diagram/edit/policies/StateStateCompartment3CanonicalEditPolicy.java Mon May 17 14:38:45 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.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.ScxmlPackage;
+import org.apache.commons.scxml.diagram.edit.parts.Anchor2EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.FinalState2EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.HistoryStateEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.InitialState2EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.InvokeEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.OnEntryEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.OnExitEditPart;
+import org.apache.commons.scxml.diagram.edit.parts.Parallel2EditPart;
+import org.apache.commons.scxml.diagram.edit.parts.State3EditPart;
+import org.apache.commons.scxml.diagram.part.ScxmlDiagramUpdater;
+import org.apache.commons.scxml.diagram.part.ScxmlNodeDescriptor;
+import org.apache.commons.scxml.diagram.part.ScxmlVisualIDRegistry;
+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 = ScxmlDiagramUpdater
+				.getStateStateCompartment_5022SemanticChildren(viewObject)
+				.iterator(); it.hasNext();) {
+			result.add(((ScxmlNodeDescriptor) it.next()).getModelElement());
+		}
+		return result;
+	}
+
+	/**
+	 * @generated
+	 */
+	protected boolean isOrphaned(Collection semanticChildren, final View view) {
+		int visualID = ScxmlVisualIDRegistry.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(ScxmlPackage.eINSTANCE
+					.getState_OnEntry());
+			myFeaturesToSynchronize.add(ScxmlPackage.eINSTANCE
+					.getState_OnExit());
+			myFeaturesToSynchronize.add(ScxmlPackage.eINSTANCE
+					.getState_Invoke());
+			myFeaturesToSynchronize.add(ScxmlPackage.eINSTANCE
+					.getState_InitState());
+			myFeaturesToSynchronize.add(ScxmlPackage.eINSTANCE
+					.getState_HistoryState());
+			myFeaturesToSynchronize.add(ScxmlPackage.eINSTANCE
+					.getState_SubParallel());
+			myFeaturesToSynchronize.add(ScxmlPackage.eINSTANCE
+					.getState_Anchor());
+			myFeaturesToSynchronize.add(ScxmlPackage.eINSTANCE
+					.getState_FinalState());
+			myFeaturesToSynchronize.add(ScxmlPackage.eINSTANCE
+					.getState_SubState());
+		}
+		return myFeaturesToSynchronize;
+	}
+
+}

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

Added: commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.diagram/src/org/apache/commons/scxml/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.diagram/src/org/apache/commons/scxml/diagram/edit/policies/StateStateCompartment3ItemSemanticEditPolicy.java?rev=945185&view=auto
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.diagram/src/org/apache/commons/scxml/diagram/edit/policies/StateStateCompartment3ItemSemanticEditPolicy.java (added)
+++ commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.diagram/src/org/apache/commons/scxml/diagram/edit/policies/StateStateCompartment3ItemSemanticEditPolicy.java Mon May 17 14:38:45 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.diagram.edit.policies;
+
+import org.apache.commons.scxml.ScxmlPackage;
+import org.apache.commons.scxml.diagram.edit.commands.Anchor2CreateCommand;
+import org.apache.commons.scxml.diagram.edit.commands.FinalState2CreateCommand;
+import org.apache.commons.scxml.diagram.edit.commands.HistoryStateCreateCommand;
+import org.apache.commons.scxml.diagram.edit.commands.InitialState2CreateCommand;
+import org.apache.commons.scxml.diagram.edit.commands.InvokeCreateCommand;
+import org.apache.commons.scxml.diagram.edit.commands.OnEntryCreateCommand;
+import org.apache.commons.scxml.diagram.edit.commands.OnExitCreateCommand;
+import org.apache.commons.scxml.diagram.edit.commands.Parallel2CreateCommand;
+import org.apache.commons.scxml.diagram.edit.commands.State3CreateCommand;
+import org.apache.commons.scxml.diagram.providers.ScxmlElementTypes;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+
+/**
+ * @generated
+ */
+public class StateStateCompartment3ItemSemanticEditPolicy extends
+		ScxmlBaseItemSemanticEditPolicy {
+
+	/**
+	 * @generated
+	 */
+	protected Command getCreateCommand(CreateElementRequest req) {
+		if (ScxmlElementTypes.OnEntry_2001 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ScxmlPackage.eINSTANCE
+						.getState_OnEntry());
+			}
+			return getGEFWrapper(new OnEntryCreateCommand(req));
+		}
+		if (ScxmlElementTypes.OnExit_2016 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ScxmlPackage.eINSTANCE
+						.getState_OnExit());
+			}
+			return getGEFWrapper(new OnExitCreateCommand(req));
+		}
+		if (ScxmlElementTypes.Invoke_2026 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ScxmlPackage.eINSTANCE
+						.getState_Invoke());
+			}
+			return getGEFWrapper(new InvokeCreateCommand(req));
+		}
+		if (ScxmlElementTypes.InitialState_2030 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ScxmlPackage.eINSTANCE
+						.getState_InitState());
+			}
+			return getGEFWrapper(new InitialState2CreateCommand(req));
+		}
+		if (ScxmlElementTypes.HistoryState_2031 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ScxmlPackage.eINSTANCE
+						.getState_HistoryState());
+			}
+			return getGEFWrapper(new HistoryStateCreateCommand(req));
+		}
+		if (ScxmlElementTypes.Parallel_2032 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ScxmlPackage.eINSTANCE
+						.getState_SubParallel());
+			}
+			return getGEFWrapper(new Parallel2CreateCommand(req));
+		}
+		if (ScxmlElementTypes.Anchor_2039 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ScxmlPackage.eINSTANCE
+						.getState_Anchor());
+			}
+			return getGEFWrapper(new Anchor2CreateCommand(req));
+		}
+		if (ScxmlElementTypes.FinalState_2040 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ScxmlPackage.eINSTANCE
+						.getState_FinalState());
+			}
+			return getGEFWrapper(new FinalState2CreateCommand(req));
+		}
+		if (ScxmlElementTypes.State_2046 == req.getElementType()) {
+			if (req.getContainmentFeature() == null) {
+				req.setContainmentFeature(ScxmlPackage.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.diagram/src/org/apache/commons/scxml/diagram/edit/policies/StateStateCompartment3ItemSemanticEditPolicy.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message