diff options
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInReadIsClassifiedObjectActionAsObjectEditPart.java')
-rw-r--r-- | plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInReadIsClassifiedObjectActionAsObjectEditPart.java | 67 |
1 files changed, 31 insertions, 36 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInReadIsClassifiedObjectActionAsObjectEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInReadIsClassifiedObjectActionAsObjectEditPart.java index 11b59afd1d0..c73b4e935d2 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInReadIsClassifiedObjectActionAsObjectEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInReadIsClassifiedObjectActionAsObjectEditPart.java @@ -46,7 +46,7 @@ public class ActionPinInReadIsClassifiedObjectActionAsObjectEditPart extends Abs /** * @generated */ - public static final int VISUAL_ID = 3168; + public static final String VISUAL_ID = "3168"; /** * @generated @@ -72,12 +72,9 @@ public class ActionPinInReadIsClassifiedObjectActionAsObjectEditPart extends Abs super.createDefaultEditPolicies(); installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, getPrimaryDragEditPolicy()); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); - installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); - installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); - installEditPolicy(EditPolicyRoles.OPEN_ROLE, - new OpenDiagramEditPolicy()); + installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy()); installEditPolicy(EditPolicy.LAYOUT_ROLE, new PinLayoutEditPolicy()); installEditPolicy(RequestConstants.REQ_DELETE, new NoDeleteFromDiagramEditPolicy()); // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies @@ -92,23 +89,26 @@ public class ActionPinInReadIsClassifiedObjectActionAsObjectEditPart extends Abs @Override protected EditPolicy createChildEditPolicy(EditPart child) { - View childView = (View) child.getModel(); - switch (UMLVisualIDRegistry.getVisualID(childView)) { - case ActionPinInReadIsClassifiedObjectActionAsObjectLabelEditPart.VISUAL_ID: - case ActionPinInReadIsClassifiedObjectActionAsObjectValueEditPart.VISUAL_ID: - case ActionPinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID: - return new BorderItemSelectionEditPolicy() { + View childView = (View)child.getModel(); + String vid = UMLVisualIDRegistry.getVisualID(childView); + if(vid != null) { + switch(vid) { + case ActionPinInReadIsClassifiedObjectActionAsObjectLabelEditPart.VISUAL_ID: + case ActionPinInReadIsClassifiedObjectActionAsObjectValueEditPart.VISUAL_ID: + case ActionPinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID: + return new BorderItemSelectionEditPolicy() { - @Override - protected List<?> createSelectionHandles() { - MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost()); - mh.setBorder(null); - return Collections.singletonList(mh); - } - }; + @Override + protected List<?> createSelectionHandles() { + MoveHandle mh = new MoveHandle((GraphicalEditPart)getHost()); + mh.setBorder(null); + return Collections.singletonList(mh); + } + }; + } } EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (result == null) { + if(result == null) { result = new NonResizableEditPolicy(); } return result; @@ -137,18 +137,16 @@ public class ActionPinInReadIsClassifiedObjectActionAsObjectEditPart extends Abs * 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 (false == notifier instanceof Edge - && false == notifier instanceof BasicCompartment) { - if (modelChildren.contains(event.getNotifier())) { + List<?> modelChildren = ((View)getModel()).getChildren(); + if(false == notifier instanceof Edge && false == notifier instanceof BasicCompartment) { + if(modelChildren.contains(event.getNotifier())) { return; } } } super.handleNotificationEvent(event); - } /** @@ -164,22 +162,20 @@ public class ActionPinInReadIsClassifiedObjectActionAsObjectEditPart extends Abs * @generated */ public PinFigure getPrimaryShape() { - return (PinFigure) primaryShape; + return (PinFigure)primaryShape; } /** * @generated */ protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) { - if (borderItemEditPart instanceof ActionPinInReadIsClassifiedObjectActionAsObjectLabelEditPart) { + if(borderItemEditPart instanceof ActionPinInReadIsClassifiedObjectActionAsObjectLabelEditPart) { IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); borderItemContainer.add(borderItemEditPart.getFigure(), locator); - } else - if (borderItemEditPart instanceof ActionPinInReadIsClassifiedObjectActionAsObjectValueEditPart) { + } else if(borderItemEditPart instanceof ActionPinInReadIsClassifiedObjectActionAsObjectValueEditPart) { IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); borderItemContainer.add(borderItemEditPart.getFigure(), locator); - } else - if (borderItemEditPart instanceof ActionPinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart) { + } else if(borderItemEditPart instanceof ActionPinInReadIsClassifiedObjectActionAsObjectAppliedStereotypeLabelEditPart) { IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); borderItemContainer.add(borderItemEditPart.getFigure(), locator); } else { @@ -210,7 +206,6 @@ public class ActionPinInReadIsClassifiedObjectActionAsObjectEditPart extends Abs figure.add(shape); contentPane = setupContentPane(shape); return figure; - } /** @@ -229,7 +224,7 @@ public class ActionPinInReadIsClassifiedObjectActionAsObjectEditPart extends Abs * @generated */ public IFigure getContentPane() { - if (contentPane != null) { + if(contentPane != null) { return contentPane; } return super.getContentPane(); @@ -239,7 +234,7 @@ public class ActionPinInReadIsClassifiedObjectActionAsObjectEditPart extends Abs * @generated */ protected void setForegroundColor(Color color) { - if (primaryShape != null) { + if(primaryShape != null) { primaryShape.setForegroundColor(color); } } @@ -255,8 +250,8 @@ public class ActionPinInReadIsClassifiedObjectActionAsObjectEditPart extends Abs * @generated */ protected void setLineType(int style) { - if (primaryShape instanceof IPapyrusNodeFigure) { - ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); + if(primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure)primaryShape).setLineStyle(style); } } |