diff options
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageEditPart.java')
-rw-r--r-- | plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageEditPart.java | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageEditPart.java index a74e208c796..13a7268c692 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/PackageEditPart.java @@ -48,7 +48,7 @@ public class PackageEditPart extends org.eclipse.papyrus.uml.diagram.common.edit /** * @generated */ - public static final String VISUAL_ID = "2009"; + public static final String VISUAL_ID = "Package_Shape"; /** * @generated @@ -74,10 +74,14 @@ public class PackageEditPart extends org.eclipse.papyrus.uml.diagram.common.edit protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); - installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, + new AppliedStereotypeNodeLabelDisplayEditPolicy()); + installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, + new ShowHideCompartmentEditPolicy()); installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); installEditPolicy("RESIZE_BORDER_ITEMS", new ConstrainedItemBorderLayoutEditPolicy()); //$NON-NLS-1$ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy()); @@ -94,7 +98,7 @@ public class PackageEditPart extends org.eclipse.papyrus.uml.diagram.common.edit @Override protected EditPolicy createChildEditPolicy(EditPart child) { EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if(result == null) { + if (result == null) { result = new NonResizableEditPolicy(); } return result; @@ -121,6 +125,7 @@ public class PackageEditPart extends org.eclipse.papyrus.uml.diagram.common.edit @Override protected void handleNotificationEvent(Notification event) { super.handleNotificationEvent(event); + } /** @@ -138,23 +143,25 @@ public class PackageEditPart extends org.eclipse.papyrus.uml.diagram.common.edit */ @Override public PackageFigure getPrimaryShape() { - return (PackageFigure)primaryShape; + return (PackageFigure) primaryShape; } /** * @generated */ protected boolean addFixedChild(EditPart childEditPart) { - if(childEditPart instanceof PackageNameEditPart) { - ((PackageNameEditPart)childEditPart).setLabel(getPrimaryShape().getNameLabel()); + if (childEditPart instanceof PackageNameEditPart) { + ((PackageNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); return true; } - if(childEditPart instanceof PackagePackageableElementCompartmentEditPart) { + + if (childEditPart instanceof PackagePackageableElementCompartmentEditPart) { IFigure pane = getPrimaryShape().getPackageableElementFigure(); setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way - pane.add(((PackagePackageableElementCompartmentEditPart)childEditPart).getFigure()); + pane.add(((PackagePackageableElementCompartmentEditPart) childEditPart).getFigure()); return true; } + return false; } @@ -162,12 +169,12 @@ public class PackageEditPart extends org.eclipse.papyrus.uml.diagram.common.edit * @generated */ protected boolean removeFixedChild(EditPart childEditPart) { - if(childEditPart instanceof PackageNameEditPart) { + if (childEditPart instanceof PackageNameEditPart) { return true; } - if(childEditPart instanceof PackagePackageableElementCompartmentEditPart) { + if (childEditPart instanceof PackagePackageableElementCompartmentEditPart) { IFigure pane = getPrimaryShape().getPackageableElementFigure(); - pane.remove(((PackagePackageableElementCompartmentEditPart)childEditPart).getFigure()); + pane.remove(((PackagePackageableElementCompartmentEditPart) childEditPart).getFigure()); return true; } return false; @@ -178,7 +185,7 @@ public class PackageEditPart extends org.eclipse.papyrus.uml.diagram.common.edit */ @Override protected void addChildVisual(EditPart childEditPart, int index) { - if(addFixedChild(childEditPart)) { + if (addFixedChild(childEditPart)) { return; } super.addChildVisual(childEditPart, -1); @@ -189,7 +196,7 @@ public class PackageEditPart extends org.eclipse.papyrus.uml.diagram.common.edit */ @Override protected void removeChildVisual(EditPart childEditPart) { - if(removeFixedChild(childEditPart)) { + if (removeFixedChild(childEditPart)) { return; } super.removeChildVisual(childEditPart); @@ -200,7 +207,7 @@ public class PackageEditPart extends org.eclipse.papyrus.uml.diagram.common.edit */ @Override protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - if(editPart instanceof PackagePackageableElementCompartmentEditPart) { + if (editPart instanceof PackagePackageableElementCompartmentEditPart) { return getPrimaryShape().getPackageableElementFigure(); } return getContentPane(); @@ -226,6 +233,7 @@ public class PackageEditPart extends org.eclipse.papyrus.uml.diagram.common.edit @Override protected NodeFigure createNodeFigure() { return new SelectableBorderedNodeFigure(createMainFigureWithSVG()); + } /** @@ -238,7 +246,7 @@ public class PackageEditPart extends org.eclipse.papyrus.uml.diagram.common.edit */ @Override protected IFigure setupContentPane(IFigure nodeShape) { - if(nodeShape.getLayoutManager() == null) { + if (nodeShape.getLayoutManager() == null) { ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); layout.setSpacing(5); nodeShape.setLayoutManager(layout); @@ -251,7 +259,7 @@ public class PackageEditPart extends org.eclipse.papyrus.uml.diagram.common.edit */ @Override public IFigure getContentPane() { - if(contentPane != null) { + if (contentPane != null) { return contentPane; } return super.getContentPane(); @@ -262,7 +270,7 @@ public class PackageEditPart extends org.eclipse.papyrus.uml.diagram.common.edit */ @Override protected void setForegroundColor(Color color) { - if(primaryShape != null) { + if (primaryShape != null) { primaryShape.setForegroundColor(color); } } @@ -280,8 +288,8 @@ public class PackageEditPart extends org.eclipse.papyrus.uml.diagram.common.edit */ @Override protected void setLineType(int style) { - if(primaryShape instanceof IPapyrusNodeFigure) { - ((IPapyrusNodeFigure)primaryShape).setLineStyle(style); + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); } } |