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/DeviceCompositeEditPartCN.java')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/DeviceCompositeEditPartCN.java129
1 files changed, 49 insertions, 80 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/DeviceCompositeEditPartCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/DeviceCompositeEditPartCN.java
index b5e3aae511d..f9fabc21038 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/DeviceCompositeEditPartCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/DeviceCompositeEditPartCN.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.CustomDiagramDragDropEditPolicy;
import org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies.RemoveOrphanViewPolicy;
import org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies.StructuredClassifierLayoutEditPolicy;
import org.eclipse.papyrus.uml.diagram.composite.custom.figures.DeviceCompositeFigure;
-import org.eclipse.papyrus.uml.diagram.composite.edit.policies.DeviceCompositeItemSemanticEditPolicyCN;
import org.eclipse.papyrus.uml.diagram.composite.part.UMLVisualIDRegistry;
import org.eclipse.swt.graphics.Color;
@@ -89,11 +91,11 @@ public class DeviceCompositeEditPartCN 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 DeviceCompositeItemSemanticEditPolicyCN());
+ 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,24 +119,23 @@ public class DeviceCompositeEditPartCN 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 DeviceCompositeFloatingLabelEditPartCN.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:
return new BorderItemResizableEditPolicy();
}
EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (result == null) {
+ if(result == null) {
result = new NonResizableEditPolicy();
}
return result;
@@ -154,74 +155,61 @@ public class DeviceCompositeEditPartCN 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 DeviceCompositeFigure();
}
/**
* org.eclipse.papyrus.uml.diagram.composite.custom.figures.DeviceCompositeFigure
- *
* @generated
*/
- @Override
public DeviceCompositeFigure getPrimaryShape() {
- return (DeviceCompositeFigure) primaryShape;
+ return (DeviceCompositeFigure)primaryShape;
}
/**
* @generated
*/
protected boolean addFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof DeviceCompositeNameEditPartCN) {
- ((DeviceCompositeNameEditPartCN) childEditPart).setLabel(getPrimaryShape().getNameLabel());
+ if(childEditPart instanceof DeviceCompositeNameEditPartCN) {
+ ((DeviceCompositeNameEditPartCN)childEditPart).setLabel(getPrimaryShape().getNameLabel());
return true;
}
-
-
- if (childEditPart instanceof DeviceCompositeCompartmentEditPartCN) {
+ if(childEditPart instanceof DeviceCompositeCompartmentEditPartCN) {
IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
- setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
- pane.add(((DeviceCompositeCompartmentEditPartCN) childEditPart).getFigure());
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((DeviceCompositeCompartmentEditPartCN)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;
}
-
-
return false;
}
@@ -229,16 +217,16 @@ public class DeviceCompositeEditPartCN extends RoundedCompartmentEditPart {
* @generated
*/
protected boolean removeFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof DeviceCompositeNameEditPartCN) {
+ if(childEditPart instanceof DeviceCompositeNameEditPartCN) {
return true;
}
- if (childEditPart instanceof DeviceCompositeCompartmentEditPartCN) {
+ if(childEditPart instanceof DeviceCompositeCompartmentEditPartCN) {
IFigure pane = getPrimaryShape().getCompositeCompartmentFigure();
- pane.remove(((DeviceCompositeCompartmentEditPartCN) childEditPart).getFigure());
+ pane.remove(((DeviceCompositeCompartmentEditPartCN)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;
}
return false;
@@ -247,9 +235,8 @@ public class DeviceCompositeEditPartCN extends RoundedCompartmentEditPart {
/**
* @generated
*/
- @Override
protected void addChildVisual(EditPart childEditPart, int index) {
- if (addFixedChild(childEditPart)) {
+ if(addFixedChild(childEditPart)) {
return;
}
super.addChildVisual(childEditPart, -1);
@@ -258,9 +245,8 @@ public class DeviceCompositeEditPartCN extends RoundedCompartmentEditPart {
/**
* @generated
*/
- @Override
protected void removeChildVisual(EditPart childEditPart) {
- if (removeFixedChild(childEditPart)) {
+ if(removeFixedChild(childEditPart)) {
return;
}
super.removeChildVisual(childEditPart);
@@ -269,12 +255,11 @@ public class DeviceCompositeEditPartCN extends RoundedCompartmentEditPart {
/**
* @generated
*/
- @Override
protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
- if (editPart instanceof DeviceCompositeCompartmentEditPartCN) {
+ if(editPart instanceof DeviceCompositeCompartmentEditPartCN) {
return getPrimaryShape().getCompositeCompartmentFigure();
}
- if (editPart instanceof IBorderItemEditPart) {
+ if(editPart instanceof IBorderItemEditPart) {
return getBorderedFigure().getBorderItemContainer();
}
return getContentPane();
@@ -283,21 +268,15 @@ public class DeviceCompositeEditPartCN extends RoundedCompartmentEditPart {
/**
* @generated
*/
- @Override
protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) {
- if (borderItemEditPart instanceof DeviceCompositeFloatingLabelEditPartCN) {
+ if(borderItemEditPart instanceof DeviceCompositeFloatingLabelEditPartCN) {
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;
@@ -305,29 +284,24 @@ public class DeviceCompositeEditPartCN 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);
@@ -338,9 +312,8 @@ public class DeviceCompositeEditPartCN extends RoundedCompartmentEditPart {
/**
* @generated
*/
- @Override
public IFigure getContentPane() {
- if (contentPane != null) {
+ if(contentPane != null) {
return contentPane;
}
return super.getContentPane();
@@ -349,9 +322,8 @@ public class DeviceCompositeEditPartCN extends RoundedCompartmentEditPart {
/**
* @generated
*/
- @Override
protected void setForegroundColor(Color color) {
- if (primaryShape != null) {
+ if(primaryShape != null) {
primaryShape.setForegroundColor(color);
}
}
@@ -359,7 +331,6 @@ public class DeviceCompositeEditPartCN extends RoundedCompartmentEditPart {
/**
* @generated
*/
- @Override
protected void setLineWidth(int width) {
super.setLineWidth(width);
}
@@ -367,17 +338,15 @@ public class DeviceCompositeEditPartCN 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(DeviceCompositeNameEditPartCN.VISUAL_ID));
}

Back to the top