commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gu...@apache.org
Subject svn commit: r953071 [2/5] - /commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/part/
Date Wed, 09 Jun 2010 16:12:48 GMT
Added: commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/part/ModelingDiagramUpdateCommand.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/part/ModelingDiagramUpdateCommand.java?rev=953071&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/part/ModelingDiagramUpdateCommand.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/part/ModelingDiagramUpdateCommand.java
Wed Jun  9 16:12:48 2010
@@ -0,0 +1,101 @@
+/*
+ * 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.part;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.core.commands.IHandlerListener;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @generated
+ */
+public class ModelingDiagramUpdateCommand implements IHandler {
+
+	/**
+	 * @generated
+	 */
+	public void addHandlerListener(IHandlerListener handlerListener) {
+	}
+
+	/**
+	 * @generated
+	 */
+	public void dispose() {
+	}
+
+	/**
+	 * @generated
+	 */
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		ISelection selection = PlatformUI.getWorkbench()
+				.getActiveWorkbenchWindow().getSelectionService()
+				.getSelection();
+		if (selection instanceof IStructuredSelection) {
+			IStructuredSelection structuredSelection = (IStructuredSelection) selection;
+			if (structuredSelection.size() != 1) {
+				return null;
+			}
+			if (structuredSelection.getFirstElement() instanceof EditPart
+					&& ((EditPart) structuredSelection.getFirstElement())
+							.getModel() instanceof View) {
+				EObject modelElement = ((View) ((EditPart) structuredSelection
+						.getFirstElement()).getModel()).getElement();
+				List editPolicies = CanonicalEditPolicy
+						.getRegisteredEditPolicies(modelElement);
+				for (Iterator it = editPolicies.iterator(); it.hasNext();) {
+					CanonicalEditPolicy nextEditPolicy = (CanonicalEditPolicy) it
+							.next();
+					nextEditPolicy.refresh();
+				}
+
+			}
+		}
+		return null;
+	}
+
+	/**
+	 * @generated
+	 */
+	public boolean isEnabled() {
+		return true;
+	}
+
+	/**
+	 * @generated
+	 */
+	public boolean isHandled() {
+		return true;
+	}
+
+	/**
+	 * @generated
+	 */
+	public void removeHandlerListener(IHandlerListener handlerListener) {
+	}
+
+}

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



Mime
View raw message