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/StateStateCompartment3ItemSemanticEditPolicy.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/StateStateCompartmentCanonicalEditPolicy.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/StateStateCompartmentCanonicalEditPolicy.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/StateStateCompartmentCanonicalEditPolicy.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/StateStateCompartmentCanonicalEditPolicy.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 StateStateCompartmentCanonicalEditPolicy extends
+               CanonicalEditPolicy {
+
+       /**
+        * @generated
+        */
+       Set myFeaturesToSynchronize;
+
+       /**
+        * @generated
+        */
+       protected List getSemanticChildrenList() {
+               View viewObject = (View) getHost().getModel();
+               List result = new LinkedList();
+               for (Iterator it = ModelingDiagramUpdater
+                               
.getStateStateCompartment_7001SemanticChildren(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/StateStateCompartmentCanonicalEditPolicy.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/StateStateCompartmentItemSemanticEditPolicy.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/StateStateCompartmentItemSemanticEditPolicy.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/StateStateCompartmentItemSemanticEditPolicy.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/StateStateCompartmentItemSemanticEditPolicy.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 StateStateCompartmentItemSemanticEditPolicy 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/StateStateCompartmentItemSemanticEditPolicy.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/TransitionItemSemanticEditPolicy.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/TransitionItemSemanticEditPolicy.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/TransitionItemSemanticEditPolicy.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/TransitionItemSemanticEditPolicy.java
 Wed Jun  9 16:29:10 2010
@@ -0,0 +1,36 @@
+/*
+ * 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.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+
+/**
+ * @generated
+ */
+public class TransitionItemSemanticEditPolicy extends
+               ModelingBaseItemSemanticEditPolicy {
+
+       /**
+        * @generated
+        */
+       protected Command getDestroyElementCommand(DestroyElementRequest req) {
+               return getGEFWrapper(new DestroyElementCommand(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/TransitionItemSemanticEditPolicy.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/Validate2ItemSemanticEditPolicy.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/Validate2ItemSemanticEditPolicy.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/Validate2ItemSemanticEditPolicy.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/Validate2ItemSemanticEditPolicy.java
 Wed Jun  9 16:29:10 2010
@@ -0,0 +1,40 @@
+/*
+ * 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.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.DestroyElementRequest;
+
+/**
+ * @generated
+ */
+public class Validate2ItemSemanticEditPolicy extends
+               ModelingBaseItemSemanticEditPolicy {
+
+       /**
+        * @generated
+        */
+       protected Command getDestroyElementCommand(DestroyElementRequest req) {
+               CompoundCommand cc = getDestroyEdgesCommand();
+               addDestroyShortcutsCommand(cc);
+               cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+               return cc.unwrap();
+       }
+
+}

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/Validate2ItemSemanticEditPolicy.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/ValidateItemSemanticEditPolicy.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/ValidateItemSemanticEditPolicy.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/ValidateItemSemanticEditPolicy.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/ValidateItemSemanticEditPolicy.java
 Wed Jun  9 16:29:10 2010
@@ -0,0 +1,40 @@
+/*
+ * 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.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.DestroyElementRequest;
+
+/**
+ * @generated
+ */
+public class ValidateItemSemanticEditPolicy extends
+               ModelingBaseItemSemanticEditPolicy {
+
+       /**
+        * @generated
+        */
+       protected Command getDestroyElementCommand(DestroyElementRequest req) {
+               CompoundCommand cc = getDestroyEdgesCommand();
+               addDestroyShortcutsCommand(cc);
+               cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+               return cc.unwrap();
+       }
+
+}

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/ValidateItemSemanticEditPolicy.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/navigator/ModelingAbstractNavigatorItem.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/navigator/ModelingAbstractNavigatorItem.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/navigator/ModelingAbstractNavigatorItem.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/navigator/ModelingAbstractNavigatorItem.java
 Wed Jun  9 16:29:10 2010
@@ -0,0 +1,77 @@
+/*
+ * 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.navigator;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.PlatformObject;
+import 
org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
+
+/**
+ * @generated
+ */
+public abstract class ModelingAbstractNavigatorItem extends PlatformObject {
+
+       /**
+        * @generated
+        */
+       static {
+               final Class[] supportedTypes = new Class[] { 
ITabbedPropertySheetPageContributor.class };
+               final ITabbedPropertySheetPageContributor 
propertySheetPageContributor = new ITabbedPropertySheetPageContributor() {
+                       public String getContributorId() {
+                               return 
"org.apache.commons.scxml.modeling.diagram"; //$NON-NLS-1$
+                       }
+               };
+               Platform.getAdapterManager().registerAdapters(
+                               new IAdapterFactory() {
+
+                                       public Object getAdapter(Object 
adaptableObject,
+                                                       Class adapterType) {
+                                               if (adaptableObject instanceof 
org.apache.commons.scxml.modeling.diagram.navigator.ModelingAbstractNavigatorItem
+                                                               && adapterType 
== ITabbedPropertySheetPageContributor.class) {
+                                                       return 
propertySheetPageContributor;
+                                               }
+                                               return null;
+                                       }
+
+                                       public Class[] getAdapterList() {
+                                               return supportedTypes;
+                                       }
+                               },
+                               
org.apache.commons.scxml.modeling.diagram.navigator.ModelingAbstractNavigatorItem.class);
+       }
+
+       /**
+        * @generated
+        */
+       private Object myParent;
+
+       /**
+        * @generated
+        */
+       protected ModelingAbstractNavigatorItem(Object parent) {
+               myParent = parent;
+       }
+
+       /**
+        * @generated
+        */
+       public Object getParent() {
+               return myParent;
+       }
+
+}

Propchange: 
commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/navigator/ModelingAbstractNavigatorItem.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/navigator/ModelingDomainNavigatorContentProvider.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/navigator/ModelingDomainNavigatorContentProvider.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/navigator/ModelingDomainNavigatorContentProvider.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/navigator/ModelingDomainNavigatorContentProvider.java
 Wed Jun  9 16:29:10 2010
@@ -0,0 +1,250 @@
+/*
+ * 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.navigator;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import 
org.apache.commons.scxml.modeling.diagram.part.ModelingDiagramEditorPlugin;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.navigator.ICommonContentExtensionSite;
+import org.eclipse.ui.navigator.ICommonContentProvider;
+
+/**
+ * @generated
+ */
+public class ModelingDomainNavigatorContentProvider implements
+               ICommonContentProvider {
+
+       /**
+        * @generated
+        */
+       private AdapterFactoryContentProvider myAdapterFctoryContentProvier;
+
+       /**
+        * @generated
+        */
+       private static final Object[] EMPTY_ARRAY = new Object[0];
+
+       /**
+        * @generated
+        */
+       private Viewer myViewer;
+
+       /**
+        * @generated
+        */
+       private AdapterFactoryEditingDomain myEditingDomain;
+
+       /**
+        * @generated
+        */
+       private WorkspaceSynchronizer myWorkspaceSynchronizer;
+
+       /**
+        * @generated
+        */
+       private Runnable myViewerRefreshRunnable;
+
+       /**
+        * @generated
+        */
+       public ModelingDomainNavigatorContentProvider() {
+               myAdapterFctoryContentProvier = new 
AdapterFactoryContentProvider(
+                               ModelingDiagramEditorPlugin.getInstance()
+                                               
.getItemProvidersAdapterFactory());
+               TransactionalEditingDomain editingDomain = 
GMFEditingDomainFactory.INSTANCE
+                               .createEditingDomain();
+               myEditingDomain = (AdapterFactoryEditingDomain) editingDomain;
+               myEditingDomain.setResourceToReadOnlyMap(new HashMap() {
+                       public Object get(Object key) {
+                               if (!containsKey(key)) {
+                                       put(key, Boolean.TRUE);
+                               }
+                               return super.get(key);
+                       }
+               });
+               myViewerRefreshRunnable = new Runnable() {
+                       public void run() {
+                               if (myViewer != null) {
+                                       myViewer.refresh();
+                               }
+                       }
+               };
+               myWorkspaceSynchronizer = new 
WorkspaceSynchronizer(editingDomain,
+                               new WorkspaceSynchronizer.Delegate() {
+                                       public void dispose() {
+                                       }
+
+                                       public boolean 
handleResourceChanged(final Resource resource) {
+                                               for (Iterator it = 
myEditingDomain.getResourceSet()
+                                                               
.getResources().iterator(); it.hasNext();) {
+                                                       Resource nextResource = 
(Resource) it.next();
+                                                       nextResource.unload();
+                                               }
+                                               if (myViewer != null) {
+                                                       
myViewer.getControl().getDisplay().asyncExec(
+                                                                       
myViewerRefreshRunnable);
+                                               }
+                                               return true;
+                                       }
+
+                                       public boolean 
handleResourceDeleted(Resource resource) {
+                                               for (Iterator it = 
myEditingDomain.getResourceSet()
+                                                               
.getResources().iterator(); it.hasNext();) {
+                                                       Resource nextResource = 
(Resource) it.next();
+                                                       nextResource.unload();
+                                               }
+                                               if (myViewer != null) {
+                                                       
myViewer.getControl().getDisplay().asyncExec(
+                                                                       
myViewerRefreshRunnable);
+                                               }
+                                               return true;
+                                       }
+
+                                       public boolean 
handleResourceMoved(Resource resource,
+                                                       final URI newURI) {
+                                               for (Iterator it = 
myEditingDomain.getResourceSet()
+                                                               
.getResources().iterator(); it.hasNext();) {
+                                                       Resource nextResource = 
(Resource) it.next();
+                                                       nextResource.unload();
+                                               }
+                                               if (myViewer != null) {
+                                                       
myViewer.getControl().getDisplay().asyncExec(
+                                                                       
myViewerRefreshRunnable);
+                                               }
+                                               return true;
+                                       }
+                               });
+       }
+
+       /**
+        * @generated
+        */
+       public void dispose() {
+               myWorkspaceSynchronizer.dispose();
+               myWorkspaceSynchronizer = null;
+               myViewerRefreshRunnable = null;
+               for (Iterator it = 
myEditingDomain.getResourceSet().getResources()
+                               .iterator(); it.hasNext();) {
+                       Resource resource = (Resource) it.next();
+                       resource.unload();
+               }
+               ((TransactionalEditingDomain) myEditingDomain).dispose();
+               myEditingDomain = null;
+       }
+
+       /**
+        * @generated
+        */
+       public void inputChanged(Viewer viewer, Object oldInput, Object 
newInput) {
+               myViewer = viewer;
+       }
+
+       /**
+        * @generated
+        */
+       public Object[] getElements(Object inputElement) {
+               return getChildren(inputElement);
+       }
+
+       /**
+        * @generated
+        */
+       public void restoreState(IMemento aMemento) {
+       }
+
+       /**
+        * @generated
+        */
+       public void saveState(IMemento aMemento) {
+       }
+
+       /**
+        * @generated
+        */
+       public void init(ICommonContentExtensionSite aConfig) {
+       }
+
+       /**
+        * @generated
+        */
+       public Object[] getChildren(Object parentElement) {
+               if (parentElement instanceof IFile) {
+                       IFile file = (IFile) parentElement;
+                       URI fileURI = 
URI.createPlatformResourceURI(file.getFullPath()
+                                       .toString(), true);
+                       Resource resource = 
myEditingDomain.getResourceSet().getResource(
+                                       fileURI, true);
+                       return wrapEObjects(myAdapterFctoryContentProvier
+                                       .getChildren(resource), parentElement);
+               }
+
+               if (parentElement instanceof ModelingDomainNavigatorItem) {
+                       return wrapEObjects(myAdapterFctoryContentProvier
+                                       
.getChildren(((ModelingDomainNavigatorItem) parentElement)
+                                                       .getEObject()), 
parentElement);
+               }
+               return EMPTY_ARRAY;
+       }
+
+       /**
+        * @generated
+        */
+       public Object[] wrapEObjects(Object[] objects, Object parentElement) {
+               Collection result = new ArrayList();
+               for (int i = 0; i < objects.length; i++) {
+                       if (objects[i] instanceof EObject) {
+                               result.add(new ModelingDomainNavigatorItem(
+                                               (EObject) objects[i], 
parentElement,
+                                               myAdapterFctoryContentProvier));
+                       }
+               }
+               return result.toArray();
+       }
+
+       /**
+        * @generated
+        */
+       public Object getParent(Object element) {
+               if (element instanceof ModelingAbstractNavigatorItem) {
+                       ModelingAbstractNavigatorItem abstractNavigatorItem = 
(ModelingAbstractNavigatorItem) element;
+                       return abstractNavigatorItem.getParent();
+               }
+               return null;
+       }
+
+       /**
+        * @generated
+        */
+       public boolean hasChildren(Object element) {
+               return element instanceof IFile || getChildren(element).length 
> 0;
+       }
+
+}

Propchange: 
commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/navigator/ModelingDomainNavigatorContentProvider.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/navigator/ModelingDomainNavigatorItem.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/navigator/ModelingDomainNavigatorItem.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/navigator/ModelingDomainNavigatorItem.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/navigator/ModelingDomainNavigatorItem.java
 Wed Jun  9 16:29:10 2010
@@ -0,0 +1,134 @@
+/*
+ * 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.navigator;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.eclipse.ui.views.properties.IPropertySourceProvider;
+
+/**
+ * @generated
+ */
+public class ModelingDomainNavigatorItem extends PlatformObject {
+
+       /**
+        * @generated
+        */
+       static {
+               final Class[] supportedTypes = new Class[] { EObject.class,
+                               IPropertySource.class };
+               Platform.getAdapterManager().registerAdapters(
+                               new IAdapterFactory() {
+
+                                       public Object getAdapter(Object 
adaptableObject,
+                                                       Class adapterType) {
+                                               if (adaptableObject instanceof 
org.apache.commons.scxml.modeling.diagram.navigator.ModelingDomainNavigatorItem)
 {
+                                                       
org.apache.commons.scxml.modeling.diagram.navigator.ModelingDomainNavigatorItem 
domainNavigatorItem = 
(org.apache.commons.scxml.modeling.diagram.navigator.ModelingDomainNavigatorItem)
 adaptableObject;
+                                                       EObject eObject = 
domainNavigatorItem.getEObject();
+                                                       if (adapterType == 
EObject.class) {
+                                                               return eObject;
+                                                       }
+                                                       if (adapterType == 
IPropertySource.class) {
+                                                               return 
domainNavigatorItem
+                                                                               
.getPropertySourceProvider()
+                                                                               
.getPropertySource(eObject);
+                                                       }
+                                               }
+
+                                               return null;
+                                       }
+
+                                       public Class[] getAdapterList() {
+                                               return supportedTypes;
+                                       }
+                               },
+                               
org.apache.commons.scxml.modeling.diagram.navigator.ModelingDomainNavigatorItem.class);
+       }
+
+       /**
+        * @generated
+        */
+       private Object myParent;
+
+       /**
+        * @generated
+        */
+       private EObject myEObject;
+
+       /**
+        * @generated
+        */
+       private IPropertySourceProvider myPropertySourceProvider;
+
+       /**
+        * @generated
+        */
+       public ModelingDomainNavigatorItem(EObject eObject, Object parent,
+                       IPropertySourceProvider propertySourceProvider) {
+               myParent = parent;
+               myEObject = eObject;
+               myPropertySourceProvider = propertySourceProvider;
+       }
+
+       /**
+        * @generated
+        */
+       public Object getParent() {
+               return myParent;
+       }
+
+       /**
+        * @generated
+        */
+       public EObject getEObject() {
+               return myEObject;
+       }
+
+       /**
+        * @generated
+        */
+       public IPropertySourceProvider getPropertySourceProvider() {
+               return myPropertySourceProvider;
+       }
+
+       /**
+        * @generated
+        */
+       public boolean equals(Object obj) {
+               if (obj instanceof 
org.apache.commons.scxml.modeling.diagram.navigator.ModelingDomainNavigatorItem)
 {
+                       return EcoreUtil
+                                       .getURI(getEObject())
+                                       .equals(
+                                                       EcoreUtil
+                                                                       
.getURI(((org.apache.commons.scxml.modeling.diagram.navigator.ModelingDomainNavigatorItem)
 obj)
+                                                                               
        .getEObject()));
+               }
+               return super.equals(obj);
+       }
+
+       /**
+        * @generated
+        */
+       public int hashCode() {
+               return EcoreUtil.getURI(getEObject()).hashCode();
+       }
+
+}

Propchange: 
commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/navigator/ModelingDomainNavigatorItem.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/navigator/ModelingDomainNavigatorLabelProvider.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/navigator/ModelingDomainNavigatorLabelProvider.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/navigator/ModelingDomainNavigatorLabelProvider.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/navigator/ModelingDomainNavigatorLabelProvider.java
 Wed Jun  9 16:29:10 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.modeling.diagram.navigator;
+
+import 
org.apache.commons.scxml.modeling.diagram.part.ModelingDiagramEditorPlugin;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.navigator.ICommonContentExtensionSite;
+import org.eclipse.ui.navigator.ICommonLabelProvider;
+
+/**
+ * @generated
+ */
+public class ModelingDomainNavigatorLabelProvider implements
+               ICommonLabelProvider {
+
+       /**
+        * @generated
+        */
+       private AdapterFactoryLabelProvider myAdapterFactoryLabelProvider = new 
AdapterFactoryLabelProvider(
+                       ModelingDiagramEditorPlugin.getInstance()
+                                       .getItemProvidersAdapterFactory());
+
+       /**
+        * @generated
+        */
+       public void init(ICommonContentExtensionSite aConfig) {
+       }
+
+       /**
+        * @generated
+        */
+       public Image getImage(Object element) {
+               if (element instanceof ModelingDomainNavigatorItem) {
+                       return myAdapterFactoryLabelProvider
+                                       
.getImage(((ModelingDomainNavigatorItem) element)
+                                                       .getEObject());
+               }
+               return null;
+       }
+
+       /**
+        * @generated
+        */
+       public String getText(Object element) {
+               if (element instanceof ModelingDomainNavigatorItem) {
+                       return myAdapterFactoryLabelProvider
+                                       .getText(((ModelingDomainNavigatorItem) 
element)
+                                                       .getEObject());
+               }
+               return null;
+       }
+
+       /**
+        * @generated
+        */
+       public void addListener(ILabelProviderListener listener) {
+               myAdapterFactoryLabelProvider.addListener(listener);
+       }
+
+       /**
+        * @generated
+        */
+       public void dispose() {
+               myAdapterFactoryLabelProvider.dispose();
+       }
+
+       /**
+        * @generated
+        */
+       public boolean isLabelProperty(Object element, String property) {
+               return myAdapterFactoryLabelProvider.isLabelProperty(element, 
property);
+       }
+
+       /**
+        * @generated
+        */
+       public void removeListener(ILabelProviderListener listener) {
+               myAdapterFactoryLabelProvider.removeListener(listener);
+       }
+
+       /**
+        * @generated
+        */
+       public void restoreState(IMemento aMemento) {
+       }
+
+       /**
+        * @generated
+        */
+       public void saveState(IMemento aMemento) {
+       }
+
+       /**
+        * @generated
+        */
+       public String getDescription(Object anElement) {
+               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/navigator/ModelingDomainNavigatorLabelProvider.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/navigator/ModelingNavigatorActionProvider.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/navigator/ModelingNavigatorActionProvider.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/navigator/ModelingNavigatorActionProvider.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/navigator/ModelingNavigatorActionProvider.java
 Wed Jun  9 16:29:10 2010
@@ -0,0 +1,195 @@
+/*
+ * 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.navigator;
+
+import java.util.Iterator;
+
+import 
org.apache.commons.scxml.modeling.diagram.edit.parts.ServiceTemplateEditPart;
+import org.apache.commons.scxml.modeling.diagram.part.Messages;
+import org.apache.commons.scxml.modeling.diagram.part.ModelingDiagramEditor;
+import 
org.apache.commons.scxml.modeling.diagram.part.ModelingDiagramEditorPlugin;
+import org.apache.commons.scxml.modeling.diagram.part.ModelingVisualIDRegistry;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.common.ui.URIEditorInput;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.navigator.CommonActionProvider;
+import org.eclipse.ui.navigator.ICommonActionConstants;
+import org.eclipse.ui.navigator.ICommonActionExtensionSite;
+import org.eclipse.ui.navigator.ICommonViewerWorkbenchSite;
+import org.eclipse.ui.part.FileEditorInput;
+
+/**
+ * @generated
+ */
+public class ModelingNavigatorActionProvider extends CommonActionProvider {
+
+       /**
+        * @generated
+        */
+       private boolean myContribute;
+
+       /**
+        * @generated
+        */
+       private OpenDiagramAction myOpenDiagramAction;
+
+       /**
+        * @generated
+        */
+       public void init(ICommonActionExtensionSite aSite) {
+               super.init(aSite);
+               if (aSite.getViewSite() instanceof ICommonViewerWorkbenchSite) {
+                       myContribute = true;
+                       makeActions((ICommonViewerWorkbenchSite) 
aSite.getViewSite());
+               } else {
+                       myContribute = false;
+               }
+       }
+
+       /**
+        * @generated
+        */
+       private void makeActions(ICommonViewerWorkbenchSite viewerSite) {
+               myOpenDiagramAction = new OpenDiagramAction(viewerSite);
+       }
+
+       /**
+        * @generated
+        */
+       public void fillActionBars(IActionBars actionBars) {
+               if (!myContribute) {
+                       return;
+               }
+               IStructuredSelection selection = (IStructuredSelection) 
getContext()
+                               .getSelection();
+               myOpenDiagramAction.selectionChanged(selection);
+               if (myOpenDiagramAction.isEnabled()) {
+                       
actionBars.setGlobalActionHandler(ICommonActionConstants.OPEN,
+                                       myOpenDiagramAction);
+               }
+       }
+
+       /**
+        * @generated
+        */
+       public void fillContextMenu(IMenuManager menu) {
+       }
+
+       /**
+        * @generated
+        */
+       private class OpenDiagramAction extends Action {
+
+               /**
+                * @generated
+                */
+               private Diagram myDiagram;
+
+               /**
+                * @generated
+                */
+               private ICommonViewerWorkbenchSite myViewerSite;
+
+               /**
+                * @generated
+                */
+               public OpenDiagramAction(ICommonViewerWorkbenchSite viewerSite) 
{
+                       
super(Messages.NavigatorActionProvider_OpenDiagramActionName);
+                       myViewerSite = viewerSite;
+               }
+
+               /**
+                * @generated
+                */
+               public final void selectionChanged(IStructuredSelection 
selection) {
+                       myDiagram = null;
+                       if (selection.size() == 1) {
+                               Object selectedElement = 
selection.getFirstElement();
+                               if (selectedElement instanceof 
ModelingNavigatorItem) {
+                                       selectedElement = 
((ModelingNavigatorItem) selectedElement)
+                                                       .getView();
+                               } else if (selectedElement instanceof 
IAdaptable) {
+                                       selectedElement = ((IAdaptable) 
selectedElement)
+                                                       .getAdapter(View.class);
+                               }
+                               if (selectedElement instanceof Diagram) {
+                                       Diagram diagram = (Diagram) 
selectedElement;
+                                       if (ServiceTemplateEditPart.MODEL_ID
+                                                       
.equals(ModelingVisualIDRegistry
+                                                                       
.getModelID(diagram))) {
+                                               myDiagram = diagram;
+                                       }
+                               }
+                       }
+                       setEnabled(myDiagram != null);
+               }
+
+               /**
+                * @generated
+                */
+               public void run() {
+                       if (myDiagram == null || myDiagram.eResource() == null) 
{
+                               return;
+                       }
+
+                       IEditorInput editorInput = getEditorInput();
+                       IWorkbenchPage page = myViewerSite.getPage();
+                       try {
+                               page.openEditor(editorInput, 
ModelingDiagramEditor.ID);
+                       } catch (PartInitException e) {
+                               
ModelingDiagramEditorPlugin.getInstance().logError(
+                                               "Exception while openning 
diagram", e); //$NON-NLS-1$
+                       }
+               }
+
+               /**
+                * @generated
+                */
+               private IEditorInput getEditorInput() {
+                       for (Iterator it = 
myDiagram.eResource().getContents().iterator(); it
+                                       .hasNext();) {
+                               EObject nextEObject = (EObject) it.next();
+                               if (nextEObject == myDiagram) {
+                                       return new 
FileEditorInput(WorkspaceSynchronizer
+                                                       
.getFile(myDiagram.eResource()));
+                               }
+                               if (nextEObject instanceof Diagram) {
+                                       break;
+                               }
+                       }
+                       URI uri = EcoreUtil.getURI(myDiagram);
+                       String editorName = uri.lastSegment()
+                                       + "#" + 
myDiagram.eResource().getContents().indexOf(myDiagram); //$NON-NLS-1$
+                       IEditorInput editorInput = new URIEditorInput(uri, 
editorName);
+                       return editorInput;
+               }
+
+       }
+
+}

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


Reply via email to