commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gu...@apache.org
Subject svn commit: r945185 [29/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/StateStateCompartmentCanonicalEditPolicy.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/StateStateCompartmentCanonicalEditPolicy.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/StateStateCompartmentCanonicalEditPolicy.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/StateStateCompartmentCanonicalEditPolicy.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 StateStateCompartmentCanonicalEditPolicy extends
+		CanonicalEditPolicy {
+
+	/**
+	 * @generated
+	 */
+	Set myFeaturesToSynchronize;
+
+	/**
+	 * @generated
+	 */
+	protected List getSemanticChildrenList() {
+		View viewObject = (View) getHost().getModel();
+		List result = new LinkedList();
+		for (Iterator it = ScxmlDiagramUpdater
+				.getStateStateCompartment_5001SemanticChildren(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/StateStateCompartmentCanonicalEditPolicy.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/StateStateCompartmentItemSemanticEditPolicy.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/StateStateCompartmentItemSemanticEditPolicy.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/StateStateCompartmentItemSemanticEditPolicy.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/StateStateCompartmentItemSemanticEditPolicy.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 StateStateCompartmentItemSemanticEditPolicy 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/StateStateCompartmentItemSemanticEditPolicy.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/TranslationItemSemanticEditPolicy.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/TranslationItemSemanticEditPolicy.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/TranslationItemSemanticEditPolicy.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/TranslationItemSemanticEditPolicy.java
Mon May 17 14:38:45 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.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 TranslationItemSemanticEditPolicy extends
+		ScxmlBaseItemSemanticEditPolicy {
+
+	/**
+	 * @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.diagram/src/org/apache/commons/scxml/diagram/edit/policies/TranslationItemSemanticEditPolicy.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/Validate2ItemSemanticEditPolicy.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/Validate2ItemSemanticEditPolicy.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/Validate2ItemSemanticEditPolicy.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/Validate2ItemSemanticEditPolicy.java
Mon May 17 14:38:45 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.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
+		ScxmlBaseItemSemanticEditPolicy {
+
+	/**
+	 * @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.diagram/src/org/apache/commons/scxml/diagram/edit/policies/Validate2ItemSemanticEditPolicy.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/ValidateItemSemanticEditPolicy.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/ValidateItemSemanticEditPolicy.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/ValidateItemSemanticEditPolicy.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/ValidateItemSemanticEditPolicy.java
Mon May 17 14:38:45 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.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
+		ScxmlBaseItemSemanticEditPolicy {
+
+	/**
+	 * @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.diagram/src/org/apache/commons/scxml/diagram/edit/policies/ValidateItemSemanticEditPolicy.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/navigator/ScxmlAbstractNavigatorItem.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/navigator/ScxmlAbstractNavigatorItem.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/navigator/ScxmlAbstractNavigatorItem.java
(added)
+++ commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.diagram/src/org/apache/commons/scxml/diagram/navigator/ScxmlAbstractNavigatorItem.java
Mon May 17 14:38:45 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.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 ScxmlAbstractNavigatorItem extends PlatformObject {
+
+	/**
+	 * @generated
+	 */
+	static {
+		final Class[] supportedTypes = new Class[] { ITabbedPropertySheetPageContributor.class
};
+		final ITabbedPropertySheetPageContributor propertySheetPageContributor = new ITabbedPropertySheetPageContributor()
{
+			public String getContributorId() {
+				return "org.apache.commons.scxml.diagram"; //$NON-NLS-1$
+			}
+		};
+		Platform.getAdapterManager().registerAdapters(
+				new IAdapterFactory() {
+
+					public Object getAdapter(Object adaptableObject,
+							Class adapterType) {
+						if (adaptableObject instanceof org.apache.commons.scxml.diagram.navigator.ScxmlAbstractNavigatorItem
+								&& adapterType == ITabbedPropertySheetPageContributor.class) {
+							return propertySheetPageContributor;
+						}
+						return null;
+					}
+
+					public Class[] getAdapterList() {
+						return supportedTypes;
+					}
+				},
+				org.apache.commons.scxml.diagram.navigator.ScxmlAbstractNavigatorItem.class);
+	}
+
+	/**
+	 * @generated
+	 */
+	private Object myParent;
+
+	/**
+	 * @generated
+	 */
+	protected ScxmlAbstractNavigatorItem(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.diagram/src/org/apache/commons/scxml/diagram/navigator/ScxmlAbstractNavigatorItem.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/navigator/ScxmlDomainNavigatorContentProvider.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/navigator/ScxmlDomainNavigatorContentProvider.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/navigator/ScxmlDomainNavigatorContentProvider.java
(added)
+++ commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.diagram/src/org/apache/commons/scxml/diagram/navigator/ScxmlDomainNavigatorContentProvider.java
Mon May 17 14:38:45 2010
@@ -0,0 +1,249 @@
+/*
+ * 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.navigator;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.apache.commons.scxml.diagram.part.ScxmlDiagramEditorPlugin;
+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 ScxmlDomainNavigatorContentProvider 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 ScxmlDomainNavigatorContentProvider() {
+		myAdapterFctoryContentProvier = new AdapterFactoryContentProvider(
+				ScxmlDiagramEditorPlugin.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 ScxmlDomainNavigatorItem) {
+			return wrapEObjects(myAdapterFctoryContentProvier
+					.getChildren(((ScxmlDomainNavigatorItem) 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 ScxmlDomainNavigatorItem((EObject) objects[i],
+						parentElement, myAdapterFctoryContentProvier));
+			}
+		}
+		return result.toArray();
+	}
+
+	/**
+	 * @generated
+	 */
+	public Object getParent(Object element) {
+		if (element instanceof ScxmlAbstractNavigatorItem) {
+			ScxmlAbstractNavigatorItem abstractNavigatorItem = (ScxmlAbstractNavigatorItem) 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.diagram/src/org/apache/commons/scxml/diagram/navigator/ScxmlDomainNavigatorContentProvider.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/navigator/ScxmlDomainNavigatorItem.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/navigator/ScxmlDomainNavigatorItem.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/navigator/ScxmlDomainNavigatorItem.java
(added)
+++ commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.diagram/src/org/apache/commons/scxml/diagram/navigator/ScxmlDomainNavigatorItem.java
Mon May 17 14:38:45 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.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 ScxmlDomainNavigatorItem 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.diagram.navigator.ScxmlDomainNavigatorItem)
{
+							org.apache.commons.scxml.diagram.navigator.ScxmlDomainNavigatorItem domainNavigatorItem
= (org.apache.commons.scxml.diagram.navigator.ScxmlDomainNavigatorItem) 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.diagram.navigator.ScxmlDomainNavigatorItem.class);
+	}
+
+	/**
+	 * @generated
+	 */
+	private Object myParent;
+
+	/**
+	 * @generated
+	 */
+	private EObject myEObject;
+
+	/**
+	 * @generated
+	 */
+	private IPropertySourceProvider myPropertySourceProvider;
+
+	/**
+	 * @generated
+	 */
+	public ScxmlDomainNavigatorItem(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.diagram.navigator.ScxmlDomainNavigatorItem)
{
+			return EcoreUtil
+					.getURI(getEObject())
+					.equals(
+							EcoreUtil
+									.getURI(((org.apache.commons.scxml.diagram.navigator.ScxmlDomainNavigatorItem) 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.diagram/src/org/apache/commons/scxml/diagram/navigator/ScxmlDomainNavigatorItem.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/navigator/ScxmlDomainNavigatorLabelProvider.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/navigator/ScxmlDomainNavigatorLabelProvider.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/navigator/ScxmlDomainNavigatorLabelProvider.java
(added)
+++ commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.diagram/src/org/apache/commons/scxml/diagram/navigator/ScxmlDomainNavigatorLabelProvider.java
Mon May 17 14:38:45 2010
@@ -0,0 +1,114 @@
+/*
+ * 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.navigator;
+
+import org.apache.commons.scxml.diagram.part.ScxmlDiagramEditorPlugin;
+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 ScxmlDomainNavigatorLabelProvider implements ICommonLabelProvider {
+
+	/**
+	 * @generated
+	 */
+	private AdapterFactoryLabelProvider myAdapterFactoryLabelProvider = new AdapterFactoryLabelProvider(
+			ScxmlDiagramEditorPlugin.getInstance()
+					.getItemProvidersAdapterFactory());
+
+	/**
+	 * @generated
+	 */
+	public void init(ICommonContentExtensionSite aConfig) {
+	}
+
+	/**
+	 * @generated
+	 */
+	public Image getImage(Object element) {
+		if (element instanceof ScxmlDomainNavigatorItem) {
+			return myAdapterFactoryLabelProvider
+					.getImage(((ScxmlDomainNavigatorItem) element).getEObject());
+		}
+		return null;
+	}
+
+	/**
+	 * @generated
+	 */
+	public String getText(Object element) {
+		if (element instanceof ScxmlDomainNavigatorItem) {
+			return myAdapterFactoryLabelProvider
+					.getText(((ScxmlDomainNavigatorItem) 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.diagram/src/org/apache/commons/scxml/diagram/navigator/ScxmlDomainNavigatorLabelProvider.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/navigator/ScxmlNavigatorActionProvider.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/navigator/ScxmlNavigatorActionProvider.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/navigator/ScxmlNavigatorActionProvider.java
(added)
+++ commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.diagram/src/org/apache/commons/scxml/diagram/navigator/ScxmlNavigatorActionProvider.java
Mon May 17 14:38:45 2010
@@ -0,0 +1,194 @@
+/*
+ * 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.navigator;
+
+import java.util.Iterator;
+
+import org.apache.commons.scxml.diagram.edit.parts.ServiceTemplateEditPart;
+import org.apache.commons.scxml.diagram.part.Messages;
+import org.apache.commons.scxml.diagram.part.ScxmlDiagramEditor;
+import org.apache.commons.scxml.diagram.part.ScxmlDiagramEditorPlugin;
+import org.apache.commons.scxml.diagram.part.ScxmlVisualIDRegistry;
+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 ScxmlNavigatorActionProvider 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 ScxmlNavigatorItem) {
+					selectedElement = ((ScxmlNavigatorItem) 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(ScxmlVisualIDRegistry.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, ScxmlDiagramEditor.ID);
+			} catch (PartInitException e) {
+				ScxmlDiagramEditorPlugin.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.diagram/src/org/apache/commons/scxml/diagram/navigator/ScxmlNavigatorActionProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message