/* * (c) 2011 - 2013 University of Mannheim: Software Engineering Group */ package de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import org.eclipse.core.runtime.CoreException; import org.eclipse.draw2d.ColorConstants; import org.eclipse.draw2d.GridData; import org.eclipse.draw2d.GridLayout; import org.eclipse.draw2d.IFigure; import org.eclipse.draw2d.LineBorder; import org.eclipse.draw2d.MarginBorder; import org.eclipse.draw2d.PositionConstants; import org.eclipse.draw2d.RectangleFigure; import org.eclipse.draw2d.ScalablePolygonShape; import org.eclipse.draw2d.Shape; import org.eclipse.draw2d.StackLayout; import org.eclipse.draw2d.ToolbarLayout; import org.eclipse.draw2d.geometry.Dimension; import org.eclipse.draw2d.geometry.Point; import org.eclipse.draw2d.geometry.PrecisionPoint; import org.eclipse.draw2d.geometry.Rectangle; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.util.TreeIterator; import org.eclipse.emf.ecore.EClassifier; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.emf.transaction.impl.InternalTransactionalEditingDomain; import org.eclipse.gef.EditPart; import org.eclipse.gef.EditPolicy; import org.eclipse.gef.GraphicalEditPart; import org.eclipse.gef.Request; import org.eclipse.gef.editpolicies.LayoutEditPolicy; import org.eclipse.gef.editpolicies.SelectionEditPolicy; import org.eclipse.gef.handles.MoveHandle; import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter; import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand; import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart; import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; import org.eclipse.gmf.runtime.diagram.ui.editparts.IResizableCompartmentEditPart; import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; import org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy; import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ConstrainedToolbarLayoutEditPolicy; import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy; import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; import org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableEditPolicyEx; import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableShapeEditPolicy; import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator; import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest; import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; import org.eclipse.gmf.runtime.diagram.ui.util.EditPartUtil; import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout; import org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx; import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure; import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure; import org.eclipse.gmf.runtime.notation.Edge; import org.eclipse.gmf.runtime.notation.Node; import org.eclipse.gmf.runtime.notation.NotationPackage; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.ocl.ParserException; import org.eclipse.ocl.ecore.Constraint; import org.eclipse.ocl.expressions.OCLExpression; import org.eclipse.ocl.helper.OCLHelper; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Font; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.PlatformUI; /** * @generated */ public class Connection2EditPart extends AbstractBorderedShapeEditPart { /** * @generated */ public static final int VISUAL_ID = 3086; /** * @generated */ protected IFigure contentPane; /** * @generated */ protected IFigure primaryShape; /** * @generated */ public Connection2EditPart(View view) { super(view); } /** * @generated */ protected void createDefaultEditPolicies() { installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy()); super.createDefaultEditPolicies(); installEditPolicy( EditPolicyRoles.SEMANTIC_ROLE, new de.uni_mannheim.informatik.swt.models.plm.diagram.edit.policies.Connection2ItemSemanticEditPolicy()); installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE); removeEditPolicy(EditPolicyRoles.POPUPBAR_ROLE); installEditPolicy( EditPolicyRoles.POPUPBAR_ROLE, new de.uni_mannheim.informatik.swt.models.plm.diagram.custom.popupbartools.editpolicy.PLMModelElementPopupBarEditPolicy()); installEditPolicy( SelectionEditPolicy.SELECTION_FEEDBACK_ROLE, new de.uni_mannheim.informatik.swt.models.plm.diagram.custom.editpolicies.EntityConnectionSelectionEditPolicy()); } /** * @generated */ protected LayoutEditPolicy createLayoutEditPolicy() { ConstrainedToolbarLayoutEditPolicy lep = new ConstrainedToolbarLayoutEditPolicy() { protected EditPolicy createChildEditPolicy(EditPart child) { View childView = (View) child.getModel(); switch (de.uni_mannheim.informatik.swt.models.plm.diagram.part.PLMVisualIDRegistry .getVisualID(childView)) { case de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ConnectionName2EditPart.VISUAL_ID: return new BorderItemSelectionEditPolicy() { protected List createSelectionHandles() { MoveHandle mh = new MoveHandle( (GraphicalEditPart) getHost()); mh.setBorder(null); return Collections.singletonList(mh); } }; } if (child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE) == null) { if (child instanceof ITextAwareEditPart) { return new de.uni_mannheim.informatik.swt.models.plm.diagram.edit.policies.PLMTextSelectionEditPolicy(); } } return super.createChildEditPolicy(child); } }; return lep; } /** * @generated */ protected IFigure createNodeShape() { return primaryShape = new ConnectionFigure(); } /** * @generated */ public ConnectionFigure getPrimaryShape() { return (ConnectionFigure) primaryShape; } /** * @generated */ protected boolean addFixedChild(EditPart childEditPart) { if (childEditPart instanceof de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.WrappingLabel41EditPart) { ((de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.WrappingLabel41EditPart) childEditPart) .setLabel(getPrimaryShape().getFigureConnectionNameFigure()); return true; } if (childEditPart instanceof de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.WrappingLabel42EditPart) { ((de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.WrappingLabel42EditPart) childEditPart) .setLabel(getPrimaryShape() .getFigureConnectionLevelFigure()); return true; } if (childEditPart instanceof de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.WrappingLabel43EditPart) { ((de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.WrappingLabel43EditPart) childEditPart) .setLabel(getPrimaryShape() .getFigureConnectionPotencyFigure()); return true; } if (childEditPart instanceof de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.WrappingLabel44EditPart) { ((de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.WrappingLabel44EditPart) childEditPart) .setLabel(getPrimaryShape().getFigureConnectionAVSFigure()); return true; } if (childEditPart instanceof de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.WrappingLabel45EditPart) { ((de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.WrappingLabel45EditPart) childEditPart) .setLabel(getPrimaryShape() .getFigureConnectionProximityClassificationFigure()); return true; } if (childEditPart instanceof de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ConnectionConnectionAttributesCompartment2EditPart) { IFigure pane = getPrimaryShape() .getFigureAttributesCompartmentRectangle(); setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way pane.add(((de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ConnectionConnectionAttributesCompartment2EditPart) childEditPart) .getFigure()); return true; } if (childEditPart instanceof de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ConnectionConnectionMethodsCompartment2EditPart) { IFigure pane = getPrimaryShape() .getFigureMethodsCompartmentRectangle(); setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way pane.add(((de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ConnectionConnectionMethodsCompartment2EditPart) childEditPart) .getFigure()); return true; } if (childEditPart instanceof de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ConnectionConnectionVisualizersCompartment2EditPart) { IFigure pane = getPrimaryShape() .getFigureVisualizerCompartmentRectangle(); setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way pane.add(((de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ConnectionConnectionVisualizersCompartment2EditPart) childEditPart) .getFigure()); return true; } if (childEditPart instanceof de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ConnectionConnectionContentsCompartment2EditPart) { IFigure pane = getPrimaryShape() .getFigureContentCompartmentRectangle(); setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way pane.add(((de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ConnectionConnectionContentsCompartment2EditPart) childEditPart) .getFigure()); return true; } return false; } /** * @generated */ protected boolean removeFixedChild(EditPart childEditPart) { if (childEditPart instanceof de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.WrappingLabel41EditPart) { return true; } if (childEditPart instanceof de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.WrappingLabel42EditPart) { return true; } if (childEditPart instanceof de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.WrappingLabel43EditPart) { return true; } if (childEditPart instanceof de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.WrappingLabel44EditPart) { return true; } if (childEditPart instanceof de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.WrappingLabel45EditPart) { return true; } if (childEditPart instanceof de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ConnectionConnectionAttributesCompartment2EditPart) { IFigure pane = getPrimaryShape() .getFigureAttributesCompartmentRectangle(); pane.remove(((de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ConnectionConnectionAttributesCompartment2EditPart) childEditPart) .getFigure()); return true; } if (childEditPart instanceof de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ConnectionConnectionMethodsCompartment2EditPart) { IFigure pane = getPrimaryShape() .getFigureMethodsCompartmentRectangle(); pane.remove(((de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ConnectionConnectionMethodsCompartment2EditPart) childEditPart) .getFigure()); return true; } if (childEditPart instanceof de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ConnectionConnectionVisualizersCompartment2EditPart) { IFigure pane = getPrimaryShape() .getFigureVisualizerCompartmentRectangle(); pane.remove(((de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ConnectionConnectionVisualizersCompartment2EditPart) childEditPart) .getFigure()); return true; } if (childEditPart instanceof de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ConnectionConnectionContentsCompartment2EditPart) { IFigure pane = getPrimaryShape() .getFigureContentCompartmentRectangle(); pane.remove(((de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ConnectionConnectionContentsCompartment2EditPart) childEditPart) .getFigure()); return true; } return false; } /** * @generated */ protected void addChildVisual(EditPart childEditPart, int index) { if (addFixedChild(childEditPart)) { return; } super.addChildVisual(childEditPart, -1); } /** * @generated */ protected void removeChildVisual(EditPart childEditPart) { if (removeFixedChild(childEditPart)) { return; } super.removeChildVisual(childEditPart); } /** * @generated */ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { if (editPart instanceof de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ConnectionConnectionAttributesCompartment2EditPart) { return getPrimaryShape().getFigureAttributesCompartmentRectangle(); } if (editPart instanceof de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ConnectionConnectionMethodsCompartment2EditPart) { return getPrimaryShape().getFigureMethodsCompartmentRectangle(); } if (editPart instanceof de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ConnectionConnectionVisualizersCompartment2EditPart) { return getPrimaryShape().getFigureVisualizerCompartmentRectangle(); } if (editPart instanceof de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ConnectionConnectionContentsCompartment2EditPart) { return getPrimaryShape().getFigureContentCompartmentRectangle(); } if (editPart instanceof IBorderItemEditPart) { return getBorderedFigure().getBorderItemContainer(); } return getContentPane(); } /** * @generated */ protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) { if (borderItemEditPart instanceof de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ConnectionName2EditPart) { BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.SOUTH); locator.setBorderItemOffset(new Dimension(-20, -20)); borderItemContainer.add(borderItemEditPart.getFigure(), locator); } else { super.addBorderItem(borderItemContainer, borderItemEditPart); } } /** * @generated */ protected NodeFigure createNodePlate() { DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(40, 40); if (true) { HashMap<String, PrecisionPoint> anchorLocations = new HashMap<String, PrecisionPoint>(); anchorLocations.put("NORTH", new PrecisionPoint(0.5d, 0)); anchorLocations.put("EAST", new PrecisionPoint(1d, 0.5d)); anchorLocations.put("SOUTH", new PrecisionPoint(0.5d, 1d)); anchorLocations.put("WEST", new PrecisionPoint(0, 0.5d)); result = new de.uni_mannheim.informatik.swt.models.plm.diagram.custom.figures.DefaultSizeNodeFixedAnchors( 8, 8, anchorLocations); return result; } return result; } /** * 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 */ protected NodeFigure createMainFigure() { NodeFigure figure = createNodePlate(); figure.setLayoutManager(new StackLayout()); IFigure shape = createNodeShape(); figure.add(shape); contentPane = setupContentPane(shape); return figure; } /** * Default implementation treats passed figure as content pane. * Respects layout one may have set for generated figure. * @param nodeShape instance of generated figure class * @generated */ protected IFigure setupContentPane(IFigure nodeShape) { if (nodeShape.getLayoutManager() == null) { ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); layout.setSpacing(5); nodeShape.setLayoutManager(layout); } return nodeShape; // use nodeShape itself as contentPane } /** * @generated */ public IFigure getContentPane() { if (contentPane != null) { return contentPane; } return super.getContentPane(); } /** * @generated */ protected void setForegroundColor(Color color) { if (primaryShape != null) { primaryShape.setForegroundColor(color); } } /** * @generated */ protected void setBackgroundColor(Color color) { if (primaryShape != null) { primaryShape.setBackgroundColor(color); } } /** * @generated */ protected void setLineWidth(int width) { if (primaryShape instanceof Shape) { ((Shape) primaryShape).setLineWidth(width); } } /** * @generated */ protected void setLineType(int style) { if (primaryShape instanceof Shape) { ((Shape) primaryShape).setLineStyle(style); } } /** * @generated */ public EditPart getPrimaryChildEditPart() { return getChildBySemanticHint(de.uni_mannheim.informatik.swt.models.plm.diagram.part.PLMVisualIDRegistry .getType(de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.WrappingLabel41EditPart.VISUAL_ID)); } /** * @generated */ public List<IElementType> getMARelTypesOnSource() { ArrayList<IElementType> types = new ArrayList<IElementType>(2); types.add(de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Classification_4002); types.add(de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Participation_4025); return types; } /** * @generated */ public List<IElementType> getMARelTypesOnSourceAndTarget( IGraphicalEditPart targetEditPart) { LinkedList<IElementType> types = new LinkedList<IElementType>(); if (targetEditPart instanceof de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ConnectionEditPart) { types.add(de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Classification_4002); } if (targetEditPart instanceof de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.EntityEditPart) { types.add(de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Classification_4002); } if (targetEditPart instanceof de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.Connection2EditPart) { types.add(de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Classification_4002); } if (targetEditPart instanceof de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.Entity2EditPart) { types.add(de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Classification_4002); } if (targetEditPart instanceof de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ConnectionEditPart) { types.add(de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Participation_4025); } if (targetEditPart instanceof de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.EntityEditPart) { types.add(de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Participation_4025); } if (targetEditPart instanceof de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.Connection2EditPart) { types.add(de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Participation_4025); } if (targetEditPart instanceof de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.Entity2EditPart) { types.add(de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Participation_4025); } return types; } /** * @generated */ public List<IElementType> getMATypesForTarget(IElementType relationshipType) { LinkedList<IElementType> types = new LinkedList<IElementType>(); if (relationshipType == de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Classification_4002) { types.add(de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Connection_3060); types.add(de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Entity_3085); types.add(de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Connection_3086); types.add(de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Entity_3069); } else if (relationshipType == de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Participation_4025) { types.add(de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Connection_3060); types.add(de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Entity_3085); types.add(de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Connection_3086); types.add(de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Entity_3069); } return types; } /** * @generated */ public List<IElementType> getMARelTypesOnTarget() { ArrayList<IElementType> types = new ArrayList<IElementType>(8); types.add(de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Classification_4002); types.add(de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.SetRelationshipBase_4013); types.add(de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.EqualityEqual_4018); types.add(de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.InversionInverse_4015); types.add(de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.ComplementComplement_4016); types.add(de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.GeneralizationSupertype_4022); types.add(de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.GeneralizationSubtype_4023); types.add(de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Participation_4025); return types; } /** * @generated */ public List<IElementType> getMATypesForSource(IElementType relationshipType) { LinkedList<IElementType> types = new LinkedList<IElementType>(); if (relationshipType == de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Classification_4002) { types.add(de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Connection_3060); types.add(de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Entity_3085); types.add(de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Connection_3086); types.add(de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Entity_3069); } else if (relationshipType == de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.SetRelationshipBase_4013) { types.add(de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Complement_3063); types.add(de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Equality_3064); types.add(de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Inversion_3065); } else if (relationshipType == de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.EqualityEqual_4018) { types.add(de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Equality_3064); } else if (relationshipType == de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.InversionInverse_4015) { types.add(de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Inversion_3065); } else if (relationshipType == de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.ComplementComplement_4016) { types.add(de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Complement_3063); } else if (relationshipType == de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.GeneralizationSupertype_4022) { types.add(de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Generalization_3072); } else if (relationshipType == de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.GeneralizationSubtype_4023) { types.add(de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Generalization_3072); } else if (relationshipType == de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Participation_4025) { types.add(de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Connection_3060); types.add(de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Connection_3086); } return types; } /** * @generated */ public EditPart getTargetEditPart(Request request) { if (request instanceof CreateViewAndElementRequest) { CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest) request) .getViewAndElementDescriptor() .getCreateElementRequestAdapter(); IElementType type = (IElementType) adapter .getAdapter(IElementType.class); if (type == de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Attribute_3061) { return getChildBySemanticHint(de.uni_mannheim.informatik.swt.models.plm.diagram.part.PLMVisualIDRegistry .getType(de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ConnectionConnectionAttributesCompartment2EditPart.VISUAL_ID)); } if (type == de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Method_3062) { return getChildBySemanticHint(de.uni_mannheim.informatik.swt.models.plm.diagram.part.PLMVisualIDRegistry .getType(de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ConnectionConnectionMethodsCompartment2EditPart.VISUAL_ID)); } if (type == de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.LMLVisualizer_3076) { return getChildBySemanticHint(de.uni_mannheim.informatik.swt.models.plm.diagram.part.PLMVisualIDRegistry .getType(de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ConnectionConnectionVisualizersCompartment2EditPart.VISUAL_ID)); } if (type == de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Entity_3085) { return getChildBySemanticHint(de.uni_mannheim.informatik.swt.models.plm.diagram.part.PLMVisualIDRegistry .getType(de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ConnectionConnectionContentsCompartment2EditPart.VISUAL_ID)); } if (type == de.uni_mannheim.informatik.swt.models.plm.diagram.providers.PLMElementTypes.Connection_3086) { return getChildBySemanticHint(de.uni_mannheim.informatik.swt.models.plm.diagram.part.PLMVisualIDRegistry .getType(de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ConnectionConnectionContentsCompartment2EditPart.VISUAL_ID)); } } return super.getTargetEditPart(request); } /** * Updates the connections after a value was set and does elision * * @generated */ @Override protected void handleNotificationEvent(Notification notification) { super.handleNotificationEvent(notification); //************************************************************************* //We want to update the DSL notation for Entities //************************************************************************* if (notification.getNotifier() instanceof de.uni_mannheim.informatik.swt.models.plm.PLM.Attribute && ((EStructuralFeature) notification.getFeature()).getName() .equals("value")) updateView(); if (notification.getNotifier() instanceof de.uni_mannheim.informatik.swt.models.plm.PLM.LMLVisualizer) { updateView(); //************************************************************************* //Manage the classifications view state according to proximity indication //************************************************************************* View v = this.getNotationView(); de.uni_mannheim.informatik.swt.models.plm.PLM.LMLVisualizer LMLVisualizer = (de.uni_mannheim.informatik.swt.models.plm.PLM.LMLVisualizer) notification .getNotifier(); HashSet<View> outgoingEdges = new HashSet<View>(); org.eclipse.ocl.ecore.OCL ocl = org.eclipse.ocl.ecore.OCL .newInstance(); OCLHelper<EClassifier, ?, ?, Constraint> helper = ocl .createOCLHelper(); helper.setContext(NotationPackage.Literals.VIEW); try { //Need to take care to only select classification - plm::Classification is not known here.. OCLExpression<EClassifier> q = helper .createQuery("Edge.allInstances()->select(e | e.source = self)->select(e | e.element.oclIsUndefined() <> true)"); outgoingEdges = ((HashSet<View>) ocl.evaluate(v, q)); } catch (ParserException e) { e.printStackTrace(); } LinkedList<View> outgoingClassificationEdges = new LinkedList<View>(); //Only take views of Classifications for (View c : outgoingEdges) if (c.getElement() instanceof de.uni_mannheim.informatik.swt.models.plm.PLM.Classification) outgoingClassificationEdges.add(c); //This has currently no support for multiple classifications if (outgoingClassificationEdges.size() > 0) { if ("1".equals(LMLVisualizer .getValueForKey("ProximityClassification"))) outgoingClassificationEdges.get(0).setVisible(false); else outgoingClassificationEdges.get(0).setVisible(true); IGraphicalEditPart edgeEP = (IGraphicalEditPart) getViewer() .getEditPartRegistry().get( outgoingClassificationEdges.get(0)); if (edgeEP != null) edgeEP.performRequest(new Request( RequestConstants.REQ_REFRESH)); //In cases where there is no editpart, refresh both ends to get it created else { Edge classView = (Edge) outgoingClassificationEdges.get(0); ((EditPart) getViewer().getEditPartRegistry().get( classView.getTarget())).refresh(); ((EditPart) getViewer().getEditPartRegistry().get( classView.getSource())).refresh(); } } } EStructuralFeature changedFeature = (EStructuralFeature) notification .getFeature(); if (notification.getNotifier() instanceof de.uni_mannheim.informatik.swt.models.plm.PLM.Element) { if (changedFeature.getName().equalsIgnoreCase("elided") || changedFeature.getName().equalsIgnoreCase("expressed")) { updateView(); } else if (changedFeature.getName().equals("potency")) { for (EObject eObj : ((de.uni_mannheim.informatik.swt.models.plm.PLM.Clabject) resolveSemanticElement()) .getFeature()) { findEditPart(this, eObj).performRequest( new Request(RequestConstants.REQ_REFRESH)); } } if (notification.getNotifier() instanceof de.uni_mannheim.informatik.swt.models.plm.PLM.Context && ((EStructuralFeature) notification.getFeature()) .getName().equals("LMLVisualizersShown")) { de.uni_mannheim.informatik.swt.models.plm.PLM.Context container = (de.uni_mannheim.informatik.swt.models.plm.PLM.Context) notification .getNotifier(); de.uni_mannheim.informatik.swt.models.plm.PLM.LMLVisualizer[] LMLVisualizers = new de.uni_mannheim.informatik.swt.models.plm.PLM.LMLVisualizer[] {}; //find all LMLVisualizers in the model org.eclipse.ocl.ecore.OCL ocl = org.eclipse.ocl.ecore.OCL .newInstance(); OCLHelper<EClassifier, ?, ?, Constraint> helper = ocl .createOCLHelper(); helper.setContext(de.uni_mannheim.informatik.swt.models.plm.PLM.PLMPackage.Literals.CONNECTION); try { OCLExpression<EClassifier> q = helper .createQuery("self.feature->collect(f | f.LMLVisualizer)"); LMLVisualizers = ((ArrayList<de.uni_mannheim.informatik.swt.models.plm.PLM.LMLVisualizer>) ocl .evaluate(resolveSemanticElement(), q)) .toArray(new de.uni_mannheim.informatik.swt.models.plm.PLM.LMLVisualizer[] {}); } catch (ParserException e) { e.printStackTrace(); } //find the notational elements for the LMLVisualizers for (de.uni_mannheim.informatik.swt.models.plm.PLM.LMLVisualizer r : LMLVisualizers) { TreeIterator<EObject> iter = (getNotationView() .eAllContents()); while (iter.hasNext()) { EObject obj = iter.next(); if (obj instanceof Node) { Node n = (Node) obj; if (n.getElement() == r) { if (container.getVisualizersShown() .equalsIgnoreCase("none")) n.setVisible(false); else n.setVisible(true); break; } } } } performRequest(new Request(RequestConstants.REQ_REFRESH)); } else if (notification.getNotifier() instanceof de.uni_mannheim.informatik.swt.models.plm.PLM.Context && ((EStructuralFeature) notification.getFeature()) .getName().equals("origin")) { de.uni_mannheim.informatik.swt.models.plm.PLM.Element[] elements = new de.uni_mannheim.informatik.swt.models.plm.PLM.Element[] {}; de.uni_mannheim.informatik.swt.models.plm.PLM.Context container = (de.uni_mannheim.informatik.swt.models.plm.PLM.Context) resolveSemanticElement(); //find all LMLVisualizers in the model org.eclipse.ocl.ecore.OCL ocl = org.eclipse.ocl.ecore.OCL .newInstance(); OCLHelper<EClassifier, ?, ?, Constraint> helper = ocl .createOCLHelper(); helper.setContext(de.uni_mannheim.informatik.swt.models.plm.PLM.PLMPackage.Literals.CONNECTION); try { OCLExpression<EClassifier> q = helper .createQuery("self.feature"); elements = ((HashSet<de.uni_mannheim.informatik.swt.models.plm.PLM.Element>) ocl .evaluate(resolveSemanticElement(), q)) .toArray(new de.uni_mannheim.informatik.swt.models.plm.PLM.Element[] {}); } catch (ParserException e) { e.printStackTrace(); } //find the notational elements for the LMLVisualizers for (de.uni_mannheim.informatik.swt.models.plm.PLM.Element e : elements) { TreeIterator<EObject> iter = (getNotationView() .eAllContents()); while (iter.hasNext()) { EObject obj = iter.next(); if (obj instanceof Node) { Node s = (Node) obj; if (s.getElement() == e) { if (container.getOrigin().equalsIgnoreCase( "expressed") && e.isExpressed() || container.getOrigin() .equalsIgnoreCase("computed") && !e.isExpressed() || container.getOrigin() .equalsIgnoreCase("all")) s.setVisible(true); else s.setVisible(false); break; } } } } performRequest(new Request(RequestConstants.REQ_REFRESH)); } if (((EStructuralFeature) notification.getFeature()).getName() .equals("content") || ((EStructuralFeature) notification.getFeature()) .getName().equals("feature")) updateView(); } } /** * * @return null if no DSLRendering infotmation is available, else true or false * * @generated */ private Boolean getDSLRenderingValue() { //boolean collapse = false; //******************************************************** //Find the LMLVisualizer attached to this element //******************************************************** de.uni_mannheim.informatik.swt.models.plm.PLM.Element self = (de.uni_mannheim.informatik.swt.models.plm.PLM.Element) this .resolveSemanticElement(); //No rendering information found => all Connection remains expanded if (self.getVisualizer().size() == 0) { //Hide external name label IFigure boderItemContainer = (IFigure) figure.getChildren().get(1); ((IFigure) boderItemContainer.getChildren().get(0)) .setVisible(false); return null; } de.uni_mannheim.informatik.swt.models.plm.PLM.LMLVisualizer r = self .getVisualizer().get(0); String dslRenderingString = r.getValueForKey("DSLRendering"); if ("".equals(dslRenderingString)) return null; return java.lang.Boolean.parseBoolean(dslRenderingString); } /** * @generated */ public void updateView() { java.lang.Boolean dslRendering = getDSLRenderingValue(); de.uni_mannheim.informatik.swt.models.plm.PLM.Element self = (de.uni_mannheim.informatik.swt.models.plm.PLM.Element) resolveSemanticElement(); if (sourceConnections != null) { //Participations need to be updated for (java.lang.Object ep : sourceConnections) if (ep instanceof de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ParticipationEditPart) ((de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ParticipationEditPart) ep) .updateView(); } if (dslRendering != null && dslRendering == true) { toggle(); return; } de.uni_mannheim.informatik.swt.models.plm.PLM.Clabject c = (de.uni_mannheim.informatik.swt.models.plm.PLM.Clabject) resolveSemanticElement(); java.lang.Boolean toggleValue = getToggleValue(); //We do toggle the connection if (toggleValue != null) toggle(); //We can do elide as long as a connection is not toggled if (toggleValue == null || toggleValue == false) doElide(); //We can change expressed as long as connection is not elided and not toggled if (!c.isElided() && (toggleValue == null || toggleValue == false)) { setExpressedVisualState(); manageCompartmentVisibility(); } } /** * @generated */ private void updateNameCompartment() { try { de.uni_mannheim.informatik.swt.models.plm.PLM.Clabject self = (de.uni_mannheim.informatik.swt.models.plm.PLM.Clabject) resolveSemanticElement(); //No visualization information available if (self.getVisualizer().size() == 0) return; de.uni_mannheim.informatik.swt.mlm.workbench.interfaces.IProximityIndicationService proximityService = de.uni_mannheim.informatik.swt.mlm.workbench.ExtensionPointService .Instance().getActiveProximityIndicationService(); WrappingLabel classificationProximityWrappingLabel = ((de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.Connection2EditPart.ConnectionFigure) getPrimaryShape()) .getFigureConnectionProximityClassificationFigure(); WrappingLabel inheritanceProximityWrappingLabel = ((de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.Connection2EditPart.ConnectionFigure) getPrimaryShape()) .getFigureConnectionProximityInheritanceFigure(); WrappingLabel containmentProximityWrappingLabel = ((de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.Connection2EditPart.ConnectionFigure) getPrimaryShape()) .getFigureConnectionProximityContainmentFigure(); String proximityIndicationRequest = self.getVisualizer().get(0) .getValueForKey("ProximityIndication"); classificationProximityWrappingLabel.setText(proximityService .createClassificationProximityString(self, proximityIndicationRequest)); inheritanceProximityWrappingLabel.setText(proximityService .createGeneralizationProximityString(self, proximityIndicationRequest)); containmentProximityWrappingLabel.setText(proximityService .createContainmentProximityString(self, proximityIndicationRequest)); } catch (CoreException e) { e.printStackTrace(); } } public IResizableCompartmentEditPart getAttributesCompartment() { for (Object ep : getChildren()) if (ep instanceof de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ConnectionConnectionAttributesCompartmentEditPart || ep instanceof de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ConnectionConnectionAttributesCompartment2EditPart) return (IResizableCompartmentEditPart) ep; return null; } public IResizableCompartmentEditPart getMethodsCompartment() { for (Object ep : getChildren()) if (ep instanceof de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ConnectionConnectionMethodsCompartmentEditPart || ep instanceof de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ConnectionConnectionMethodsCompartment2EditPart) return (IResizableCompartmentEditPart) ep; return null; } public IResizableCompartmentEditPart getContentsCompartment() { for (Object ep : getChildren()) if (ep instanceof de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ConnectionConnectionContentsCompartmentEditPart || ep instanceof de.uni_mannheim.informatik.swt.models.plm.diagram.edit.parts.ConnectionConnectionContentsCompartment2EditPart) return (IResizableCompartmentEditPart) ep; return null; } public void manageCompartmentVisibility() { de.uni_mannheim.informatik.swt.models.plm.PLM.Clabject self = (de.uni_mannheim.informatik.swt.models.plm.PLM.Clabject) resolveSemanticElement(); IResizableCompartmentEditPart methodCompartment = getMethodsCompartment(); IResizableCompartmentEditPart attributeCompartement = getAttributesCompartment(); IResizableCompartmentEditPart contentsCompartement = getContentsCompartment(); InternalTransactionalEditingDomain domain = (InternalTransactionalEditingDomain) getEditingDomain(); if (domain.getActiveTransaction() != null && domain.getActiveTransaction().isReadOnly()) return; //Methods if (self.getEigenMethods().size() == 0 && methodCompartment != null) domain.getCommandStack() .execute( SetCommand.create( domain, methodCompartment.getNotationView(), NotationPackage.eINSTANCE.getView_Visible(), false)); else if (methodCompartment != null) domain.getCommandStack().execute( SetCommand.create(domain, methodCompartment.getNotationView(), NotationPackage.eINSTANCE.getView_Visible(), true)); //Attributes if (self.getEigenAttributes().size() == 0 && attributeCompartement != null) domain.getCommandStack() .execute( SetCommand.create( domain, attributeCompartement.getNotationView(), NotationPackage.eINSTANCE.getView_Visible(), false)); else if (attributeCompartement != null) domain.getCommandStack().execute( SetCommand.create(domain, attributeCompartement.getNotationView(), NotationPackage.eINSTANCE.getView_Visible(), true)); //Contents if (self.getContent().size() == 0 && contentsCompartement != null) domain.getCommandStack() .execute( SetCommand.create( domain, contentsCompartement.getNotationView(), NotationPackage.eINSTANCE.getView_Visible(), false)); else if (contentsCompartement != null) domain.getCommandStack().execute( SetCommand.create(domain, contentsCompartement.getNotationView(), NotationPackage.eINSTANCE.getView_Visible(), true)); } /** * @generated */ public class ConnectionFigure extends ScalablePolygonShape { /** * @generated */ private WrappingLabel fFigureConnectionProximityInheritanceFigure; /** * @generated */ private WrappingLabel fFigureConnectionProximityContainmentFigure; /** * @generated */ private WrappingLabel fFigureConnectionNameFigure; /** * @generated */ private WrappingLabel fFigureConnectionProximityClassificationFigure; /** * @generated */ private WrappingLabel fFigureConnectionPotencyFigure; /** * @generated */ private WrappingLabel fFigureConnectionLevelFigure; /** * @generated */ private WrappingLabel fFigureConnectionAVSFigure; /** * @generated */ private RectangleFigure fFigureAttributesCompartmentRectangle; /** * @generated */ private RectangleFigure fFigureMethodsCompartmentRectangle; /** * @generated */ private RectangleFigure fFigureContentCompartmentRectangle; /** * @generated */ private RectangleFigure fFigureVisualizerCompartmentRectangle; /** * @generated */ public ConnectionFigure() { ToolbarLayout layoutThis = new ToolbarLayout(); layoutThis.setStretchMinorAxis(true); layoutThis.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT); layoutThis.setSpacing(0); layoutThis.setVertical(true); this.setLayoutManager(layoutThis); this.addPoint(new Point(getMapMode().DPtoLP(0), getMapMode() .DPtoLP(3))); this.addPoint(new Point(getMapMode().DPtoLP(0), getMapMode() .DPtoLP(40))); this.addPoint(new Point(getMapMode().DPtoLP(20), getMapMode() .DPtoLP(42))); this.addPoint(new Point(getMapMode().DPtoLP(40), getMapMode() .DPtoLP(40))); this.addPoint(new Point(getMapMode().DPtoLP(40), getMapMode() .DPtoLP(3))); this.addPoint(new Point(getMapMode().DPtoLP(20), getMapMode() .DPtoLP(0))); this.setFill(true); this.setForegroundColor(ColorConstants.black); this.setBorder(new MarginBorder(getMapMode().DPtoLP(3), getMapMode().DPtoLP(0), getMapMode().DPtoLP(15), getMapMode().DPtoLP(0))); createContents(); } /** * @generated */ private void createContents() { RectangleFigure innerRectangle0 = new RectangleFigure(); innerRectangle0.setFill(false); innerRectangle0.setOutline(false); this.add(innerRectangle0); GridLayout layoutInnerRectangle0 = new GridLayout(); layoutInnerRectangle0.numColumns = 1; layoutInnerRectangle0.makeColumnsEqualWidth = false; layoutInnerRectangle0.horizontalSpacing = 0; layoutInnerRectangle0.verticalSpacing = 0; layoutInnerRectangle0.marginWidth = 0; layoutInnerRectangle0.marginHeight = 0; innerRectangle0.setLayoutManager(layoutInnerRectangle0); RectangleFigure nameRectangle1 = new RectangleFigure(); nameRectangle1.setFill(false); nameRectangle1.setOutline(false); GridData constraintNameRectangle1 = new GridData(); constraintNameRectangle1.verticalAlignment = GridData.BEGINNING; constraintNameRectangle1.horizontalAlignment = GridData.CENTER; constraintNameRectangle1.horizontalIndent = 0; constraintNameRectangle1.horizontalSpan = 1; constraintNameRectangle1.verticalSpan = 1; constraintNameRectangle1.grabExcessHorizontalSpace = true; constraintNameRectangle1.grabExcessVerticalSpace = false; innerRectangle0.add(nameRectangle1, constraintNameRectangle1); GridLayout layoutNameRectangle1 = new GridLayout(); layoutNameRectangle1.numColumns = 5; layoutNameRectangle1.makeColumnsEqualWidth = false; layoutNameRectangle1.horizontalSpacing = 0; layoutNameRectangle1.verticalSpacing = 0; layoutNameRectangle1.marginWidth = 3; layoutNameRectangle1.marginHeight = 3; nameRectangle1.setLayoutManager(layoutNameRectangle1); fFigureConnectionProximityInheritanceFigure = new WrappingLabel(); fFigureConnectionProximityInheritanceFigure.setText(""); fFigureConnectionProximityInheritanceFigure .setFont(FFIGURECONNECTIONPROXIMITYINHERITANCEFIGURE_FONT); GridData constraintFFigureConnectionProximityInheritanceFigure = new GridData(); constraintFFigureConnectionProximityInheritanceFigure.verticalAlignment = GridData.CENTER; constraintFFigureConnectionProximityInheritanceFigure.horizontalAlignment = GridData.BEGINNING; constraintFFigureConnectionProximityInheritanceFigure.horizontalIndent = 0; constraintFFigureConnectionProximityInheritanceFigure.horizontalSpan = 1; constraintFFigureConnectionProximityInheritanceFigure.verticalSpan = 4; constraintFFigureConnectionProximityInheritanceFigure.grabExcessHorizontalSpace = false; constraintFFigureConnectionProximityInheritanceFigure.grabExcessVerticalSpace = true; nameRectangle1.add(fFigureConnectionProximityInheritanceFigure, constraintFFigureConnectionProximityInheritanceFigure); fFigureConnectionProximityContainmentFigure = new WrappingLabel(); fFigureConnectionProximityContainmentFigure.setText(""); fFigureConnectionProximityContainmentFigure .setFont(FFIGURECONNECTIONPROXIMITYCONTAINMENTFIGURE_FONT); GridData constraintFFigureConnectionProximityContainmentFigure = new GridData(); constraintFFigureConnectionProximityContainmentFigure.verticalAlignment = GridData.CENTER; constraintFFigureConnectionProximityContainmentFigure.horizontalAlignment = GridData.BEGINNING; constraintFFigureConnectionProximityContainmentFigure.horizontalIndent = 0; constraintFFigureConnectionProximityContainmentFigure.horizontalSpan = 1; constraintFFigureConnectionProximityContainmentFigure.verticalSpan = 4; constraintFFigureConnectionProximityContainmentFigure.grabExcessHorizontalSpace = false; constraintFFigureConnectionProximityContainmentFigure.grabExcessVerticalSpace = true; nameRectangle1.add(fFigureConnectionProximityContainmentFigure, constraintFFigureConnectionProximityContainmentFigure); fFigureConnectionNameFigure = new WrappingLabel(); fFigureConnectionNameFigure.setText(""); fFigureConnectionNameFigure .setFont(FFIGURECONNECTIONNAMEFIGURE_FONT); GridData constraintFFigureConnectionNameFigure = new GridData(); constraintFFigureConnectionNameFigure.verticalAlignment = GridData.CENTER; constraintFFigureConnectionNameFigure.horizontalAlignment = GridData.END; constraintFFigureConnectionNameFigure.horizontalIndent = 0; constraintFFigureConnectionNameFigure.horizontalSpan = 1; constraintFFigureConnectionNameFigure.verticalSpan = 4; constraintFFigureConnectionNameFigure.grabExcessHorizontalSpace = true; constraintFFigureConnectionNameFigure.grabExcessVerticalSpace = true; nameRectangle1.add(fFigureConnectionNameFigure, constraintFFigureConnectionNameFigure); fFigureConnectionPotencyFigure = new WrappingLabel(); fFigureConnectionPotencyFigure.setText(""); fFigureConnectionPotencyFigure .setFont(FFIGURECONNECTIONPOTENCYFIGURE_FONT); fFigureConnectionPotencyFigure.setBorder(new MarginBorder( getMapMode().DPtoLP(0), getMapMode().DPtoLP(0), getMapMode().DPtoLP(10), getMapMode().DPtoLP(0))); GridData constraintFFigureConnectionPotencyFigure = new GridData(); constraintFFigureConnectionPotencyFigure.verticalAlignment = GridData.CENTER; constraintFFigureConnectionPotencyFigure.horizontalAlignment = GridData.BEGINNING; constraintFFigureConnectionPotencyFigure.horizontalIndent = 0; constraintFFigureConnectionPotencyFigure.horizontalSpan = 1; constraintFFigureConnectionPotencyFigure.verticalSpan = 2; constraintFFigureConnectionPotencyFigure.grabExcessHorizontalSpace = false; constraintFFigureConnectionPotencyFigure.grabExcessVerticalSpace = true; nameRectangle1.add(fFigureConnectionPotencyFigure, constraintFFigureConnectionPotencyFigure); fFigureConnectionProximityClassificationFigure = new WrappingLabel(); fFigureConnectionProximityClassificationFigure.setText(""); fFigureConnectionProximityClassificationFigure .setFont(FFIGURECONNECTIONPROXIMITYCLASSIFICATIONFIGURE_FONT); GridData constraintFFigureConnectionProximityClassificationFigure = new GridData(); constraintFFigureConnectionProximityClassificationFigure.verticalAlignment = GridData.CENTER; constraintFFigureConnectionProximityClassificationFigure.horizontalAlignment = GridData.BEGINNING; constraintFFigureConnectionProximityClassificationFigure.horizontalIndent = 0; constraintFFigureConnectionProximityClassificationFigure.horizontalSpan = 1; constraintFFigureConnectionProximityClassificationFigure.verticalSpan = 4; constraintFFigureConnectionProximityClassificationFigure.grabExcessHorizontalSpace = true; constraintFFigureConnectionProximityClassificationFigure.grabExcessVerticalSpace = true; nameRectangle1.add(fFigureConnectionProximityClassificationFigure, constraintFFigureConnectionProximityClassificationFigure); fFigureConnectionLevelFigure = new WrappingLabel(); fFigureConnectionLevelFigure.setText(""); fFigureConnectionLevelFigure .setFont(FFIGURECONNECTIONLEVELFIGURE_FONT); GridData constraintFFigureConnectionLevelFigure = new GridData(); constraintFFigureConnectionLevelFigure.verticalAlignment = GridData.BEGINNING; constraintFFigureConnectionLevelFigure.horizontalAlignment = GridData.BEGINNING; constraintFFigureConnectionLevelFigure.horizontalIndent = 0; constraintFFigureConnectionLevelFigure.horizontalSpan = 1; constraintFFigureConnectionLevelFigure.verticalSpan = 2; constraintFFigureConnectionLevelFigure.grabExcessHorizontalSpace = false; constraintFFigureConnectionLevelFigure.grabExcessVerticalSpace = true; nameRectangle1.add(fFigureConnectionLevelFigure, constraintFFigureConnectionLevelFigure); fFigureConnectionAVSFigure = new WrappingLabel(); fFigureConnectionAVSFigure.setText(""); fFigureConnectionAVSFigure.setFont(FFIGURECONNECTIONAVSFIGURE_FONT); GridData constraintFFigureConnectionAVSFigure = new GridData(); constraintFFigureConnectionAVSFigure.verticalAlignment = GridData.BEGINNING; constraintFFigureConnectionAVSFigure.horizontalAlignment = GridData.CENTER; constraintFFigureConnectionAVSFigure.horizontalIndent = 0; constraintFFigureConnectionAVSFigure.horizontalSpan = 5; constraintFFigureConnectionAVSFigure.verticalSpan = 1; constraintFFigureConnectionAVSFigure.grabExcessHorizontalSpace = false; constraintFFigureConnectionAVSFigure.grabExcessVerticalSpace = true; nameRectangle1.add(fFigureConnectionAVSFigure, constraintFFigureConnectionAVSFigure); fFigureAttributesCompartmentRectangle = new RectangleFigure(); fFigureAttributesCompartmentRectangle.setFill(false); fFigureAttributesCompartmentRectangle.setOutline(false); fFigureAttributesCompartmentRectangle.setBorder(new MarginBorder( getMapMode().DPtoLP(0), getMapMode().DPtoLP(0), getMapMode().DPtoLP(0), getMapMode().DPtoLP(0))); GridData constraintFFigureAttributesCompartmentRectangle = new GridData(); constraintFFigureAttributesCompartmentRectangle.verticalAlignment = GridData.BEGINNING; constraintFFigureAttributesCompartmentRectangle.horizontalAlignment = GridData.FILL; constraintFFigureAttributesCompartmentRectangle.horizontalIndent = 0; constraintFFigureAttributesCompartmentRectangle.horizontalSpan = 1; constraintFFigureAttributesCompartmentRectangle.verticalSpan = 1; constraintFFigureAttributesCompartmentRectangle.grabExcessHorizontalSpace = true; constraintFFigureAttributesCompartmentRectangle.grabExcessVerticalSpace = false; innerRectangle0.add(fFigureAttributesCompartmentRectangle, constraintFFigureAttributesCompartmentRectangle); ToolbarLayout layoutFFigureAttributesCompartmentRectangle = new ToolbarLayout(); layoutFFigureAttributesCompartmentRectangle .setStretchMinorAxis(true); layoutFFigureAttributesCompartmentRectangle .setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT); layoutFFigureAttributesCompartmentRectangle.setSpacing(0); layoutFFigureAttributesCompartmentRectangle.setVertical(true); fFigureAttributesCompartmentRectangle .setLayoutManager(layoutFFigureAttributesCompartmentRectangle); fFigureMethodsCompartmentRectangle = new RectangleFigure(); fFigureMethodsCompartmentRectangle.setFill(false); fFigureMethodsCompartmentRectangle.setOutline(false); fFigureMethodsCompartmentRectangle.setBorder(new MarginBorder( getMapMode().DPtoLP(0), getMapMode().DPtoLP(0), getMapMode().DPtoLP(0), getMapMode().DPtoLP(0))); GridData constraintFFigureMethodsCompartmentRectangle = new GridData(); constraintFFigureMethodsCompartmentRectangle.verticalAlignment = GridData.BEGINNING; constraintFFigureMethodsCompartmentRectangle.horizontalAlignment = GridData.FILL; constraintFFigureMethodsCompartmentRectangle.horizontalIndent = 0; constraintFFigureMethodsCompartmentRectangle.horizontalSpan = 1; constraintFFigureMethodsCompartmentRectangle.verticalSpan = 1; constraintFFigureMethodsCompartmentRectangle.grabExcessHorizontalSpace = true; constraintFFigureMethodsCompartmentRectangle.grabExcessVerticalSpace = false; innerRectangle0.add(fFigureMethodsCompartmentRectangle, constraintFFigureMethodsCompartmentRectangle); ToolbarLayout layoutFFigureMethodsCompartmentRectangle = new ToolbarLayout(); layoutFFigureMethodsCompartmentRectangle.setStretchMinorAxis(true); layoutFFigureMethodsCompartmentRectangle .setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT); layoutFFigureMethodsCompartmentRectangle.setSpacing(0); layoutFFigureMethodsCompartmentRectangle.setVertical(true); fFigureMethodsCompartmentRectangle .setLayoutManager(layoutFFigureMethodsCompartmentRectangle); fFigureContentCompartmentRectangle = new RectangleFigure(); fFigureContentCompartmentRectangle.setFill(false); fFigureContentCompartmentRectangle.setOutline(false); fFigureContentCompartmentRectangle.setBorder(new MarginBorder( getMapMode().DPtoLP(0), getMapMode().DPtoLP(0), getMapMode().DPtoLP(0), getMapMode().DPtoLP(0))); GridData constraintFFigureContentCompartmentRectangle = new GridData(); constraintFFigureContentCompartmentRectangle.verticalAlignment = GridData.BEGINNING; constraintFFigureContentCompartmentRectangle.horizontalAlignment = GridData.FILL; constraintFFigureContentCompartmentRectangle.horizontalIndent = 0; constraintFFigureContentCompartmentRectangle.horizontalSpan = 1; constraintFFigureContentCompartmentRectangle.verticalSpan = 1; constraintFFigureContentCompartmentRectangle.grabExcessHorizontalSpace = true; constraintFFigureContentCompartmentRectangle.grabExcessVerticalSpace = false; innerRectangle0.add(fFigureContentCompartmentRectangle, constraintFFigureContentCompartmentRectangle); ToolbarLayout layoutFFigureContentCompartmentRectangle = new ToolbarLayout(); layoutFFigureContentCompartmentRectangle.setStretchMinorAxis(true); layoutFFigureContentCompartmentRectangle .setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT); layoutFFigureContentCompartmentRectangle.setSpacing(0); layoutFFigureContentCompartmentRectangle.setVertical(true); fFigureContentCompartmentRectangle .setLayoutManager(layoutFFigureContentCompartmentRectangle); fFigureVisualizerCompartmentRectangle = new RectangleFigure(); fFigureVisualizerCompartmentRectangle.setFill(false); fFigureVisualizerCompartmentRectangle.setOutline(false); fFigureVisualizerCompartmentRectangle.setBorder(new MarginBorder( getMapMode().DPtoLP(0), getMapMode().DPtoLP(0), getMapMode().DPtoLP(0), getMapMode().DPtoLP(0))); GridData constraintFFigureVisualizerCompartmentRectangle = new GridData(); constraintFFigureVisualizerCompartmentRectangle.verticalAlignment = GridData.BEGINNING; constraintFFigureVisualizerCompartmentRectangle.horizontalAlignment = GridData.FILL; constraintFFigureVisualizerCompartmentRectangle.horizontalIndent = 0; constraintFFigureVisualizerCompartmentRectangle.horizontalSpan = 1; constraintFFigureVisualizerCompartmentRectangle.verticalSpan = 1; constraintFFigureVisualizerCompartmentRectangle.grabExcessHorizontalSpace = true; constraintFFigureVisualizerCompartmentRectangle.grabExcessVerticalSpace = false; innerRectangle0.add(fFigureVisualizerCompartmentRectangle, constraintFFigureVisualizerCompartmentRectangle); ToolbarLayout layoutFFigureVisualizerCompartmentRectangle = new ToolbarLayout(); layoutFFigureVisualizerCompartmentRectangle .setStretchMinorAxis(true); layoutFFigureVisualizerCompartmentRectangle .setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT); layoutFFigureVisualizerCompartmentRectangle.setSpacing(0); layoutFFigureVisualizerCompartmentRectangle.setVertical(true); fFigureVisualizerCompartmentRectangle .setLayoutManager(layoutFFigureVisualizerCompartmentRectangle); } /** * @generated */ public WrappingLabel getFigureConnectionProximityInheritanceFigure() { return fFigureConnectionProximityInheritanceFigure; } /** * @generated */ public WrappingLabel getFigureConnectionProximityContainmentFigure() { return fFigureConnectionProximityContainmentFigure; } /** * @generated */ public WrappingLabel getFigureConnectionNameFigure() { return fFigureConnectionNameFigure; } /** * @generated */ public WrappingLabel getFigureConnectionProximityClassificationFigure() { return fFigureConnectionProximityClassificationFigure; } /** * @generated */ public WrappingLabel getFigureConnectionPotencyFigure() { return fFigureConnectionPotencyFigure; } /** * @generated */ public WrappingLabel getFigureConnectionLevelFigure() { return fFigureConnectionLevelFigure; } /** * @generated */ public WrappingLabel getFigureConnectionAVSFigure() { return fFigureConnectionAVSFigure; } /** * @generated */ public RectangleFigure getFigureAttributesCompartmentRectangle() { return fFigureAttributesCompartmentRectangle; } /** * @generated */ public RectangleFigure getFigureMethodsCompartmentRectangle() { return fFigureMethodsCompartmentRectangle; } /** * @generated */ public RectangleFigure getFigureContentCompartmentRectangle() { return fFigureContentCompartmentRectangle; } /** * @generated */ public RectangleFigure getFigureVisualizerCompartmentRectangle() { return fFigureVisualizerCompartmentRectangle; } } /** * @generated */ static final Font FFIGURECONNECTIONPROXIMITYINHERITANCEFIGURE_FONT = new Font( Display.getCurrent(), Display.getDefault().getSystemFont() .getFontData()[0].getName(), 9, SWT.NORMAL); /** * @generated */ static final Font FFIGURECONNECTIONPROXIMITYCONTAINMENTFIGURE_FONT = new Font( Display.getCurrent(), Display.getDefault().getSystemFont() .getFontData()[0].getName(), 9, SWT.NORMAL); /** * @generated */ static final Font FFIGURECONNECTIONNAMEFIGURE_FONT = new Font( Display.getCurrent(), Display.getDefault().getSystemFont() .getFontData()[0].getName(), 9, SWT.BOLD); /** * @generated */ static final Font FFIGURECONNECTIONPOTENCYFIGURE_FONT = new Font( Display.getCurrent(), Display.getDefault().getSystemFont() .getFontData()[0].getName(), 7, SWT.NORMAL); /** * @generated */ static final Font FFIGURECONNECTIONPROXIMITYCLASSIFICATIONFIGURE_FONT = new Font( Display.getCurrent(), Display.getDefault().getSystemFont() .getFontData()[0].getName(), 9, SWT.NORMAL); /** * @generated */ static final Font FFIGURECONNECTIONLEVELFIGURE_FONT = new Font( Display.getCurrent(), Display.getDefault().getSystemFont() .getFontData()[0].getName(), 7, SWT.NORMAL); /** * @generated */ static final Font FFIGURECONNECTIONAVSFIGURE_FONT = new Font( Display.getCurrent(), Display.getDefault().getSystemFont() .getFontData()[0].getName(), 8, SWT.NORMAL); //Gives the option to diplay a Connection/Generalization/Specialization as black rectangle /** * * @return null if no toggeling infotmation is available, else true or false * * @generated */ private Boolean getToggleValue() { //boolean collapse = false; //******************************************************** //Find the LMLVisualizer attached to this element //******************************************************** de.uni_mannheim.informatik.swt.models.plm.PLM.Element self = (de.uni_mannheim.informatik.swt.models.plm.PLM.Element) this .resolveSemanticElement(); //No rendering information found => all Connection remains expanded if (self.getVisualizer().size() == 0) { //Hide external name label IFigure boderItemContainer = (IFigure) figure.getChildren().get(1); ((IFigure) boderItemContainer.getChildren().get(0)) .setVisible(false); return null; } de.uni_mannheim.informatik.swt.models.plm.PLM.LMLVisualizer r = self .getVisualizer().get(0); String collapsedString = r.getValueForKey("collapsed"); return java.lang.Boolean.parseBoolean(collapsedString); } /** * * Tracks the editPartsToggledState * * @generated */ private boolean inToggeledState = false; /** * This renders the ConnectionEditPart based on information * in the model. Collapsed means that the Connection is rendered as small * black rectangle. Collapsed means that the Connection will rendered as * hexagon, its default figure. * * @generated */ private void toggle() { java.lang.Boolean collapse = getToggleValue(); //expand element if (collapse == null || !collapse) { this.setBackgroundColor(Display.getDefault().getSystemColor( SWT.COLOR_WHITE)); //remove previous shape getMainFigure().getChildren().remove(0); //add default figure getMainFigure().getChildren().add(0, getPrimaryShape()); //Hide external name label IFigure boderItemContainer = (IFigure) figure.getChildren().get(1); ((IFigure) boderItemContainer.getChildren().get(0)) .setVisible(false); //Allow Resizing removeEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableShapeEditPolicy()); //When we come from read only context / addNotify the size should be in the //notation model if (getEditingDomain() instanceof InternalTransactionalEditingDomain && //No transaction is running or no readonly transaction is running (((InternalTransactionalEditingDomain) getEditingDomain()) .getActiveTransaction() == null || !((InternalTransactionalEditingDomain) getEditingDomain()) .getActiveTransaction().isReadOnly())) { //Auto resize with the new shape Request rr = new Request(RequestConstants.REQ_AUTOSIZE); performRequest(rr); } inToggeledState = false; return; } //collapse element else { //************************************************** //Create the new figure (Rectangle with black background) //************************************************** //if already toggled -> return if (inToggeledState == true) return; Rectangle rect = (figure.getClientArea() != null) ? figure .getClientArea().getCopy() : null; ((IFigure) figure.getChildren().get(0)).getChildren().clear(); RectangleFigure rf = new RectangleFigure(); rf.setBackgroundColor(Display.getDefault().getSystemColor( SWT.COLOR_BLACK)); rf.setBorder(new LineBorder(PlatformUI.getWorkbench().getDisplay() .getSystemColor(SWT.COLOR_WHITE), 2)); getMainFigure().getChildren().add(0, rf); rf.setParent(getMainFigure()); //Hide external name label IFigure boderItemContainer = (IFigure) figure.getChildren().get(1); ((IFigure) boderItemContainer.getChildren().get(0)) .setVisible(true); //A client rectangle existed if (rect != null && (rect.width != 0 && rect.height != 0 && rect.x != 0 && rect.y != 0)) { cachedSize = rect.getCopy().getSize(); //Set the new location based on center of the shape rect.setLocation(rect.getCenter().x - 4, rect.getCenter().y - 4); rect.setSize(8, 8); SetBoundsCommand sbc = new SetBoundsCommand( this.getEditingDomain(), "change size", new EObjectAdapter((View) this.getModel()), rect); getEditDomain().getCommandStack().execute( new ICommandProxy(sbc)); } //A client rectangle does not exist -> called from activate else { rf.setSize(8, 8); } removeEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicyEx()); inToggeledState = true; } } /** * Elides the Entity depending on the elided attribute * * @generated */ private void doElide() { de.uni_mannheim.informatik.swt.models.plm.PLM.Clabject clab = (de.uni_mannheim.informatik.swt.models.plm.PLM.Clabject) resolveSemanticElement(); //The figure IFigure defaultSizeNodeFigure = getMainFigure(); //the container that contains the border items IFigure borderItemContainer = (IFigure) figure.getChildren().get(1); //Elide and hide if model.complteness = NoElision if (clab.isElided()) { Rectangle rect = figure.getClientArea().getCopy(); defaultSizeNodeFigure.getChildren().remove(0); //Set up the new figure for the elided node RectangleFigure rf = new RectangleFigure(); rf.setSize(new Dimension(30, 15)); rf.setLayoutManager(new ToolbarLayout()); rf.setOutline(false); WrappingLabel wl = new WrappingLabel(); wl.setText("..."); Color black = PlatformUI.getWorkbench().getDisplay().getCurrent() .getSystemColor(SWT.COLOR_BLACK); wl.setForegroundColor(black); rf.add(wl); defaultSizeNodeFigure.getChildren().add(0, rf); rf.setParent(defaultSizeNodeFigure); //On Startup the size is saved in the notational model if (EditPartUtil.isWriteTransactionInProgress(this, true, true)) { //Resize the elided node rect.setSize((cachedSize != null) ? cachedSize : new Dimension( 10, 10)); SetBoundsCommand sbc = new SetBoundsCommand( this.getEditingDomain(), "change size", new EObjectAdapter((View) this.getModel()), rect); getEditDomain().getCommandStack().execute( new ICommandProxy(sbc)); } //Dash all lines from to the elided element if (targetConnections != null) { for (IGraphicalEditPart link : (List<IGraphicalEditPart>) targetConnections) { if (!(link.resolveSemanticElement() instanceof de.uni_mannheim.informatik.swt.models.plm.PLM.Classification)) { ((PolylineConnectionEx) link.getFigure()) .setLineStyle(SWT.LINE_CUSTOM); ((PolylineConnectionEx) link.getFigure()) .setLineDash(new int[] { 10 }); } } } else if (sourceConnections != null) { for (IGraphicalEditPart link : (List<IGraphicalEditPart>) sourceConnections) { if (!(link.resolveSemanticElement() instanceof de.uni_mannheim.informatik.swt.models.plm.PLM.Classification)) { ((PolylineConnectionEx) link.getFigure()) .setLineStyle(SWT.LINE_CUSTOM); ((PolylineConnectionEx) link.getFigure()) .setLineDash(new int[] { 10 }); } } } removeEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicyEx()); performRequest(new Request(RequestConstants.REQ_REFRESH)); if (clab.eContainer() instanceof de.uni_mannheim.informatik.swt.models.plm.PLM.Model && ((de.uni_mannheim.informatik.swt.models.plm.PLM.Model) clab .eContainer()).getCompletness().equalsIgnoreCase( "noelision")) getNotationView().setVisible(false); } //We only need to revert the elision if we have done it when the editor was open else { defaultSizeNodeFigure.getChildren().remove(0); defaultSizeNodeFigure.getChildren().add(0, getPrimaryShape()); getPrimaryShape().setParent(defaultSizeNodeFigure); //We cannot execute commands in read only context if (EditPartUtil.isWriteTransactionInProgress(this, true, true)) { Request rr = new Request(RequestConstants.REQ_AUTOSIZE); performRequest(rr); } //Make all lines from to the elided element solid if (targetConnections != null) { for (IGraphicalEditPart link : (List<IGraphicalEditPart>) targetConnections) { if (!(link.resolveSemanticElement() instanceof de.uni_mannheim.informatik.swt.models.plm.PLM.Classification)) ((PolylineConnectionEx) link.getFigure()) .setLineStyle(SWT.LINE_SOLID); } } else if (sourceConnections != null) { for (IGraphicalEditPart link : (List<IGraphicalEditPart>) sourceConnections) { if (!(link.resolveSemanticElement() instanceof de.uni_mannheim.informatik.swt.models.plm.PLM.Classification)) ((PolylineConnectionEx) link.getFigure()) .setLineStyle(SWT.LINE_SOLID); } } removeEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableShapeEditPolicy()); performRequest(new Request(RequestConstants.REQ_REFRESH)); } //Hide the outer label ((IFigure) borderItemContainer.getChildren().get(0)).setVisible(false); } /** * @generated */ private Dimension cachedSize = null; /** * Sets the figure to visually expressed or computed. Depending on the expressed * value. * * @generated */ private void setExpressedVisualState() { IGraphicalEditPart parent = (IGraphicalEditPart) getParent(); de.uni_mannheim.informatik.swt.models.plm.PLM.Element self = (de.uni_mannheim.informatik.swt.models.plm.PLM.Element) resolveSemanticElement(); //Check is visible if (parent.resolveSemanticElement() instanceof de.uni_mannheim.informatik.swt.models.plm.PLM.Context) { de.uni_mannheim.informatik.swt.models.plm.PLM.Context container = (de.uni_mannheim.informatik.swt.models.plm.PLM.Context) parent .resolveSemanticElement(); if ((container.getOrigin().equalsIgnoreCase("computed") && self .isExpressed()) || (container.getOrigin().equalsIgnoreCase("expressed") && !self .isExpressed())) { if (EditPartUtil.isWriteTransactionInProgress(this, true, true)) { getNotationView().setVisible(false); } } } else { if (EditPartUtil.isWriteTransactionInProgress(this, true, true)) { getNotationView().setVisible(true); } } if (self.isExpressed()) { getPrimaryShape().setLineStyle(SWT.LINE_SOLID); } else { getPrimaryShape().setLineStyle(SWT.LINE_CUSTOM); getPrimaryShape().setLineDash(new float[] { 10 }); } } /** * @generated */ @Override public void addNotify() { super.addNotify(); //Entity EditParts do not have a outer BorderItemContainer in contrast //to Connections etc. as those have external labels updateView(); } /** * Registers the Edipart to fire handleNotification on changes * in LMLVisualizer. * * BUG: Only runs on EditPartCrearion. Items which are added Afterwards are not * listened to. * * @generated */ @Override protected void addSemanticListeners() { super.addSemanticListeners(); de.uni_mannheim.informatik.swt.models.plm.PLM.Element e = (de.uni_mannheim.informatik.swt.models.plm.PLM.Element) resolveSemanticElement(); //Register for listening to LMLVisualizer changes for (de.uni_mannheim.informatik.swt.models.plm.PLM.LMLVisualizer v : e .getVisualizer()) addListenerFilter( v.toString().substring(0, v.toString().indexOf(" ")), this, v); //Register to listen for feature changes for (de.uni_mannheim.informatik.swt.models.plm.PLM.Feature f : ((de.uni_mannheim.informatik.swt.models.plm.PLM.Clabject) e) .getFeature()) addListenerFilter( f.toString().substring(0, f.toString().indexOf(" ")), this, f); } }