Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/InteractionCompositeEditPartCN.java')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/InteractionCompositeEditPartCN.java145
1 files changed, 55 insertions, 90 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/InteractionCompositeEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/InteractionCompositeEditPartCN.java
index c4c1e923302..02ae2d5e1f4 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/InteractionCompositeEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/InteractionCompositeEditPartCN.java
@@ -1,11 +1,11 @@
/**
* Copyright (c) 2014 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* CEA LIST - Initial API and implementation
*/
@@ -37,6 +37,9 @@ import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
import org.eclipse.gmf.runtime.notation.Edge;
import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultGraphicalNodeEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.GetChildLayoutEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure;
import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure;
@@ -46,16 +49,15 @@ import org.eclipse.papyrus.uml.diagram.common.editpolicies.AffixedNodeAlignmentE
import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.BorderItemResizableEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.locator.PortPositionLocator;
import org.eclipse.papyrus.uml.diagram.common.locator.RoundedRectangleLabelPositionLocator;
import org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies.BehaviorLayoutEditPolicy;
import org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies.CustomDiagramDragDropEditPolicy;
import org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies.RemoveOrphanViewPolicy;
import org.eclipse.papyrus.uml.diagram.composite.custom.figures.InteractionCompositeFigure;
-import org.eclipse.papyrus.uml.diagram.composite.edit.policies.InteractionCompositeItemSemanticEditPolicyCN;
import org.eclipse.papyrus.uml.diagram.composite.part.UMLVisualIDRegistry;
import org.eclipse.swt.graphics.Color;
@@ -89,11 +91,11 @@ public class InteractionCompositeEditPartCN extends RoundedCompartmentEditPart {
/**
* @generated
*/
- @Override
protected void createDefaultEditPolicies() {
- installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy());
super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new InteractionCompositeItemSemanticEditPolicyCN());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy());
@@ -117,25 +119,24 @@ public class InteractionCompositeEditPartCN extends RoundedCompartmentEditPart {
@Override
protected EditPolicy createChildEditPolicy(EditPart child) {
- View childView = (View) child.getModel();
- switch (UMLVisualIDRegistry.getVisualID(childView)) {
+ View childView = (View)child.getModel();
+ switch(UMLVisualIDRegistry.getVisualID(childView)) {
case InteractionCompositeFloatingLabelEditPartCN.VISUAL_ID:
return new BorderItemSelectionEditPolicy() {
@Override
protected List<?> createSelectionHandles() {
- MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost());
+ MoveHandle mh = new MoveHandle((GraphicalEditPart)getHost());
mh.setBorder(null);
return Collections.singletonList(mh);
}
- }
- ;
+ };
case PortEditPart.VISUAL_ID:
case ParameterEditPart.VISUAL_ID:
return new BorderItemResizableEditPolicy();
}
EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (result == null) {
+ if(result == null) {
result = new NonResizableEditPolicy();
}
return result;
@@ -155,84 +156,67 @@ public class InteractionCompositeEditPartCN extends RoundedCompartmentEditPart {
}
/**
- * Papyrus codeGen
- *
- * @generated
+ *Papyrus codeGen
+ *@generated
**/
- @Override
protected void handleNotificationEvent(Notification event) {
/*
* when a node have external node labels, the methods refreshChildren() remove the EditPart corresponding to the Label from the EditPart
* Registry. After that, we can't reset the visibility to true (using the Show/Hide Label Action)!
*/
- if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) {
+ if(NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) {
Object notifier = event.getNotifier();
- List<?> modelChildren = ((View) getModel()).getChildren();
- if (!(notifier instanceof Edge)) {
- if (modelChildren.contains(event.getNotifier())) {
+ List<?> modelChildren = ((View)getModel()).getChildren();
+ if(!(notifier instanceof Edge)) {
+ if(modelChildren.contains(event.getNotifier())) {
return;
}
}
}
super.handleNotificationEvent(event);
-
}
/**
* @generated
*/
- @Override
protected IFigure createNodeShape() {
return primaryShape = new InteractionCompositeFigure();
}
/**
* org.eclipse.papyrus.uml.diagram.composite.custom.figures.InteractionCompositeFigure
- *
* @generated
*/
- @Override
public InteractionCompositeFigure getPrimaryShape() {
- return (InteractionCompositeFigure) primaryShape;
+ return (InteractionCompositeFigure)primaryShape;
}
/**
* @generated
*/
protected boolean addFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof InteractionCompositeNameEditPartCN) {
- ((InteractionCompositeNameEditPartCN) childEditPart).setLabel(getPrimaryShape().getNameLabel());
+ if(childEditPart instanceof InteractionCompositeNameEditPartCN) {
+ ((InteractionCompositeNameEditPartCN)childEditPart).setLabel(getPrimaryShape().getNameLabel());
return true;
}
-
-
- if (childEditPart instanceof InteractionCompositeCompartmentEditPartCN) {
+ if(childEditPart instanceof InteractionCompositeCompartmentEditPartCN) {
IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
- setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
- pane.add(((InteractionCompositeCompartmentEditPartCN) childEditPart).getFigure());
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((InteractionCompositeCompartmentEditPartCN)childEditPart).getFigure());
return true;
}
-
-
-
- // Papyrus Gencode :Affixed Port locator
- if (childEditPart instanceof PortEditPart) {
- IBorderItemLocator locator = new org.eclipse.papyrus.uml.diagram.common.locator.PortPositionLocator(getMainFigure(), PositionConstants.NONE);
- getBorderedFigure().getBorderItemContainer().add(((PortEditPart) childEditPart).getFigure(), locator);
+ //Papyrus Gencode :Affixed Port locator
+ if(childEditPart instanceof PortEditPart) {
+ IBorderItemLocator locator = new PortPositionLocator(getMainFigure(), PositionConstants.NONE);
+ getBorderedFigure().getBorderItemContainer().add(((PortEditPart)childEditPart).getFigure(), locator);
return true;
}
-
-
-
-
- // Papyrus Gencode :Affixed Port locator
- if (childEditPart instanceof ParameterEditPart) {
- IBorderItemLocator locator = new org.eclipse.papyrus.uml.diagram.common.locator.PortPositionLocator(getMainFigure(), PositionConstants.NONE);
- getBorderedFigure().getBorderItemContainer().add(((ParameterEditPart) childEditPart).getFigure(), locator);
+ //Papyrus Gencode :Affixed Port locator
+ if(childEditPart instanceof ParameterEditPart) {
+ IBorderItemLocator locator = new PortPositionLocator(getMainFigure(), PositionConstants.NONE);
+ getBorderedFigure().getBorderItemContainer().add(((ParameterEditPart)childEditPart).getFigure(), locator);
return true;
}
-
-
return false;
}
@@ -240,20 +224,20 @@ public class InteractionCompositeEditPartCN extends RoundedCompartmentEditPart {
* @generated
*/
protected boolean removeFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof InteractionCompositeNameEditPartCN) {
+ if(childEditPart instanceof InteractionCompositeNameEditPartCN) {
return true;
}
- if (childEditPart instanceof InteractionCompositeCompartmentEditPartCN) {
+ if(childEditPart instanceof InteractionCompositeCompartmentEditPartCN) {
IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
- pane.remove(((InteractionCompositeCompartmentEditPartCN) childEditPart).getFigure());
+ pane.remove(((InteractionCompositeCompartmentEditPartCN)childEditPart).getFigure());
return true;
}
- if (childEditPart instanceof PortEditPart) {
- getBorderedFigure().getBorderItemContainer().remove(((PortEditPart) childEditPart).getFigure());
+ if(childEditPart instanceof PortEditPart) {
+ getBorderedFigure().getBorderItemContainer().remove(((PortEditPart)childEditPart).getFigure());
return true;
}
- if (childEditPart instanceof ParameterEditPart) {
- getBorderedFigure().getBorderItemContainer().remove(((ParameterEditPart) childEditPart).getFigure());
+ if(childEditPart instanceof ParameterEditPart) {
+ getBorderedFigure().getBorderItemContainer().remove(((ParameterEditPart)childEditPart).getFigure());
return true;
}
return false;
@@ -262,9 +246,8 @@ public class InteractionCompositeEditPartCN extends RoundedCompartmentEditPart {
/**
* @generated
*/
- @Override
protected void addChildVisual(EditPart childEditPart, int index) {
- if (addFixedChild(childEditPart)) {
+ if(addFixedChild(childEditPart)) {
return;
}
super.addChildVisual(childEditPart, -1);
@@ -273,9 +256,8 @@ public class InteractionCompositeEditPartCN extends RoundedCompartmentEditPart {
/**
* @generated
*/
- @Override
protected void removeChildVisual(EditPart childEditPart) {
- if (removeFixedChild(childEditPart)) {
+ if(removeFixedChild(childEditPart)) {
return;
}
super.removeChildVisual(childEditPart);
@@ -284,12 +266,11 @@ public class InteractionCompositeEditPartCN extends RoundedCompartmentEditPart {
/**
* @generated
*/
- @Override
protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
- if (editPart instanceof InteractionCompositeCompartmentEditPartCN) {
+ if(editPart instanceof InteractionCompositeCompartmentEditPartCN) {
return getPrimaryShape().getCompositeCompartmentFigure();
}
- if (editPart instanceof IBorderItemEditPart) {
+ if(editPart instanceof IBorderItemEditPart) {
return getBorderedFigure().getBorderItemContainer();
}
return getContentPane();
@@ -298,21 +279,15 @@ public class InteractionCompositeEditPartCN extends RoundedCompartmentEditPart {
/**
* @generated
*/
- @Override
protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) {
- if (borderItemEditPart instanceof InteractionCompositeFloatingLabelEditPartCN) {
+ if(borderItemEditPart instanceof InteractionCompositeFloatingLabelEditPartCN) {
IBorderItemLocator locator = new RoundedRectangleLabelPositionLocator(getMainFigure());
borderItemContainer.add(borderItemEditPart.getFigure(), locator);
- } else
- {
+ } else {
super.addBorderItem(borderItemContainer, borderItemEditPart);
}
}
- /**
- * @generated
- */
- @Override
protected NodeFigure createNodePlate() {
RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(40, 40);
return result;
@@ -320,29 +295,24 @@ public class InteractionCompositeEditPartCN extends RoundedCompartmentEditPart {
/**
* Creates figure for this edit part.
- *
+ *
* Body of this method does not depend on settings in generation model
* so you may safely remove <i>generated</i> tag and modify it.
- *
+ *
* @generated
*/
- @Override
protected NodeFigure createMainFigure() {
return new SelectableBorderedNodeFigure(createMainFigureWithSVG());
-
}
/**
* Default implementation treats passed figure as content pane.
* Respects layout one may have set for generated figure.
- *
- * @param nodeShape
- * instance of generated figure class
+ * @param nodeShape instance of generated figure class
* @generated
*/
- @Override
protected IFigure setupContentPane(IFigure nodeShape) {
- if (nodeShape.getLayoutManager() == null) {
+ if(nodeShape.getLayoutManager() == null) {
ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
layout.setSpacing(5);
nodeShape.setLayoutManager(layout);
@@ -353,9 +323,8 @@ public class InteractionCompositeEditPartCN extends RoundedCompartmentEditPart {
/**
* @generated
*/
- @Override
public IFigure getContentPane() {
- if (contentPane != null) {
+ if(contentPane != null) {
return contentPane;
}
return super.getContentPane();
@@ -364,9 +333,8 @@ public class InteractionCompositeEditPartCN extends RoundedCompartmentEditPart {
/**
* @generated
*/
- @Override
protected void setForegroundColor(Color color) {
- if (primaryShape != null) {
+ if(primaryShape != null) {
primaryShape.setForegroundColor(color);
}
}
@@ -374,7 +342,6 @@ public class InteractionCompositeEditPartCN extends RoundedCompartmentEditPart {
/**
* @generated
*/
- @Override
protected void setLineWidth(int width) {
super.setLineWidth(width);
}
@@ -382,17 +349,15 @@ public class InteractionCompositeEditPartCN extends RoundedCompartmentEditPart {
/**
* @generated
*/
- @Override
protected void setLineType(int style) {
- if (primaryShape instanceof IPapyrusNodeFigure) {
- ((IPapyrusNodeFigure) primaryShape).setLineStyle(style);
+ if(primaryShape instanceof IPapyrusNodeFigure) {
+ ((IPapyrusNodeFigure)primaryShape).setLineStyle(style);
}
}
/**
* @generated
*/
- @Override
public EditPart getPrimaryChildEditPart() {
return getChildBySemanticHint(UMLVisualIDRegistry.getType(InteractionCompositeNameEditPartCN.VISUAL_ID));
}

Back to the top