You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gu...@apache.org on 2010/06/09 18:29:16 UTC
svn commit: r953075 [4/17] - in
/commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram:
edit/policies/ navigator/ providers/ sheet/ view/factories/
Added: commons/sandbox/gsoc/2010/scxml-eclipse/trunk/src/main/java/org.apache.commons.scxml.modeling.diagram/src/org/apache/commons/scxml/modeling/diagram/edit/policies/Log2ItemSemanticEditPolicy.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/Log2ItemSemanticEditPolicy.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/Log2ItemSemanticEditPolicy.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/Log2ItemSemanticEditPolicy.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 Log2ItemSemanticEditPolicy 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/Log2ItemSemanticEditPolicy.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/LogItemSemanticEditPolicy.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/LogItemSemanticEditPolicy.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/LogItemSemanticEditPolicy.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/LogItemSemanticEditPolicy.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 LogItemSemanticEditPolicy 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/LogItemSemanticEditPolicy.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/ModelingBaseItemSemanticEditPolicy.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/ModelingBaseItemSemanticEditPolicy.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/ModelingBaseItemSemanticEditPolicy.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/ModelingBaseItemSemanticEditPolicy.java Wed Jun 9 16:29:10 2010
@@ -0,0 +1,379 @@
+/*
+ * 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.Collections;
+import java.util.Iterator;
+
+import org.apache.commons.scxml.modeling.NamedElement;
+import org.apache.commons.scxml.modeling.diagram.edit.helpers.ModelingBaseEditHelper;
+import org.apache.commons.scxml.modeling.diagram.part.ModelingVisualIDRegistry;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gef.requests.ReconnectRequest;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.SemanticEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandRequestWrapper;
+import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
+import org.eclipse.gmf.runtime.emf.type.core.IEditHelperContext;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.GetEditContextRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class ModelingBaseItemSemanticEditPolicy extends SemanticEditPolicy {
+
+ /**
+ * Extended request data key to hold editpart visual id.
+ *
+ * @generated
+ */
+ public static final String VISUAL_ID_KEY = "visual_id"; //$NON-NLS-1$
+
+ /**
+ * Extended request data key to hold editpart visual id.
+ * Add visual id of edited editpart to extended data of the request
+ * so command switch can decide what kind of diagram element is being edited.
+ * It is done in those cases when it's not possible to deduce diagram
+ * element kind from domain element.
+ *
+ * @generated
+ */
+ public Command getCommand(Request request) {
+ if (request instanceof ReconnectRequest) {
+ Object view = ((ReconnectRequest) request).getConnectionEditPart()
+ .getModel();
+ if (view instanceof View) {
+ Integer id = new Integer(ModelingVisualIDRegistry
+ .getVisualID((View) view));
+ request.getExtendedData().put(VISUAL_ID_KEY, id);
+ }
+ }
+ return super.getCommand(request);
+ }
+
+ /**
+ * Returns visual id from request parameters.
+ *
+ * @generated
+ */
+ protected int getVisualID(IEditCommandRequest request) {
+ Object id = request.getParameter(VISUAL_ID_KEY);
+ return id instanceof Integer ? ((Integer) id).intValue() : -1;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getSemanticCommand(IEditCommandRequest request) {
+ IEditCommandRequest completedRequest = completeRequest(request);
+ Object editHelperContext = completedRequest.getEditHelperContext();
+ if (editHelperContext instanceof View
+ || (editHelperContext instanceof IEditHelperContext && ((IEditHelperContext) editHelperContext)
+ .getEObject() instanceof View)) {
+ // no semantic commands are provided for pure design elements
+ return null;
+ }
+ if (editHelperContext == null) {
+ editHelperContext = ViewUtil
+ .resolveSemanticElement((View) getHost().getModel());
+ }
+ IElementType elementType = ElementTypeRegistry.getInstance()
+ .getElementType(editHelperContext);
+ if (elementType == ElementTypeRegistry.getInstance().getType(
+ "org.eclipse.gmf.runtime.emf.type.core.default")) { //$NON-NLS-1$
+ elementType = null;
+ }
+ Command semanticCommand = getSemanticCommandSwitch(completedRequest);
+ if (semanticCommand != null) {
+ ICommand command = semanticCommand instanceof ICommandProxy ? ((ICommandProxy) semanticCommand)
+ .getICommand()
+ : new CommandProxy(semanticCommand);
+ completedRequest.setParameter(
+ ModelingBaseEditHelper.EDIT_POLICY_COMMAND, command);
+ }
+ if (elementType != null) {
+ ICommand command = elementType.getEditCommand(completedRequest);
+ if (command != null) {
+ if (!(command instanceof CompositeTransactionalCommand)) {
+ TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost())
+ .getEditingDomain();
+ command = new CompositeTransactionalCommand(editingDomain,
+ command.getLabel()).compose(command);
+ }
+ semanticCommand = new ICommandProxy(command);
+ }
+ }
+ boolean shouldProceed = true;
+ if (completedRequest instanceof DestroyRequest) {
+ shouldProceed = shouldProceed((DestroyRequest) completedRequest);
+ }
+ if (shouldProceed) {
+ if (completedRequest instanceof DestroyRequest) {
+ TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost())
+ .getEditingDomain();
+ Command deleteViewCommand = new ICommandProxy(
+ new DeleteCommand(editingDomain, (View) getHost()
+ .getModel()));
+ semanticCommand = semanticCommand == null ? deleteViewCommand
+ : semanticCommand.chain(deleteViewCommand);
+ }
+ return semanticCommand;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getSemanticCommandSwitch(IEditCommandRequest req) {
+ if (req instanceof CreateRelationshipRequest) {
+ return getCreateRelationshipCommand((CreateRelationshipRequest) req);
+ } else if (req instanceof CreateElementRequest) {
+ return getCreateCommand((CreateElementRequest) req);
+ } else if (req instanceof ConfigureRequest) {
+ return getConfigureCommand((ConfigureRequest) req);
+ } else if (req instanceof DestroyElementRequest) {
+ return getDestroyElementCommand((DestroyElementRequest) req);
+ } else if (req instanceof DestroyReferenceRequest) {
+ return getDestroyReferenceCommand((DestroyReferenceRequest) req);
+ } else if (req instanceof DuplicateElementsRequest) {
+ return getDuplicateCommand((DuplicateElementsRequest) req);
+ } else if (req instanceof GetEditContextRequest) {
+ return getEditContextCommand((GetEditContextRequest) req);
+ } else if (req instanceof MoveRequest) {
+ return getMoveCommand((MoveRequest) req);
+ } else if (req instanceof ReorientReferenceRelationshipRequest) {
+ return getReorientReferenceRelationshipCommand((ReorientReferenceRelationshipRequest) req);
+ } else if (req instanceof ReorientRelationshipRequest) {
+ return getReorientRelationshipCommand((ReorientRelationshipRequest) req);
+ } else if (req instanceof SetRequest) {
+ return getSetCommand((SetRequest) req);
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getConfigureCommand(ConfigureRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getSetCommand(SetRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getEditContextCommand(GetEditContextRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyReferenceCommand(DestroyReferenceRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getDuplicateCommand(DuplicateElementsRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getMoveCommand(MoveRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(
+ ReorientReferenceRelationshipRequest req) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(
+ ReorientRelationshipRequest req) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * @generated
+ */
+ protected final Command getGEFWrapper(ICommand cmd) {
+ return new ICommandProxy(cmd);
+ }
+
+ /**
+ * @deprecated use getGEFWrapper() instead
+ * @generated
+ */
+ protected final Command getMSLWrapper(ICommand cmd) {
+ // XXX deprecated: use getGEFWrapper() instead
+ return getGEFWrapper(cmd);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getSemanticElement() {
+ return ViewUtil.resolveSemanticElement((View) getHost().getModel());
+ }
+
+ /**
+ * Returns editing domain from the host edit part.
+ *
+ * @generated
+ */
+ protected TransactionalEditingDomain getEditingDomain() {
+ return ((IGraphicalEditPart) getHost()).getEditingDomain();
+ }
+
+ /**
+ * Creates command to destroy the link.
+ *
+ * @generated
+ */
+ protected Command getDestroyElementCommand(View view) {
+ EditPart editPart = (EditPart) getHost().getViewer()
+ .getEditPartRegistry().get(view);
+ DestroyElementRequest request = new DestroyElementRequest(
+ getEditingDomain(), false);
+ return editPart.getCommand(new EditCommandRequestWrapper(request,
+ Collections.EMPTY_MAP));
+ }
+
+ /**
+ * Creates commands to destroy all host incoming and outgoing links.
+ *
+ * @generated
+ */
+ protected CompoundCommand getDestroyEdgesCommand() {
+ CompoundCommand cmd = new CompoundCommand();
+ View view = (View) getHost().getModel();
+ for (Iterator it = view.getSourceEdges().iterator(); it.hasNext();) {
+ cmd.add(getDestroyElementCommand((Edge) it.next()));
+ }
+ for (Iterator it = view.getTargetEdges().iterator(); it.hasNext();) {
+ cmd.add(getDestroyElementCommand((Edge) it.next()));
+ }
+ return cmd;
+ }
+
+ /**
+ * @generated
+ */
+ protected void addDestroyShortcutsCommand(CompoundCommand command) {
+ View view = (View) getHost().getModel();
+ if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
+ return;
+ }
+ for (Iterator it = view.getDiagram().getChildren().iterator(); it
+ .hasNext();) {
+ View nextView = (View) it.next();
+ if (nextView.getEAnnotation("Shortcut") == null || !nextView.isSetElement() || nextView.getElement() != view.getElement()) { //$NON-NLS-1$
+ continue;
+ }
+ command.add(getDestroyElementCommand(nextView));
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static class LinkConstraints {
+
+ /**
+ * @generated
+ */
+ public static boolean canCreateTransition_4001(NamedElement source,
+ NamedElement target) {
+ return canExistTransition_4001(source, target);
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canExistTransition_4001(NamedElement source,
+ NamedElement target) {
+
+ return true;
+ }
+ }
+
+}
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/ModelingBaseItemSemanticEditPolicy.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/ModelingTextNonResizableEditPolicy.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/ModelingTextNonResizableEditPolicy.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/ModelingTextNonResizableEditPolicy.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/ModelingTextNonResizableEditPolicy.java Wed Jun 9 16:29:10 2010
@@ -0,0 +1,220 @@
+/*
+ * 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.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.handles.MoveHandle;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableEditPolicyEx;
+import org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+
+/**
+ * @generated
+ */
+public class ModelingTextNonResizableEditPolicy extends
+ NonResizableEditPolicyEx {
+
+ /**
+ * @generated
+ */
+ private IFigure selectionFeedbackFigure;
+
+ /**
+ * @generated
+ */
+ private IFigure focusFeedbackFigure;
+
+ /**
+ * @generated
+ */
+ protected void showPrimarySelection() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setSelected(true);
+ ((WrappingLabel) getHostFigure()).setFocus(true);
+ } else {
+ showSelection();
+ showFocus();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void showSelection() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setSelected(true);
+ ((WrappingLabel) getHostFigure()).setFocus(false);
+ } else {
+ hideSelection();
+ addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure());
+ refreshSelectionFeedback();
+ hideFocus();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void hideSelection() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setSelected(false);
+ ((WrappingLabel) getHostFigure()).setFocus(false);
+ } else {
+ if (selectionFeedbackFigure != null) {
+ removeFeedback(selectionFeedbackFigure);
+ selectionFeedbackFigure = null;
+ }
+ hideFocus();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void showFocus() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setFocus(true);
+ } else {
+ hideFocus();
+ addFeedback(focusFeedbackFigure = createFocusFeedbackFigure());
+ refreshFocusFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void hideFocus() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setFocus(false);
+ } else {
+ if (focusFeedbackFigure != null) {
+ removeFeedback(focusFeedbackFigure);
+ focusFeedbackFigure = null;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Rectangle getFeedbackBounds() {
+ Rectangle bounds;
+ if (getHostFigure() instanceof Label) {
+ bounds = ((Label) getHostFigure()).getTextBounds();
+ bounds.intersect(getHostFigure().getBounds());
+ } else {
+ bounds = getHostFigure().getBounds().getCopy();
+ }
+ getHostFigure().getParent().translateToAbsolute(bounds);
+ getFeedbackLayer().translateToRelative(bounds);
+ return bounds;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createSelectionFeedbackFigure() {
+ if (getHostFigure() instanceof Label) {
+ Label feedbackFigure = new Label();
+ feedbackFigure.setOpaque(true);
+ feedbackFigure
+ .setBackgroundColor(ColorConstants.menuBackgroundSelected);
+ feedbackFigure
+ .setForegroundColor(ColorConstants.menuForegroundSelected);
+ return feedbackFigure;
+ } else {
+ RectangleFigure feedbackFigure = new RectangleFigure();
+ feedbackFigure.setFill(false);
+ return feedbackFigure;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFocusFeedbackFigure() {
+ return new Figure() {
+
+ protected void paintFigure(Graphics graphics) {
+ graphics.drawFocus(getBounds().getResized(-1, -1));
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ protected void updateLabel(Label target) {
+ Label source = (Label) getHostFigure();
+ target.setText(source.getText());
+ target.setTextAlignment(source.getTextAlignment());
+ target.setFont(source.getFont());
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshSelectionFeedback() {
+ if (selectionFeedbackFigure != null) {
+ if (selectionFeedbackFigure instanceof Label) {
+ updateLabel((Label) selectionFeedbackFigure);
+ selectionFeedbackFigure.setBounds(getFeedbackBounds());
+ } else {
+ selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5,
+ 5));
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFocusFeedback() {
+ if (focusFeedbackFigure != null) {
+ focusFeedbackFigure.setBounds(getFeedbackBounds());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void refreshFeedback() {
+ refreshSelectionFeedback();
+ refreshFocusFeedback();
+ }
+
+ /**
+ * @generated
+ */
+ protected List createSelectionHandles() {
+ MoveHandle moveHandle = new MoveHandle((GraphicalEditPart) getHost());
+ moveHandle.setBorder(null);
+ moveHandle.setDragTracker(new DragEditPartsTrackerEx(getHost()));
+ return Collections.singletonList(moveHandle);
+ }
+}
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/ModelingTextNonResizableEditPolicy.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/ModelingTextSelectionEditPolicy.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/ModelingTextSelectionEditPolicy.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/ModelingTextSelectionEditPolicy.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/ModelingTextSelectionEditPolicy.java Wed Jun 9 16:29:10 2010
@@ -0,0 +1,203 @@
+/*
+ * 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.draw2d.ColorConstants;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.editpolicies.SelectionEditPolicy;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+
+/**
+ * @generated
+ */
+public class ModelingTextSelectionEditPolicy extends SelectionEditPolicy {
+
+ /**
+ * @generated
+ */
+ private IFigure selectionFeedbackFigure;
+
+ /**
+ * @generated
+ */
+ private IFigure focusFeedbackFigure;
+
+ /**
+ * @generated
+ */
+ protected void showPrimarySelection() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setSelected(true);
+ ((WrappingLabel) getHostFigure()).setFocus(true);
+ } else {
+ showSelection();
+ showFocus();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void showSelection() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setSelected(true);
+ ((WrappingLabel) getHostFigure()).setFocus(false);
+ } else {
+ hideSelection();
+ addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure());
+ refreshSelectionFeedback();
+ hideFocus();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void hideSelection() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setSelected(false);
+ ((WrappingLabel) getHostFigure()).setFocus(false);
+ } else {
+ if (selectionFeedbackFigure != null) {
+ removeFeedback(selectionFeedbackFigure);
+ selectionFeedbackFigure = null;
+ }
+ hideFocus();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void showFocus() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setFocus(true);
+ } else {
+ hideFocus();
+ addFeedback(focusFeedbackFigure = createFocusFeedbackFigure());
+ refreshFocusFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void hideFocus() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setFocus(false);
+ } else {
+ if (focusFeedbackFigure != null) {
+ removeFeedback(focusFeedbackFigure);
+ focusFeedbackFigure = null;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Rectangle getFeedbackBounds() {
+ Rectangle bounds;
+ if (getHostFigure() instanceof Label) {
+ bounds = ((Label) getHostFigure()).getTextBounds();
+ bounds.intersect(getHostFigure().getBounds());
+ } else {
+ bounds = getHostFigure().getBounds().getCopy();
+ }
+ getHostFigure().getParent().translateToAbsolute(bounds);
+ getFeedbackLayer().translateToRelative(bounds);
+ return bounds;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createSelectionFeedbackFigure() {
+ if (getHostFigure() instanceof Label) {
+ Label feedbackFigure = new Label();
+ feedbackFigure.setOpaque(true);
+ feedbackFigure
+ .setBackgroundColor(ColorConstants.menuBackgroundSelected);
+ feedbackFigure
+ .setForegroundColor(ColorConstants.menuForegroundSelected);
+ return feedbackFigure;
+ } else {
+ RectangleFigure feedbackFigure = new RectangleFigure();
+ feedbackFigure.setFill(false);
+ return feedbackFigure;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFocusFeedbackFigure() {
+ return new Figure() {
+
+ protected void paintFigure(Graphics graphics) {
+ graphics.drawFocus(getBounds().getResized(-1, -1));
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ protected void updateLabel(Label target) {
+ Label source = (Label) getHostFigure();
+ target.setText(source.getText());
+ target.setTextAlignment(source.getTextAlignment());
+ target.setFont(source.getFont());
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshSelectionFeedback() {
+ if (selectionFeedbackFigure != null) {
+ if (selectionFeedbackFigure instanceof Label) {
+ updateLabel((Label) selectionFeedbackFigure);
+ selectionFeedbackFigure.setBounds(getFeedbackBounds());
+ } else {
+ selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5,
+ 5));
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFocusFeedback() {
+ if (focusFeedbackFigure != null) {
+ focusFeedbackFigure.setBounds(getFeedbackBounds());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void refreshFeedback() {
+ refreshSelectionFeedback();
+ refreshFocusFeedback();
+ }
+}
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/ModelingTextSelectionEditPolicy.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/OnEntry2ItemSemanticEditPolicy.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/OnEntry2ItemSemanticEditPolicy.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/OnEntry2ItemSemanticEditPolicy.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/OnEntry2ItemSemanticEditPolicy.java Wed Jun 9 16:29:10 2010
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.scxml.modeling.diagram.edit.policies;
+
+import java.util.Iterator;
+
+import org.apache.commons.scxml.modeling.diagram.edit.parts.AssignEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.CancelEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.ExtenExecContentEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.IfEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.LogEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.OnEntryOnEntryCompartment2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Param2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.RaiseEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Script2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.SendEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.ValidateEditPart;
+import org.apache.commons.scxml.modeling.diagram.part.ModelingVisualIDRegistry;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class OnEntry2ItemSemanticEditPolicy extends
+ ModelingBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyChildNodesCommand(cc);
+ addDestroyShortcutsCommand(cc);
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addDestroyChildNodesCommand(CompoundCommand cmd) {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if (annotation != null) {
+ return;
+ }
+ for (Iterator it = view.getChildren().iterator(); it.hasNext();) {
+ Node node = (Node) it.next();
+ switch (ModelingVisualIDRegistry.getVisualID(node)) {
+ case OnEntryOnEntryCompartment2EditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit
+ .hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (ModelingVisualIDRegistry.getVisualID(cnode)) {
+ case IfEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case AssignEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case RaiseEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case LogEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case ValidateEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case CancelEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case SendEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Param2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Script2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case ExtenExecContentEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+}
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/OnEntry2ItemSemanticEditPolicy.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/OnEntry3ItemSemanticEditPolicy.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/OnEntry3ItemSemanticEditPolicy.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/OnEntry3ItemSemanticEditPolicy.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/OnEntry3ItemSemanticEditPolicy.java Wed Jun 9 16:29:10 2010
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.scxml.modeling.diagram.edit.policies;
+
+import java.util.Iterator;
+
+import org.apache.commons.scxml.modeling.diagram.edit.parts.AssignEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.CancelEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.ExtenExecContentEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.IfEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.LogEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.OnEntryOnEntryCompartment3EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Param2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.RaiseEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Script2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.SendEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.ValidateEditPart;
+import org.apache.commons.scxml.modeling.diagram.part.ModelingVisualIDRegistry;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class OnEntry3ItemSemanticEditPolicy extends
+ ModelingBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyChildNodesCommand(cc);
+ addDestroyShortcutsCommand(cc);
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addDestroyChildNodesCommand(CompoundCommand cmd) {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if (annotation != null) {
+ return;
+ }
+ for (Iterator it = view.getChildren().iterator(); it.hasNext();) {
+ Node node = (Node) it.next();
+ switch (ModelingVisualIDRegistry.getVisualID(node)) {
+ case OnEntryOnEntryCompartment3EditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit
+ .hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (ModelingVisualIDRegistry.getVisualID(cnode)) {
+ case IfEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case AssignEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case RaiseEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case LogEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case ValidateEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case CancelEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case SendEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Param2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Script2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case ExtenExecContentEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+}
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/OnEntry3ItemSemanticEditPolicy.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/OnEntryItemSemanticEditPolicy.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/OnEntryItemSemanticEditPolicy.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/OnEntryItemSemanticEditPolicy.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/OnEntryItemSemanticEditPolicy.java Wed Jun 9 16:29:10 2010
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.scxml.modeling.diagram.edit.policies;
+
+import java.util.Iterator;
+
+import org.apache.commons.scxml.modeling.diagram.edit.parts.AssignEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.CancelEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.ExtenExecContentEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.IfEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.LogEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.OnEntryOnEntryCompartmentEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Param2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.RaiseEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Script2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.SendEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.ValidateEditPart;
+import org.apache.commons.scxml.modeling.diagram.part.ModelingVisualIDRegistry;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class OnEntryItemSemanticEditPolicy extends
+ ModelingBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyChildNodesCommand(cc);
+ addDestroyShortcutsCommand(cc);
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addDestroyChildNodesCommand(CompoundCommand cmd) {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if (annotation != null) {
+ return;
+ }
+ for (Iterator it = view.getChildren().iterator(); it.hasNext();) {
+ Node node = (Node) it.next();
+ switch (ModelingVisualIDRegistry.getVisualID(node)) {
+ case OnEntryOnEntryCompartmentEditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit
+ .hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (ModelingVisualIDRegistry.getVisualID(cnode)) {
+ case IfEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case AssignEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case RaiseEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case LogEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case ValidateEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case CancelEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case SendEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Param2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case Script2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case ExtenExecContentEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+}
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/OnEntryItemSemanticEditPolicy.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/OnEntryOnEntryCompartment2CanonicalEditPolicy.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/OnEntryOnEntryCompartment2CanonicalEditPolicy.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/OnEntryOnEntryCompartment2CanonicalEditPolicy.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/OnEntryOnEntryCompartment2CanonicalEditPolicy.java Wed Jun 9 16:29:10 2010
@@ -0,0 +1,112 @@
+/*
+ * 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.AssignEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.CancelEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.ExtenExecContentEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.IfEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.LogEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Param2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.RaiseEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Script2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.SendEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.ValidateEditPart;
+import org.apache.commons.scxml.modeling.diagram.part.ModelingDiagramUpdater;
+import org.apache.commons.scxml.modeling.diagram.part.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 OnEntryOnEntryCompartment2CanonicalEditPolicy extends
+ CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = ModelingDiagramUpdater
+ .getOnEntryOnEntryCompartment_7014SemanticChildren(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 IfEditPart.VISUAL_ID:
+ case AssignEditPart.VISUAL_ID:
+ case RaiseEditPart.VISUAL_ID:
+ case LogEditPart.VISUAL_ID:
+ case ValidateEditPart.VISUAL_ID:
+ case CancelEditPart.VISUAL_ID:
+ case SendEditPart.VISUAL_ID:
+ case Param2EditPart.VISUAL_ID:
+ case Script2EditPart.VISUAL_ID:
+ case ExtenExecContentEditPart.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
+ .getOnEntry_ExecutableContext());
+ myFeaturesToSynchronize.add(ModelingPackage.eINSTANCE
+ .getOnEntry_Script());
+ }
+ 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/OnEntryOnEntryCompartment2CanonicalEditPolicy.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/OnEntryOnEntryCompartment2ItemSemanticEditPolicy.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/OnEntryOnEntryCompartment2ItemSemanticEditPolicy.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/OnEntryOnEntryCompartment2ItemSemanticEditPolicy.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/OnEntryOnEntryCompartment2ItemSemanticEditPolicy.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.edit.policies;
+
+import org.apache.commons.scxml.modeling.ModelingPackage;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.AssignCreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.CancelCreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.ExtenExecContentCreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.IfCreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.LogCreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.Param2CreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.RaiseCreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.Script2CreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.SendCreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.ValidateCreateCommand;
+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 OnEntryOnEntryCompartment2ItemSemanticEditPolicy extends
+ ModelingBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (ModelingElementTypes.If_3002 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(ModelingPackage.eINSTANCE
+ .getOnEntry_ExecutableContext());
+ }
+ return getGEFWrapper(new IfCreateCommand(req));
+ }
+ if (ModelingElementTypes.Assign_3005 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(ModelingPackage.eINSTANCE
+ .getOnEntry_ExecutableContext());
+ }
+ return getGEFWrapper(new AssignCreateCommand(req));
+ }
+ if (ModelingElementTypes.Raise_3006 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(ModelingPackage.eINSTANCE
+ .getOnEntry_ExecutableContext());
+ }
+ return getGEFWrapper(new RaiseCreateCommand(req));
+ }
+ if (ModelingElementTypes.Log_3007 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(ModelingPackage.eINSTANCE
+ .getOnEntry_ExecutableContext());
+ }
+ return getGEFWrapper(new LogCreateCommand(req));
+ }
+ if (ModelingElementTypes.Validate_3008 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(ModelingPackage.eINSTANCE
+ .getOnEntry_ExecutableContext());
+ }
+ return getGEFWrapper(new ValidateCreateCommand(req));
+ }
+ if (ModelingElementTypes.Cancel_3009 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(ModelingPackage.eINSTANCE
+ .getOnEntry_ExecutableContext());
+ }
+ return getGEFWrapper(new CancelCreateCommand(req));
+ }
+ if (ModelingElementTypes.Send_3010 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(ModelingPackage.eINSTANCE
+ .getOnEntry_ExecutableContext());
+ }
+ return getGEFWrapper(new SendCreateCommand(req));
+ }
+ if (ModelingElementTypes.Param_3014 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(ModelingPackage.eINSTANCE
+ .getOnEntry_ExecutableContext());
+ }
+ return getGEFWrapper(new Param2CreateCommand(req));
+ }
+ if (ModelingElementTypes.Script_3015 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(ModelingPackage.eINSTANCE
+ .getOnEntry_Script());
+ }
+ return getGEFWrapper(new Script2CreateCommand(req));
+ }
+ if (ModelingElementTypes.ExtenExecContent_3049 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(ModelingPackage.eINSTANCE
+ .getOnEntry_ExecutableContext());
+ }
+ return getGEFWrapper(new ExtenExecContentCreateCommand(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/OnEntryOnEntryCompartment2ItemSemanticEditPolicy.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/OnEntryOnEntryCompartment3CanonicalEditPolicy.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/OnEntryOnEntryCompartment3CanonicalEditPolicy.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/OnEntryOnEntryCompartment3CanonicalEditPolicy.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/OnEntryOnEntryCompartment3CanonicalEditPolicy.java Wed Jun 9 16:29:10 2010
@@ -0,0 +1,112 @@
+/*
+ * 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.AssignEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.CancelEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.ExtenExecContentEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.IfEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.LogEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Param2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.RaiseEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Script2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.SendEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.ValidateEditPart;
+import org.apache.commons.scxml.modeling.diagram.part.ModelingDiagramUpdater;
+import org.apache.commons.scxml.modeling.diagram.part.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 OnEntryOnEntryCompartment3CanonicalEditPolicy extends
+ CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = ModelingDiagramUpdater
+ .getOnEntryOnEntryCompartment_7020SemanticChildren(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 IfEditPart.VISUAL_ID:
+ case AssignEditPart.VISUAL_ID:
+ case RaiseEditPart.VISUAL_ID:
+ case LogEditPart.VISUAL_ID:
+ case ValidateEditPart.VISUAL_ID:
+ case CancelEditPart.VISUAL_ID:
+ case SendEditPart.VISUAL_ID:
+ case Param2EditPart.VISUAL_ID:
+ case Script2EditPart.VISUAL_ID:
+ case ExtenExecContentEditPart.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
+ .getOnEntry_ExecutableContext());
+ myFeaturesToSynchronize.add(ModelingPackage.eINSTANCE
+ .getOnEntry_Script());
+ }
+ 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/OnEntryOnEntryCompartment3CanonicalEditPolicy.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/OnEntryOnEntryCompartment3ItemSemanticEditPolicy.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/OnEntryOnEntryCompartment3ItemSemanticEditPolicy.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/OnEntryOnEntryCompartment3ItemSemanticEditPolicy.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/OnEntryOnEntryCompartment3ItemSemanticEditPolicy.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.edit.policies;
+
+import org.apache.commons.scxml.modeling.ModelingPackage;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.AssignCreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.CancelCreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.ExtenExecContentCreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.IfCreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.LogCreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.Param2CreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.RaiseCreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.Script2CreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.SendCreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.ValidateCreateCommand;
+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 OnEntryOnEntryCompartment3ItemSemanticEditPolicy extends
+ ModelingBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (ModelingElementTypes.If_3002 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(ModelingPackage.eINSTANCE
+ .getOnEntry_ExecutableContext());
+ }
+ return getGEFWrapper(new IfCreateCommand(req));
+ }
+ if (ModelingElementTypes.Assign_3005 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(ModelingPackage.eINSTANCE
+ .getOnEntry_ExecutableContext());
+ }
+ return getGEFWrapper(new AssignCreateCommand(req));
+ }
+ if (ModelingElementTypes.Raise_3006 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(ModelingPackage.eINSTANCE
+ .getOnEntry_ExecutableContext());
+ }
+ return getGEFWrapper(new RaiseCreateCommand(req));
+ }
+ if (ModelingElementTypes.Log_3007 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(ModelingPackage.eINSTANCE
+ .getOnEntry_ExecutableContext());
+ }
+ return getGEFWrapper(new LogCreateCommand(req));
+ }
+ if (ModelingElementTypes.Validate_3008 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(ModelingPackage.eINSTANCE
+ .getOnEntry_ExecutableContext());
+ }
+ return getGEFWrapper(new ValidateCreateCommand(req));
+ }
+ if (ModelingElementTypes.Cancel_3009 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(ModelingPackage.eINSTANCE
+ .getOnEntry_ExecutableContext());
+ }
+ return getGEFWrapper(new CancelCreateCommand(req));
+ }
+ if (ModelingElementTypes.Send_3010 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(ModelingPackage.eINSTANCE
+ .getOnEntry_ExecutableContext());
+ }
+ return getGEFWrapper(new SendCreateCommand(req));
+ }
+ if (ModelingElementTypes.Param_3014 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(ModelingPackage.eINSTANCE
+ .getOnEntry_ExecutableContext());
+ }
+ return getGEFWrapper(new Param2CreateCommand(req));
+ }
+ if (ModelingElementTypes.Script_3015 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(ModelingPackage.eINSTANCE
+ .getOnEntry_Script());
+ }
+ return getGEFWrapper(new Script2CreateCommand(req));
+ }
+ if (ModelingElementTypes.ExtenExecContent_3049 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(ModelingPackage.eINSTANCE
+ .getOnEntry_ExecutableContext());
+ }
+ return getGEFWrapper(new ExtenExecContentCreateCommand(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/OnEntryOnEntryCompartment3ItemSemanticEditPolicy.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/OnEntryOnEntryCompartmentCanonicalEditPolicy.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/OnEntryOnEntryCompartmentCanonicalEditPolicy.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/OnEntryOnEntryCompartmentCanonicalEditPolicy.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/OnEntryOnEntryCompartmentCanonicalEditPolicy.java Wed Jun 9 16:29:10 2010
@@ -0,0 +1,112 @@
+/*
+ * 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.AssignEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.CancelEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.ExtenExecContentEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.IfEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.LogEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Param2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.RaiseEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.Script2EditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.SendEditPart;
+import org.apache.commons.scxml.modeling.diagram.edit.parts.ValidateEditPart;
+import org.apache.commons.scxml.modeling.diagram.part.ModelingDiagramUpdater;
+import org.apache.commons.scxml.modeling.diagram.part.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 OnEntryOnEntryCompartmentCanonicalEditPolicy extends
+ CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = ModelingDiagramUpdater
+ .getOnEntryOnEntryCompartment_7002SemanticChildren(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 IfEditPart.VISUAL_ID:
+ case AssignEditPart.VISUAL_ID:
+ case RaiseEditPart.VISUAL_ID:
+ case LogEditPart.VISUAL_ID:
+ case ValidateEditPart.VISUAL_ID:
+ case CancelEditPart.VISUAL_ID:
+ case SendEditPart.VISUAL_ID:
+ case Param2EditPart.VISUAL_ID:
+ case Script2EditPart.VISUAL_ID:
+ case ExtenExecContentEditPart.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
+ .getOnEntry_ExecutableContext());
+ myFeaturesToSynchronize.add(ModelingPackage.eINSTANCE
+ .getOnEntry_Script());
+ }
+ 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/OnEntryOnEntryCompartmentCanonicalEditPolicy.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/OnEntryOnEntryCompartmentItemSemanticEditPolicy.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/OnEntryOnEntryCompartmentItemSemanticEditPolicy.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/OnEntryOnEntryCompartmentItemSemanticEditPolicy.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/OnEntryOnEntryCompartmentItemSemanticEditPolicy.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.edit.policies;
+
+import org.apache.commons.scxml.modeling.ModelingPackage;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.AssignCreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.CancelCreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.ExtenExecContentCreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.IfCreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.LogCreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.Param2CreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.RaiseCreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.Script2CreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.SendCreateCommand;
+import org.apache.commons.scxml.modeling.diagram.edit.commands.ValidateCreateCommand;
+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 OnEntryOnEntryCompartmentItemSemanticEditPolicy extends
+ ModelingBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (ModelingElementTypes.If_3002 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(ModelingPackage.eINSTANCE
+ .getOnEntry_ExecutableContext());
+ }
+ return getGEFWrapper(new IfCreateCommand(req));
+ }
+ if (ModelingElementTypes.Assign_3005 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(ModelingPackage.eINSTANCE
+ .getOnEntry_ExecutableContext());
+ }
+ return getGEFWrapper(new AssignCreateCommand(req));
+ }
+ if (ModelingElementTypes.Raise_3006 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(ModelingPackage.eINSTANCE
+ .getOnEntry_ExecutableContext());
+ }
+ return getGEFWrapper(new RaiseCreateCommand(req));
+ }
+ if (ModelingElementTypes.Log_3007 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(ModelingPackage.eINSTANCE
+ .getOnEntry_ExecutableContext());
+ }
+ return getGEFWrapper(new LogCreateCommand(req));
+ }
+ if (ModelingElementTypes.Validate_3008 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(ModelingPackage.eINSTANCE
+ .getOnEntry_ExecutableContext());
+ }
+ return getGEFWrapper(new ValidateCreateCommand(req));
+ }
+ if (ModelingElementTypes.Cancel_3009 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(ModelingPackage.eINSTANCE
+ .getOnEntry_ExecutableContext());
+ }
+ return getGEFWrapper(new CancelCreateCommand(req));
+ }
+ if (ModelingElementTypes.Send_3010 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(ModelingPackage.eINSTANCE
+ .getOnEntry_ExecutableContext());
+ }
+ return getGEFWrapper(new SendCreateCommand(req));
+ }
+ if (ModelingElementTypes.Param_3014 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(ModelingPackage.eINSTANCE
+ .getOnEntry_ExecutableContext());
+ }
+ return getGEFWrapper(new Param2CreateCommand(req));
+ }
+ if (ModelingElementTypes.Script_3015 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(ModelingPackage.eINSTANCE
+ .getOnEntry_Script());
+ }
+ return getGEFWrapper(new Script2CreateCommand(req));
+ }
+ if (ModelingElementTypes.ExtenExecContent_3049 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(ModelingPackage.eINSTANCE
+ .getOnEntry_ExecutableContext());
+ }
+ return getGEFWrapper(new ExtenExecContentCreateCommand(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/OnEntryOnEntryCompartmentItemSemanticEditPolicy.java
------------------------------------------------------------------------------
svn:eol-style = native