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/InterfaceEditPart.java')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/InterfaceEditPart.java95
1 files changed, 34 insertions, 61 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/InterfaceEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/InterfaceEditPart.java
index 37df6a9ae34..f75c5a8caa7 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/InterfaceEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/InterfaceEditPart.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
*/
@@ -35,6 +35,8 @@ 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.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;
@@ -47,7 +49,6 @@ import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierCon
import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.locator.RoundedRectangleLabelPositionLocator;
import org.eclipse.papyrus.uml.diagram.composite.custom.figures.InterfaceCompositeFigure;
-import org.eclipse.papyrus.uml.diagram.composite.edit.policies.InterfaceItemSemanticEditPolicy;
import org.eclipse.papyrus.uml.diagram.composite.part.UMLVisualIDRegistry;
import org.eclipse.swt.graphics.Color;
@@ -81,10 +82,10 @@ public class InterfaceEditPart extends RoundedCompartmentEditPart {
/**
* @generated
*/
- @Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new InterfaceItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy());
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy());
installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
@@ -103,22 +104,21 @@ public class InterfaceEditPart 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 InterfaceFloatingLabelEditPart.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);
}
- }
- ;
+ };
}
EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (result == null) {
+ if(result == null) {
result = new NonResizableEditPolicy();
}
return result;
@@ -138,57 +138,49 @@ public class InterfaceEditPart 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 InterfaceCompositeFigure();
}
/**
* org.eclipse.papyrus.uml.diagram.composite.custom.figures.InterfaceCompositeFigure
- *
* @generated
*/
- @Override
public InterfaceCompositeFigure getPrimaryShape() {
- return (InterfaceCompositeFigure) primaryShape;
+ return (InterfaceCompositeFigure)primaryShape;
}
/**
* @generated
*/
protected boolean addFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof InterfaceNameEditPart) {
- ((InterfaceNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel());
+ if(childEditPart instanceof InterfaceNameEditPart) {
+ ((InterfaceNameEditPart)childEditPart).setLabel(getPrimaryShape().getNameLabel());
return true;
}
-
-
return false;
}
@@ -196,7 +188,7 @@ public class InterfaceEditPart extends RoundedCompartmentEditPart {
* @generated
*/
protected boolean removeFixedChild(EditPart childEditPart) {
- if (childEditPart instanceof InterfaceNameEditPart) {
+ if(childEditPart instanceof InterfaceNameEditPart) {
return true;
}
return false;
@@ -205,9 +197,8 @@ public class InterfaceEditPart extends RoundedCompartmentEditPart {
/**
* @generated
*/
- @Override
protected void addChildVisual(EditPart childEditPart, int index) {
- if (addFixedChild(childEditPart)) {
+ if(addFixedChild(childEditPart)) {
return;
}
super.addChildVisual(childEditPart, -1);
@@ -216,9 +207,8 @@ public class InterfaceEditPart extends RoundedCompartmentEditPart {
/**
* @generated
*/
- @Override
protected void removeChildVisual(EditPart childEditPart) {
- if (removeFixedChild(childEditPart)) {
+ if(removeFixedChild(childEditPart)) {
return;
}
super.removeChildVisual(childEditPart);
@@ -227,9 +217,8 @@ public class InterfaceEditPart extends RoundedCompartmentEditPart {
/**
* @generated
*/
- @Override
protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
- if (editPart instanceof IBorderItemEditPart) {
+ if(editPart instanceof IBorderItemEditPart) {
return getBorderedFigure().getBorderItemContainer();
}
return getContentPane();
@@ -238,21 +227,15 @@ public class InterfaceEditPart extends RoundedCompartmentEditPart {
/**
* @generated
*/
- @Override
protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) {
- if (borderItemEditPart instanceof InterfaceFloatingLabelEditPart) {
+ if(borderItemEditPart instanceof InterfaceFloatingLabelEditPart) {
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;
@@ -260,29 +243,24 @@ public class InterfaceEditPart 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);
@@ -293,9 +271,8 @@ public class InterfaceEditPart extends RoundedCompartmentEditPart {
/**
* @generated
*/
- @Override
public IFigure getContentPane() {
- if (contentPane != null) {
+ if(contentPane != null) {
return contentPane;
}
return super.getContentPane();
@@ -304,9 +281,8 @@ public class InterfaceEditPart extends RoundedCompartmentEditPart {
/**
* @generated
*/
- @Override
protected void setForegroundColor(Color color) {
- if (primaryShape != null) {
+ if(primaryShape != null) {
primaryShape.setForegroundColor(color);
}
}
@@ -314,7 +290,6 @@ public class InterfaceEditPart extends RoundedCompartmentEditPart {
/**
* @generated
*/
- @Override
protected void setLineWidth(int width) {
super.setLineWidth(width);
}
@@ -322,17 +297,15 @@ public class InterfaceEditPart 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(InterfaceNameEditPart.VISUAL_ID));
}

Back to the top