Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 220884 Details for
Bug 377501
[Sequence Diagram] Connections upon Messages creation
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
bugfix
Bug377501_Connections upon Messages creation.patch (text/plain), 40.78 KB, created by
Chuwei Huang
on 2012-09-10 05:11:47 EDT
(
hide
)
Description:
bugfix
Filename:
MIME Type:
Creator:
Chuwei Huang
Created:
2012-09-10 05:11:47 EDT
Size:
40.78 KB
patch
obsolete
>Index: custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/SequenceGraphicalNodeEditPolicy.java >=================================================================== >--- custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/SequenceGraphicalNodeEditPolicy.java (revision 8940) >+++ custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/SequenceGraphicalNodeEditPolicy.java (working copy) >@@ -45,7 +45,9 @@ > import org.eclipse.jface.viewers.ILabelProvider; > import org.eclipse.papyrus.uml.diagram.common.service.AspectUnspecifiedTypeConnectionTool.CreateAspectUnspecifiedTypeConnectionRequest; > import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragment2EditPart; >+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentEditPart; > import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionEditPart; >+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionOperandEditPart; > import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart; > import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.Message2EditPart; > import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.Message3EditPart; >@@ -260,7 +262,7 @@ > if(replyHint.equals(desc.getSemanticHint()) && request.getSourceEditPart() instanceof IGraphicalEditPart) { > Rectangle srcBounds = SequenceUtil.getAbsoluteBounds((IGraphicalEditPart)request.getSourceEditPart()); > int bottom = srcBounds.getBottom().y; >- if(bottom >= targetPoint.y) { >+ if(bottom >= targetPoint.y + MARGIN) { > return UnexecutableCommand.INSTANCE; > } > } >@@ -456,27 +458,41 @@ > || REQ_RECONNECT_TARGET.equals(request.getType())){ > > EditPart host = getHost(); >- if((host instanceof InteractionEditPart) && (request instanceof CreateConnectionRequest) ){ >- if(REQ_CONNECTION_END.equals(request.getType()) && isCreateConnectionRequest(request,UMLElementTypes.Message_4008 )){ >- return host; >- } >- if(REQ_CONNECTION_START.equals(request.getType()) && isCreateConnectionRequest(request,UMLElementTypes.Message_4009 )){ >- return host; >- } >- >- InteractionEditPart interactionPart = (InteractionEditPart)host; >- CreateConnectionRequest req = (CreateConnectionRequest)request; >- IFigure figure = interactionPart.getFigure(); >- Point location = req.getLocation().getCopy(); >- figure.translateToRelative(location); >- >- // if mouse location is far from border, do not handle connection event >- Rectangle innerRetangle = figure.getBounds().getCopy().shrink(20, 20); >- if(innerRetangle.contains(location)){ >+ if(request instanceof CreateConnectionRequest){ >+ if(host instanceof InteractionEditPart){ >+ if(REQ_CONNECTION_END.equals(request.getType()) && isCreateConnectionRequest(request,UMLElementTypes.Message_4008 )){ >+ return host; >+ } >+ if(REQ_CONNECTION_START.equals(request.getType()) && isCreateConnectionRequest(request,UMLElementTypes.Message_4009 )){ >+ return host; >+ } >+ >+ InteractionEditPart interactionPart = (InteractionEditPart)host; >+ CreateConnectionRequest req = (CreateConnectionRequest)request; >+ IFigure figure = interactionPart.getFigure(); >+ Point location = req.getLocation().getCopy(); >+ figure.translateToRelative(location); >+ >+ // if mouse location is far from border, do not handle connection event >+ Rectangle innerRetangle = figure.getBounds().getCopy().shrink(20, 20); >+ if(innerRetangle.contains(location)){ >+ return null; >+ } >+ }else if(host instanceof InteractionOperandEditPart){ > return null; >+ }else if(host instanceof CombinedFragmentEditPart){ >+ CreateConnectionRequest req = (CreateConnectionRequest)request; >+ IFigure figure = ((GraphicalEditPart)host).getFigure(); >+ Point location = req.getLocation().getCopy(); >+ figure.translateToRelative(location); >+ >+ // if mouse location is far from border, do not handle connection event >+ Rectangle innerRetangle = figure.getBounds().getCopy().shrink(10, 10); >+ if(innerRetangle.contains(location)){ >+ return null; >+ } > } >- } >- >+ } > return host; > } > return null; >Index: custom-src/org/eclipse/papyrus/uml/diagram/sequence/draw2d/routers/MessageRouter.java >=================================================================== >--- custom-src/org/eclipse/papyrus/uml/diagram/sequence/draw2d/routers/MessageRouter.java (revision 8892) >+++ custom-src/org/eclipse/papyrus/uml/diagram/sequence/draw2d/routers/MessageRouter.java (working copy) >@@ -31,10 +31,9 @@ > import org.eclipse.gmf.runtime.draw2d.ui.internal.routers.ObliqueRouter; > import org.eclipse.gmf.runtime.draw2d.ui.internal.routers.OrthogonalRouterUtilities; > import org.eclipse.gmf.runtime.draw2d.ui.mapmode.MapModeUtil; >+import org.eclipse.papyrus.uml.diagram.sequence.edit.helpers.AnchorHelper; > import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart.LifelineFigure; >-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart.SlidableAnchorEx; > import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.Message2EditPart; >-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.Message2EditPart.MessageAsync; > import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.Message4EditPart.MessageCreate; > > /** >@@ -130,6 +129,13 @@ > break; > } > } >+ >+ protected boolean checkShapesIntersect(Connection conn, PointList newLine) { >+ if(conn.getTargetAnchor().getOwner() instanceof AnchorHelper.CombinedFragmentNodeFigure){ >+ return false; >+ } >+ return super.checkShapesIntersect(conn, newLine); >+ } > > protected void adjustCreateEndpoint(Connection conn, PointList newLine) { > if(conn instanceof MessageCreate){ >@@ -198,8 +204,8 @@ > > protected boolean isOnRightHand(Connection conn, IFigure owner, Point middle) { > boolean right = true; >- if(conn.getTargetAnchor() instanceof SlidableAnchorEx){ >- SlidableAnchorEx anchor = (SlidableAnchorEx) conn.getTargetAnchor(); >+ if(conn.getTargetAnchor() instanceof AnchorHelper.SideAnchor){ >+ AnchorHelper.SideAnchor anchor = ( AnchorHelper.SideAnchor) conn.getTargetAnchor(); > right = anchor.isRight(); > }else{ > PointList list = conn.getPoints(); >Index: src/org/eclipse/papyrus/uml/diagram/sequence/edit/helpers/AnchorHelper.java >=================================================================== >--- src/org/eclipse/papyrus/uml/diagram/sequence/edit/helpers/AnchorHelper.java (revision 0) >+++ src/org/eclipse/papyrus/uml/diagram/sequence/edit/helpers/AnchorHelper.java (revision 0) >@@ -0,0 +1,195 @@ >+package org.eclipse.papyrus.uml.diagram.sequence.edit.helpers; >+ >+import org.eclipse.draw2d.ConnectionAnchor; >+import org.eclipse.draw2d.IFigure; >+import org.eclipse.draw2d.geometry.Dimension; >+import org.eclipse.draw2d.geometry.Point; >+import org.eclipse.draw2d.geometry.PointList; >+import org.eclipse.draw2d.geometry.PrecisionPoint; >+import org.eclipse.draw2d.geometry.PrecisionRectangle; >+import org.eclipse.draw2d.geometry.Rectangle; >+import org.eclipse.emf.transaction.RunnableWithResult; >+import org.eclipse.emf.transaction.TransactionalEditingDomain; >+import org.eclipse.gef.ConnectionEditPart; >+import org.eclipse.gef.Request; >+import org.eclipse.gef.requests.DropRequest; >+import org.eclipse.gef.requests.ReconnectRequest; >+import org.eclipse.gmf.runtime.common.core.util.Log; >+import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIPlugin; >+import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIStatusCodes; >+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure; >+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure; >+import org.eclipse.gmf.runtime.gef.ui.figures.SlidableAnchor; >+import org.eclipse.gmf.runtime.notation.Anchor; >+import org.eclipse.gmf.runtime.notation.Edge; >+import org.eclipse.gmf.runtime.notation.IdentityAnchor; >+import org.eclipse.papyrus.uml.diagram.common.draw2d.anchors.FixedAnchor; >+ >+ >+public class AnchorHelper { >+ >+ public static String getAnchorId(TransactionalEditingDomain domain, ConnectionEditPart connEditPart, final boolean isSource) { >+ final org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart connection = >+ (org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart)connEditPart; >+ >+ String t = ""; //$NON-NLS-1$ >+ try { >+ t = (String) domain.runExclusive( >+ new RunnableWithResult.Impl() { >+ >+ public void run() { >+ Anchor a = null; >+ if(isSource) >+ a = ((Edge)connection.getModel()).getSourceAnchor(); >+ else >+ a = ((Edge)connection.getModel()).getTargetAnchor(); >+ if (a instanceof IdentityAnchor) >+ setResult(((IdentityAnchor) a).getId()); >+ else >+ setResult(""); //$NON-NLS-1$ >+ } >+ }); >+ } catch (InterruptedException e) { >+ Log.error(DiagramUIPlugin.getInstance(), >+ DiagramUIStatusCodes.IGNORED_EXCEPTION_WARNING, >+ "getTargetConnectionAnchor", e); //$NON-NLS-1$ >+ } >+ return t; >+ } >+ >+ >+ public static Point getRequestLocation(Request request){ >+ if (request instanceof ReconnectRequest) { >+ if (((DropRequest) request).getLocation() != null) { >+ Point pt = ((DropRequest) request).getLocation().getCopy(); >+ return pt; >+ } >+ } >+ else if (request instanceof DropRequest){ >+ return ((DropRequest) request).getLocation(); >+ } >+ return null; >+ } >+ >+ public static class CombinedFragmentNodeFigure extends DefaultSizeNodeFigure{ >+ >+ public CombinedFragmentNodeFigure(int width, int height) { >+ super(width, height); >+ } >+ >+ protected ConnectionAnchor createAnchor(PrecisionPoint p) { >+ if (p==null) >+ // If the old terminal for the connection anchor cannot be resolved (by SlidableAnchor) a null >+ // PrecisionPoint will passed in - this is handled here >+ return createDefaultAnchor(); >+ return new AnchorHelper.IntersectionPointAnchor(this, p); >+ } >+ } >+ >+ public static class IntersectionPointAnchor extends SlidableAnchor{ >+ >+ public IntersectionPointAnchor(IFigure fig, PrecisionPoint p) { >+ super(fig,p); >+ } >+ >+ public IntersectionPointAnchor(IFigure fig) { >+ super(fig); >+ } >+ >+ protected Point getLocation(Point ownReference, Point foreignReference) { >+ PointList intersections = getIntersectionPoints(ownReference, foreignReference); >+ if (intersections!=null && intersections.size()!=0) { >+ int size = intersections.size(); >+ double dist = foreignReference.getDistance(ownReference); >+ for(int i = 0; i < size; i ++){ >+ Point loc = intersections.getPoint(i); >+ if(isInOrder(foreignReference,ownReference,dist, loc)){ >+ return loc; >+ } >+ } >+ return intersections.getFirstPoint(); >+ } >+ return null; >+ } >+ >+ private boolean isInOrder(Point start, Point end, double dist, Point loc) { >+ double total = loc.getDistance(start); >+ double dist2 = loc.getDistance(end); >+ if(total < dist || total < dist2) >+ return false; >+ >+ if(Math.abs(total - dist - dist2) < 0.01) >+ return true; >+ >+ return false; >+ } >+ } >+ >+ public static class FixedAnchorEx extends FixedAnchor { >+ >+ private int location; >+ >+ public FixedAnchorEx(IFigure f, int location) { >+ super(f, location); >+ this.location = location; >+ } >+ >+ public Point getLocation(Point reference) { >+ if(location == TOP) >+ return getBox().getTop(); >+ else if(location == BOTTOM) >+ return getBox().getBottom(); >+ >+ return super.getLocation(reference); >+ } >+ } >+ >+ public static class SideAnchor extends SlidableAnchor{ >+ >+ private boolean isRight; >+ >+ public SideAnchor(NodeFigure nodeFigure, PrecisionPoint pt, >+ boolean isRight) { >+ super(nodeFigure, pt); >+ this.isRight = isRight; >+ } >+ >+ public boolean isRight() { >+ return isRight; >+ } >+ >+ public String getTerminal() { >+ String side = isRight? "R": "L"; >+ return super.getTerminal() + "{" + side + "}"; >+ } >+ } >+ >+ public static class InnerPointAnchor extends SlidableAnchor{ >+ private PrecisionPoint percent; >+ private IFigure figure; >+ >+ public InnerPointAnchor(IFigure fig, PrecisionPoint percent) { >+ super(fig,percent); >+ this.figure = fig; >+ this.percent = percent; >+ } >+ >+ public static InnerPointAnchor createAnchorAtLocation(IFigure fig, PrecisionPoint loc) { >+ PrecisionPoint p = loc.getPreciseCopy(); >+ Rectangle b = fig.getBounds().getCopy(); >+ fig.translateToAbsolute(b); >+ >+ Dimension d = p.getDifference(b.getTopLeft()); >+ PrecisionPoint per = new PrecisionPoint( d.preciseWidth()/ b.width , d.preciseHeight() / b.height); >+ return new InnerPointAnchor(fig, per); >+ } >+ >+ protected Point getLocation(Point ownReference, Point foreignReference) { >+ PrecisionRectangle bounds = new PrecisionRectangle(figure.getBounds()); >+ bounds.setPreciseWidth((bounds.width * percent.preciseX())); >+ bounds.setPreciseHeight((bounds.height * percent.preciseY())); >+ figure.translateToAbsolute(bounds); >+ return bounds.getBottomRight(); >+ } >+ } >+} >Index: src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/InteractionEditPart.java >=================================================================== >--- src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/InteractionEditPart.java (revision 8937) >+++ src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/InteractionEditPart.java (working copy) >@@ -74,6 +74,7 @@ > import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper; > import org.eclipse.papyrus.uml.diagram.common.providers.UIAdapterImpl; > import org.eclipse.papyrus.uml.diagram.common.util.MessageDirection; >+import org.eclipse.papyrus.uml.diagram.sequence.edit.helpers.AnchorHelper; > import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.InteractionItemSemanticEditPolicy; > import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.SequenceGraphicalNodeEditPolicy; > import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin; >@@ -273,64 +274,6 @@ > return getContentPane(); > } > >- static class SlidableAnchorEx extends SlidableAnchor{ >- private PrecisionPoint percent; >- private IFigure figure; >- >- SlidableAnchorEx(IFigure fig, PrecisionPoint percent) { >- super(fig,percent); >- this.figure = fig; >- this.percent = percent; >- } >- >- static SlidableAnchorEx createAnchorAtLocation(IFigure fig, PrecisionPoint loc) { >- PrecisionPoint p = loc.getPreciseCopy(); >- Rectangle b = fig.getBounds().getCopy(); >- fig.translateToAbsolute(b); >- >- Dimension d = p.getDifference(b.getTopLeft()); >- PrecisionPoint per = new PrecisionPoint( d.preciseWidth()/ b.width , d.preciseHeight() / b.height); >- return new SlidableAnchorEx(fig, per); >- } >- >- protected Point getLocation(Point ownReference, Point foreignReference) { >-// PointList intersections = getIntersectionPoints(ownReference, foreignReference); >-// if (intersections!=null && intersections.size()!=0) { >-// int size = intersections.size(); >-// double dist = foreignReference.getDistance(ownReference); >-// for(int i = 0; i < size; i ++){ >-// Point loc = intersections.getPoint(i); >-// if(isInOrder(foreignReference,ownReference,dist, loc)){ >-// return loc; >-// } >-// } >-// return intersections.getFirstPoint(); >-// } >-// return null; >- PrecisionRectangle bounds = new PrecisionRectangle(figure.getBounds()); >- bounds.setPreciseWidth((bounds.width * percent.preciseX())); >- bounds.setPreciseHeight((bounds.height * percent.preciseY())); >- figure.translateToAbsolute(bounds); >- return bounds.getBottomRight(); >- } >- >-// public String getTerminal() { >-// return super.getTerminal() ; >-// } >-// >-// private boolean isInOrder(Point start, Point end, double dist, Point loc) { >-// double total = loc.getDistance(start); >-// double dist2 = loc.getDistance(end); >-// if(total < dist || total < dist2) >-// return false; >-// >-// if(Math.abs(total - dist - dist2) < 0.01) >-// return true; >-// >-// return false; >-// } >- } >- > /** > * @generated > */ >@@ -341,13 +284,13 @@ > String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.HEIGHT); > DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight)){ > >-// protected ConnectionAnchor createAnchor(PrecisionPoint p) { >-// if (p==null) >-// // If the old terminal for the connection anchor cannot be resolved (by SlidableAnchor) a null >-// // PrecisionPoint will passed in - this is handled here >-// return createDefaultAnchor(); >-// return new SlidableAnchorEx(this, p); >-// } >+ protected ConnectionAnchor createAnchor(PrecisionPoint p) { >+ if (p==null) >+ // If the old terminal for the connection anchor cannot be resolved (by SlidableAnchor) a null >+ // PrecisionPoint will passed in - this is handled here >+ return createDefaultAnchor(); >+ return new AnchorHelper.IntersectionPointAnchor(this, p); >+ } > }; > > return result; >@@ -1312,10 +1255,10 @@ > @Override > public ConnectionAnchor getSourceConnectionAnchor(ConnectionEditPart connEditPart) { > if(connEditPart instanceof Message7EditPart){ >- String terminal = getAnchorId(connEditPart,true); >+ String terminal = AnchorHelper.getAnchorId(getEditingDomain(), connEditPart,true); > if(terminal.length() > 0){ > PrecisionPoint pt = SlidableAnchor.parseTerminalString(terminal); >- return new SlidableAnchorEx(getFigure(),pt); >+ return new AnchorHelper.InnerPointAnchor(getFigure(),pt); > } > } > >@@ -1347,10 +1290,10 @@ > public ConnectionAnchor getTargetConnectionAnchor(ConnectionEditPart connEditPart) { > > if(connEditPart instanceof Message6EditPart){ >- String terminal = getAnchorId(connEditPart, false); >+ String terminal = AnchorHelper.getAnchorId(getEditingDomain(), connEditPart, false); > if(terminal.length() > 0){ > PrecisionPoint pt = SlidableAnchor.parseTerminalString(terminal); >- return new SlidableAnchorEx(getFigure(),pt); >+ return new AnchorHelper.InnerPointAnchor(getFigure(),pt); > } > } > >@@ -1361,38 +1304,6 @@ > // } > return targetConnectionAnchor; > } >- >- private String getAnchorId(ConnectionEditPart connEditPart, final boolean isSource) { >- final org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart connection = >- (org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart)connEditPart; >- >- String t = ""; //$NON-NLS-1$ >- try { >- t = (String) getEditingDomain().runExclusive( >- new RunnableWithResult.Impl() { >- >- public void run() { >- Anchor a = null; >- if(isSource) >- a = ((Edge)connection.getModel()).getSourceAnchor(); >- else >- a = ((Edge)connection.getModel()).getTargetAnchor(); >- if (a instanceof IdentityAnchor) >- setResult(((IdentityAnchor) a).getId()); >- else >- setResult(""); //$NON-NLS-1$ >- } >- }); >- } catch (InterruptedException e) { >- Trace.catching(DiagramUIPlugin.getInstance(), >- DiagramUIDebugOptions.EXCEPTIONS_CATCHING, getClass(), >- "getTargetConnectionAnchor", e); //$NON-NLS-1$ >- Log.error(DiagramUIPlugin.getInstance(), >- DiagramUIStatusCodes.IGNORED_EXCEPTION_WARNING, >- "getTargetConnectionAnchor", e); //$NON-NLS-1$ >- } >- return t; >- } > > /** > * Create Anchor >@@ -1444,7 +1355,7 @@ > */ > private ConnectionAnchor createAnchor(Point location) { > //return new SlidableAnchor(getFigure(), BaseSlidableAnchor.getAnchorRelativeLocation(location, getFigure().getBounds())); >- return SlidableAnchorEx.createAnchorAtLocation(getFigure(), new PrecisionPoint(location)); >+ return AnchorHelper.InnerPointAnchor.createAnchorAtLocation(getFigure(), new PrecisionPoint(location)); > } > > } >Index: src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/BehaviorExecutionSpecificationEditPart.java >=================================================================== >--- src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/BehaviorExecutionSpecificationEditPart.java (revision 8937) >+++ src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/BehaviorExecutionSpecificationEditPart.java (working copy) >@@ -21,11 +21,7 @@ > import org.eclipse.draw2d.DelegatingLayout; > import org.eclipse.draw2d.IFigure; > import org.eclipse.draw2d.PositionConstants; >-import org.eclipse.draw2d.RectangleFigure; > import org.eclipse.draw2d.Shape; >-import org.eclipse.draw2d.StackLayout; >-import org.eclipse.draw2d.geometry.Dimension; >-import org.eclipse.draw2d.geometry.PrecisionPoint; > import org.eclipse.emf.ecore.EStructuralFeature; > import org.eclipse.gef.ConnectionEditPart; > import org.eclipse.gef.EditPart; >@@ -38,13 +34,11 @@ > import org.eclipse.gef.requests.CreateRequest; > import org.eclipse.gef.requests.ReconnectRequest; > import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; >-import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart; > import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; > import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeConnectionRequest; > import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeRequest; > import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities; > 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.NotationPackage; > import org.eclipse.gmf.runtime.notation.View; >@@ -53,7 +47,7 @@ > import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter; > import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper; > import org.eclipse.papyrus.uml.diagram.common.draw2d.anchors.FixedAnchor; >-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.AbstractExecutionSpecificationEditPart.FillParentLocator; >+import org.eclipse.papyrus.uml.diagram.sequence.edit.helpers.AnchorHelper; > import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.BehaviorExecutionSpecificationItemSemanticEditPolicy; > import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.ElementCreationWithMessageEditPolicy; > import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.ExecutionSpecificationComponentEditPolicy; >@@ -1040,7 +1034,7 @@ > if(UMLElementTypes.Message_4003.equals(obj)) { > // Sync Message > if(!createRequest.getTargetEditPart().equals(createRequest.getSourceEditPart())) { >- return new FixedAnchor(getFigure(), FixedAnchor.TOP); >+ return new AnchorHelper.FixedAnchorEx(getFigure(), FixedAnchor.TOP); > } > // otherwise, this is a recursive call, let destination free > } >@@ -1050,7 +1044,7 @@ > ConnectionEditPart connectionEditPart = reconnectRequest.getConnectionEditPart(); > if(connectionEditPart instanceof MessageEditPart) { > // Sync Message >- return new FixedAnchor(getFigure(), FixedAnchor.TOP); >+ return new AnchorHelper.FixedAnchorEx(getFigure(), FixedAnchor.TOP); > } > } > >@@ -1069,7 +1063,7 @@ > public ConnectionAnchor getTargetConnectionAnchor(ConnectionEditPart connEditPart) { > if(connEditPart instanceof MessageEditPart) { > // Sync Message >- return new FixedAnchor(getFigure(), FixedAnchor.TOP); >+ return new AnchorHelper.FixedAnchorEx(getFigure(), FixedAnchor.TOP); > } > return super.getTargetConnectionAnchor(connEditPart); > } >@@ -1090,7 +1084,7 @@ > for(Object obj : relationshipTypes) { > if(UMLElementTypes.Message_4005.equals(obj)) { > // Reply Message >- return new FixedAnchor(getFigure(), FixedAnchor.BOTTOM); >+ return new AnchorHelper.FixedAnchorEx(getFigure(), FixedAnchor.BOTTOM); > } > } > } else if(request instanceof ReconnectRequest) { >@@ -1098,7 +1092,7 @@ > ConnectionEditPart connectionEditPart = reconnectRequest.getConnectionEditPart(); > if(connectionEditPart instanceof Message3EditPart) { > // Reply Message >- return new FixedAnchor(getFigure(), FixedAnchor.BOTTOM); >+ return new AnchorHelper.FixedAnchorEx(getFigure(), FixedAnchor.BOTTOM); > } > } > return super.getSourceConnectionAnchor(request); >@@ -1116,7 +1110,7 @@ > public ConnectionAnchor getSourceConnectionAnchor(ConnectionEditPart connEditPart) { > if(connEditPart instanceof Message3EditPart) { > // Reply Message >- return new FixedAnchor(getFigure(), FixedAnchor.BOTTOM); >+ return new AnchorHelper.FixedAnchorEx(getFigure(), FixedAnchor.BOTTOM); > } > return super.getSourceConnectionAnchor(connEditPart); > } >Index: src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/LifelineEditPart.java >=================================================================== >--- src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/LifelineEditPart.java (revision 8937) >+++ src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/LifelineEditPart.java (working copy) >@@ -53,7 +53,6 @@ > import org.eclipse.gef.requests.ChangeBoundsRequest; > import org.eclipse.gef.requests.CreateConnectionRequest; > import org.eclipse.gef.requests.CreateRequest; >-import org.eclipse.gef.requests.DropRequest; > import org.eclipse.gef.requests.ReconnectRequest; > import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; > import org.eclipse.gmf.runtime.common.core.command.ICommand; >@@ -104,6 +103,7 @@ > import org.eclipse.papyrus.uml.diagram.common.editpolicies.BorderItemResizableEditPolicy; > import org.eclipse.papyrus.uml.diagram.common.figure.node.RectangularShadowBorder; > import org.eclipse.papyrus.uml.diagram.common.providers.UIAdapterImpl; >+import org.eclipse.papyrus.uml.diagram.sequence.edit.helpers.AnchorHelper; > import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.CustomDiagramDragDropEditPolicy; > import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.ElementCreationWithMessageEditPolicy; > import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.LifelineAppliedStereotypeNodeLabelDisplayEditPolicy; >@@ -1898,7 +1898,7 @@ > } > > if(connEditPart instanceof Message2EditPart){ >- String terminal = getTargetAnchorId(connEditPart); >+ String terminal = AnchorHelper.getAnchorId(getEditingDomain(), connEditPart, false); > if(terminal.length() > 0){ > int start = terminal.indexOf("{") + 1; > PrecisionPoint pt = SlidableAnchor.parseTerminalString(terminal); >@@ -1913,40 +1913,12 @@ > if(list.getPoint(0).x > list.getPoint(1).x) > rightHand = false; > } >- return new SlidableAnchorEx(getNodeFigure(), pt, rightHand); >+ return new AnchorHelper.SideAnchor(getNodeFigure(), pt, rightHand); > } > } > return super.getTargetConnectionAnchor(connEditPart); > } > >- private String getTargetAnchorId(ConnectionEditPart connEditPart) { >- final org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart connection = >- (org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart)connEditPart; >- >- String t = ""; //$NON-NLS-1$ >- try { >- t = (String) getEditingDomain().runExclusive( >- new RunnableWithResult.Impl() { >- >- public void run() { >- Anchor a = ((Edge)connection.getModel()).getTargetAnchor(); >- if (a instanceof IdentityAnchor) >- setResult(((IdentityAnchor) a).getId()); >- else >- setResult(""); //$NON-NLS-1$ >- } >- }); >- } catch (InterruptedException e) { >- Trace.catching(DiagramUIPlugin.getInstance(), >- DiagramUIDebugOptions.EXCEPTIONS_CATCHING, getClass(), >- "getTargetConnectionAnchor", e); //$NON-NLS-1$ >- Log.error(DiagramUIPlugin.getInstance(), >- DiagramUIStatusCodes.IGNORED_EXCEPTION_WARNING, >- "getTargetConnectionAnchor", e); //$NON-NLS-1$ >- } >- return t; >- } >- > /** > * Create specific anchor to handle connection on top, on center and on bottom of the lifeline > */ >@@ -1970,13 +1942,13 @@ > > ConnectionAnchor anchor = super.getTargetConnectionAnchor(request); > if(anchor instanceof SlidableAnchor) { >- return createSlidableAnchorEx(request, (SlidableAnchor)anchor); >+ return createSideAnchor(request, (SlidableAnchor)anchor); > } > return anchor; > } > >- protected ConnectionAnchor createSlidableAnchorEx(Request request, SlidableAnchor sa) { >- Point loc = getRequestLocation(request); >+ protected ConnectionAnchor createSideAnchor(Request request, SlidableAnchor sa) { >+ Point loc = AnchorHelper.getRequestLocation(request); > if(loc == null) > return sa; > >@@ -1987,21 +1959,9 @@ > boolean rightHand = true; > if(loc.x < bounds.getCenter().x) > rightHand = false; >- return new SlidableAnchorEx(getNodeFigure(), pt, rightHand); >+ return new AnchorHelper.SideAnchor(getNodeFigure(), pt, rightHand); > } > >- private Point getRequestLocation(Request request){ >- if (request instanceof ReconnectRequest) { >- if (((DropRequest) request).getLocation() != null) { >- Point pt = ((DropRequest) request).getLocation().getCopy(); >- return pt; >- } >- } >- else if (request instanceof DropRequest){ >- return ((DropRequest) request).getLocation(); >- } >- return null; >- } > > /** > * Create the dashLine figure >@@ -2206,26 +2166,6 @@ > return null; > } > >- public static class SlidableAnchorEx extends SlidableAnchor{ >- >- private boolean isRight; >- >- public SlidableAnchorEx(NodeFigure nodeFigure, PrecisionPoint pt, >- boolean isRight) { >- super(nodeFigure, pt); >- this.isRight = isRight; >- } >- >- public boolean isRight() { >- return isRight; >- } >- >- public String getTerminal() { >- String side = isRight? "R": "L"; >- return super.getTerminal() + "{" + side + "}"; >- } >- } >- > public static class PreserveAnchorsPositionCommandEx extends PreserveAnchorsPositionCommand{ > > public PreserveAnchorsPositionCommandEx(ShapeNodeEditPart shapeEP, Dimension sizeDelta, int preserveAxis) { >Index: src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/ActionExecutionSpecificationEditPart.java >=================================================================== >--- src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/ActionExecutionSpecificationEditPart.java (revision 8937) >+++ src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/ActionExecutionSpecificationEditPart.java (working copy) >@@ -17,21 +17,11 @@ > import java.util.LinkedList; > import java.util.List; > >-import org.eclipse.draw2d.BorderLayout; > import org.eclipse.draw2d.ConnectionAnchor; > import org.eclipse.draw2d.DelegatingLayout; >-import org.eclipse.draw2d.Graphics; >-import org.eclipse.draw2d.IClippingStrategy; > import org.eclipse.draw2d.IFigure; >-import org.eclipse.draw2d.Locator; > import org.eclipse.draw2d.PositionConstants; >-import org.eclipse.draw2d.RectangleFigure; > import org.eclipse.draw2d.Shape; >-import org.eclipse.draw2d.StackLayout; >-import org.eclipse.draw2d.XYLayout; >-import org.eclipse.draw2d.geometry.Dimension; >-import org.eclipse.draw2d.geometry.PrecisionPoint; >-import org.eclipse.draw2d.geometry.Rectangle; > import org.eclipse.emf.ecore.EStructuralFeature; > import org.eclipse.gef.ConnectionEditPart; > import org.eclipse.gef.EditPart; >@@ -49,7 +39,6 @@ > import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeRequest; > import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities; > 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.NotationPackage; > import org.eclipse.gmf.runtime.notation.View; >@@ -58,6 +47,7 @@ > import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter; > import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper; > import org.eclipse.papyrus.uml.diagram.common.draw2d.anchors.FixedAnchor; >+import org.eclipse.papyrus.uml.diagram.sequence.edit.helpers.AnchorHelper; > import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.ActionExecutionSpecificationItemSemanticEditPolicy; > import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.ElementCreationWithMessageEditPolicy; > import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.ExecutionSpecificationComponentEditPolicy; >@@ -1047,7 +1037,7 @@ > if(UMLElementTypes.Message_4003.equals(obj)) { > // Sync Message > if(!createRequest.getTargetEditPart().equals(createRequest.getSourceEditPart())) { >- return new FixedAnchor(getFigure(), FixedAnchor.TOP); >+ return new AnchorHelper.FixedAnchorEx(getFigure(), FixedAnchor.TOP); > } > // otherwise, this is a recursive call, let destination free > } >@@ -1057,7 +1047,7 @@ > ConnectionEditPart connectionEditPart = reconnectRequest.getConnectionEditPart(); > if(connectionEditPart instanceof MessageEditPart) { > // Sync Message >- return new FixedAnchor(getFigure(), FixedAnchor.TOP); >+ return new AnchorHelper.FixedAnchorEx(getFigure(), FixedAnchor.TOP); > } > } > >@@ -1076,7 +1066,7 @@ > public ConnectionAnchor getTargetConnectionAnchor(ConnectionEditPart connEditPart) { > if(connEditPart instanceof MessageEditPart) { > // Sync Message >- return new FixedAnchor(getFigure(), FixedAnchor.TOP); >+ return new AnchorHelper.FixedAnchorEx(getFigure(), FixedAnchor.TOP); > } > return super.getTargetConnectionAnchor(connEditPart); > } >@@ -1097,7 +1087,7 @@ > for(Object obj : relationshipTypes) { > if(UMLElementTypes.Message_4005.equals(obj)) { > // Reply Message >- return new FixedAnchor(getFigure(), FixedAnchor.BOTTOM); >+ return new AnchorHelper.FixedAnchorEx(getFigure(), FixedAnchor.BOTTOM); > } > } > } else if(request instanceof ReconnectRequest) { >@@ -1105,7 +1095,7 @@ > ConnectionEditPart connectionEditPart = reconnectRequest.getConnectionEditPart(); > if(connectionEditPart instanceof Message3EditPart) { > // Reply Message >- return new FixedAnchor(getFigure(), FixedAnchor.BOTTOM); >+ return new AnchorHelper.FixedAnchorEx(getFigure(), FixedAnchor.BOTTOM); > } > } > return super.getSourceConnectionAnchor(request); >@@ -1123,7 +1113,7 @@ > public ConnectionAnchor getSourceConnectionAnchor(ConnectionEditPart connEditPart) { > if(connEditPart instanceof Message3EditPart) { > // Reply Message >- return new FixedAnchor(getFigure(), FixedAnchor.BOTTOM); >+ return new AnchorHelper.FixedAnchorEx(getFigure(), FixedAnchor.BOTTOM); > } > return super.getSourceConnectionAnchor(connEditPart); > } >Index: src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/ConsiderIgnoreFragmentEditPart.java >=================================================================== >--- src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/ConsiderIgnoreFragmentEditPart.java (revision 8937) >+++ src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/ConsiderIgnoreFragmentEditPart.java (working copy) >@@ -46,6 +46,7 @@ > import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy; > import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper; > import org.eclipse.papyrus.uml.diagram.common.providers.UIAdapterImpl; >+import org.eclipse.papyrus.uml.diagram.sequence.edit.helpers.AnchorHelper; > import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.CombinedFragmentItemComponentEditPolicy; > import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.ConsiderIgnoreFragmentItemSemanticEditPolicy; > import org.eclipse.papyrus.uml.diagram.sequence.figures.CombinedFragmentFigure; >@@ -164,7 +165,7 @@ > IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore(); > String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.WIDTH); > String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.HEIGHT); >- DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight)); >+ DefaultSizeNodeFigure result = new AnchorHelper.CombinedFragmentNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight)); > > return result; > } >Index: src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CombinedFragmentEditPart.java >=================================================================== >--- src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CombinedFragmentEditPart.java (revision 8937) >+++ src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CombinedFragmentEditPart.java (working copy) >@@ -21,11 +21,13 @@ > import org.eclipse.core.runtime.preferences.IEclipsePreferences; > import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent; > import org.eclipse.core.runtime.preferences.InstanceScope; >+import org.eclipse.draw2d.ConnectionAnchor; > import org.eclipse.draw2d.IFigure; > import org.eclipse.draw2d.Shape; > import org.eclipse.draw2d.StackLayout; > 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.EList; >@@ -38,6 +40,7 @@ > import org.eclipse.emf.transaction.RunnableWithResult; > import org.eclipse.emf.transaction.TransactionalEditingDomain; > import org.eclipse.emf.transaction.util.TransactionUtil; >+import org.eclipse.gef.ConnectionEditPart; > import org.eclipse.gef.EditPart; > import org.eclipse.gef.EditPolicy; > import org.eclipse.gef.Request; >@@ -61,8 +64,10 @@ > import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; > 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.requests.CreateConnectionViewAndElementRequest; > import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest; > import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; >+import org.eclipse.gmf.runtime.draw2d.ui.figures.BaseSlidableAnchor; > import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout; > import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities; > import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; >@@ -73,6 +78,7 @@ > import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; > import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure; > import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure; >+import org.eclipse.gmf.runtime.gef.ui.figures.SlidableAnchor; > import org.eclipse.gmf.runtime.gef.ui.internal.parts.TextCellEditorEx; > import org.eclipse.gmf.runtime.notation.Bounds; > import org.eclipse.gmf.runtime.notation.FillStyle; >@@ -92,6 +98,7 @@ > import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy; > import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusNodeFigure; > import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper; >+import org.eclipse.papyrus.uml.diagram.sequence.edit.helpers.AnchorHelper; > import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.CombinedFragmentItemComponentEditPolicy; > import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.CombinedFragmentItemSemanticEditPolicy; > import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.SequenceGraphicalNodeEditPolicy; >@@ -103,6 +110,7 @@ > import org.eclipse.papyrus.uml.diagram.sequence.util.CommandHelper; > import org.eclipse.papyrus.uml.diagram.sequence.util.InteractionOperatorKindCompatibleMapping; > import org.eclipse.papyrus.uml.diagram.sequence.util.LifelineCoveredByUpdater; >+import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceRequestConstant; > import org.eclipse.swt.SWT; > import org.eclipse.swt.graphics.Color; > import org.eclipse.swt.widgets.Display; >@@ -287,7 +295,7 @@ > IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore(); > String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.WIDTH); > String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.HEIGHT); >- DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight)); >+ DefaultSizeNodeFigure result = new AnchorHelper.CombinedFragmentNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight)) ; > > return result; > } >@@ -1642,5 +1650,4 @@ > return null; > } > } >- > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 377501
:
214914
| 220884 |
224162
|
224421
|
224672
|
224673