Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 377501 | Differences between
and this patch

Collapse All | Expand All

(-)custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/SequenceGraphicalNodeEditPolicy.java (-20 / +36 lines)
Lines 45-51 Link Here
45
import org.eclipse.jface.viewers.ILabelProvider;
45
import org.eclipse.jface.viewers.ILabelProvider;
46
import org.eclipse.papyrus.uml.diagram.common.service.AspectUnspecifiedTypeConnectionTool.CreateAspectUnspecifiedTypeConnectionRequest;
46
import org.eclipse.papyrus.uml.diagram.common.service.AspectUnspecifiedTypeConnectionTool.CreateAspectUnspecifiedTypeConnectionRequest;
47
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragment2EditPart;
47
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragment2EditPart;
48
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentEditPart;
48
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionEditPart;
49
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionEditPart;
50
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionOperandEditPart;
49
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart;
51
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart;
50
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.Message2EditPart;
52
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.Message2EditPart;
51
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.Message3EditPart;
53
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.Message3EditPart;
Lines 260-266 Link Here
260
			if(replyHint.equals(desc.getSemanticHint()) && request.getSourceEditPart() instanceof IGraphicalEditPart) {
262
			if(replyHint.equals(desc.getSemanticHint()) && request.getSourceEditPart() instanceof IGraphicalEditPart) {
261
				Rectangle srcBounds = SequenceUtil.getAbsoluteBounds((IGraphicalEditPart)request.getSourceEditPart());
263
				Rectangle srcBounds = SequenceUtil.getAbsoluteBounds((IGraphicalEditPart)request.getSourceEditPart());
262
				int bottom = srcBounds.getBottom().y;
264
				int bottom = srcBounds.getBottom().y;
263
				if(bottom >= targetPoint.y) {
265
				if(bottom >= targetPoint.y + MARGIN) {
264
					return UnexecutableCommand.INSTANCE;
266
					return UnexecutableCommand.INSTANCE;
265
				}
267
				}
266
			}
268
			}
Lines 456-482 Link Here
456
				|| REQ_RECONNECT_TARGET.equals(request.getType())){
458
				|| REQ_RECONNECT_TARGET.equals(request.getType())){
457
			
459
			
458
			EditPart host = getHost();
460
			EditPart host = getHost();
459
			if((host instanceof InteractionEditPart) && (request instanceof CreateConnectionRequest) ){
461
			if(request instanceof CreateConnectionRequest){
460
				if(REQ_CONNECTION_END.equals(request.getType()) && isCreateConnectionRequest(request,UMLElementTypes.Message_4008 )){
462
				if(host instanceof InteractionEditPart){
461
					return host;
463
					if(REQ_CONNECTION_END.equals(request.getType()) && isCreateConnectionRequest(request,UMLElementTypes.Message_4008 )){
462
				}				
464
						return host;
463
				if(REQ_CONNECTION_START.equals(request.getType()) && isCreateConnectionRequest(request,UMLElementTypes.Message_4009 )){
465
					}				
464
					return host;
466
					if(REQ_CONNECTION_START.equals(request.getType()) && isCreateConnectionRequest(request,UMLElementTypes.Message_4009 )){
465
				}
467
						return host;
466
				
468
					}
467
				InteractionEditPart interactionPart = (InteractionEditPart)host;
469
					
468
				CreateConnectionRequest req = (CreateConnectionRequest)request;
470
					InteractionEditPart interactionPart = (InteractionEditPart)host;
469
				IFigure figure = interactionPart.getFigure();
471
					CreateConnectionRequest req = (CreateConnectionRequest)request;
470
				Point location = req.getLocation().getCopy();
472
					IFigure figure = interactionPart.getFigure();
471
				figure.translateToRelative(location);
473
					Point location = req.getLocation().getCopy();
472
				
474
					figure.translateToRelative(location);
473
				// if mouse location is far from border, do not handle connection event 
475
					
474
				Rectangle innerRetangle = figure.getBounds().getCopy().shrink(20, 20);
476
					// if mouse location is far from border, do not handle connection event 
475
				if(innerRetangle.contains(location)){
477
					Rectangle innerRetangle = figure.getBounds().getCopy().shrink(20, 20);
478
					if(innerRetangle.contains(location)){
479
						return null;
480
					}
481
				}else if(host instanceof InteractionOperandEditPart){
476
					return null;
482
					return null;
483
				}else if(host instanceof CombinedFragmentEditPart){
484
					CreateConnectionRequest req = (CreateConnectionRequest)request;
485
					IFigure figure = ((GraphicalEditPart)host).getFigure();
486
					Point location = req.getLocation().getCopy();
487
					figure.translateToRelative(location);
488
					
489
					// if mouse location is far from border, do not handle connection event 
490
					Rectangle innerRetangle = figure.getBounds().getCopy().shrink(10, 10);
491
					if(innerRetangle.contains(location)){
492
						return null;
493
					}
477
				}
494
				}
478
			}
495
			}	
479
			
480
			return host;
496
			return host;
481
		}
497
		}
482
		return null;
498
		return null;
(-)custom-src/org/eclipse/papyrus/uml/diagram/sequence/draw2d/routers/MessageRouter.java (-4 / +10 lines)
Lines 31-40 Link Here
31
import org.eclipse.gmf.runtime.draw2d.ui.internal.routers.ObliqueRouter;
31
import org.eclipse.gmf.runtime.draw2d.ui.internal.routers.ObliqueRouter;
32
import org.eclipse.gmf.runtime.draw2d.ui.internal.routers.OrthogonalRouterUtilities;
32
import org.eclipse.gmf.runtime.draw2d.ui.internal.routers.OrthogonalRouterUtilities;
33
import org.eclipse.gmf.runtime.draw2d.ui.mapmode.MapModeUtil;
33
import org.eclipse.gmf.runtime.draw2d.ui.mapmode.MapModeUtil;
34
import org.eclipse.papyrus.uml.diagram.sequence.edit.helpers.AnchorHelper;
34
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart.LifelineFigure;
35
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart.LifelineFigure;
35
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart.SlidableAnchorEx;
36
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.Message2EditPart;
36
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.Message2EditPart;
37
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.Message2EditPart.MessageAsync;
38
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.Message4EditPart.MessageCreate;
37
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.Message4EditPart.MessageCreate;
39
38
40
/**
39
/**
Lines 130-135 Link Here
130
			break;
129
			break;
131
		}
130
		}
132
	}
131
	}
132
	
133
	protected boolean checkShapesIntersect(Connection conn, PointList newLine) {
134
		if(conn.getTargetAnchor().getOwner() instanceof AnchorHelper.CombinedFragmentNodeFigure){
135
			return false;
136
		}
137
		return super.checkShapesIntersect(conn, newLine);
138
	}
133
139
134
	protected void adjustCreateEndpoint(Connection conn, PointList newLine) {
140
	protected void adjustCreateEndpoint(Connection conn, PointList newLine) {
135
		if(conn instanceof MessageCreate){
141
		if(conn instanceof MessageCreate){
Lines 198-205 Link Here
198
204
199
	protected boolean isOnRightHand(Connection conn, IFigure owner, Point middle) {
205
	protected boolean isOnRightHand(Connection conn, IFigure owner, Point middle) {
200
		boolean right = true;
206
		boolean right = true;
201
		if(conn.getTargetAnchor() instanceof SlidableAnchorEx){
207
		if(conn.getTargetAnchor() instanceof AnchorHelper.SideAnchor){
202
			SlidableAnchorEx anchor = (SlidableAnchorEx) conn.getTargetAnchor();
208
			 AnchorHelper.SideAnchor anchor = ( AnchorHelper.SideAnchor) conn.getTargetAnchor();
203
			right = anchor.isRight();
209
			right = anchor.isRight();
204
		}else{
210
		}else{
205
			PointList list = conn.getPoints();
211
			PointList list = conn.getPoints();
(-)src/org/eclipse/papyrus/uml/diagram/sequence/edit/helpers/AnchorHelper.java (+195 lines)
Line 0 Link Here
1
package org.eclipse.papyrus.uml.diagram.sequence.edit.helpers;
2
3
import org.eclipse.draw2d.ConnectionAnchor;
4
import org.eclipse.draw2d.IFigure;
5
import org.eclipse.draw2d.geometry.Dimension;
6
import org.eclipse.draw2d.geometry.Point;
7
import org.eclipse.draw2d.geometry.PointList;
8
import org.eclipse.draw2d.geometry.PrecisionPoint;
9
import org.eclipse.draw2d.geometry.PrecisionRectangle;
10
import org.eclipse.draw2d.geometry.Rectangle;
11
import org.eclipse.emf.transaction.RunnableWithResult;
12
import org.eclipse.emf.transaction.TransactionalEditingDomain;
13
import org.eclipse.gef.ConnectionEditPart;
14
import org.eclipse.gef.Request;
15
import org.eclipse.gef.requests.DropRequest;
16
import org.eclipse.gef.requests.ReconnectRequest;
17
import org.eclipse.gmf.runtime.common.core.util.Log;
18
import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIPlugin;
19
import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIStatusCodes;
20
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
21
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
22
import org.eclipse.gmf.runtime.gef.ui.figures.SlidableAnchor;
23
import org.eclipse.gmf.runtime.notation.Anchor;
24
import org.eclipse.gmf.runtime.notation.Edge;
25
import org.eclipse.gmf.runtime.notation.IdentityAnchor;
26
import org.eclipse.papyrus.uml.diagram.common.draw2d.anchors.FixedAnchor;
27
28
29
public class AnchorHelper {
30
31
	public static String getAnchorId(TransactionalEditingDomain domain, ConnectionEditPart connEditPart, final boolean isSource) {
32
        final org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart connection = 
33
            (org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart)connEditPart;
34
        
35
		String t = ""; //$NON-NLS-1$
36
		try {
37
			t = (String) domain.runExclusive(
38
				new RunnableWithResult.Impl() {
39
40
				public void run() {
41
					Anchor a = null;
42
					if(isSource)
43
						a = ((Edge)connection.getModel()).getSourceAnchor();
44
					else
45
						a = ((Edge)connection.getModel()).getTargetAnchor();
46
					if (a instanceof IdentityAnchor)
47
						setResult(((IdentityAnchor) a).getId());
48
                    else
49
                        setResult(""); //$NON-NLS-1$
50
				}
51
			});
52
		} catch (InterruptedException e) {
53
			Log.error(DiagramUIPlugin.getInstance(),
54
				DiagramUIStatusCodes.IGNORED_EXCEPTION_WARNING,
55
				"getTargetConnectionAnchor", e); //$NON-NLS-1$
56
		}
57
		return t;
58
	}
59
60
	
61
	public static Point getRequestLocation(Request request){
62
		if (request instanceof ReconnectRequest) {
63
			if (((DropRequest) request).getLocation() != null) {
64
				Point pt = ((DropRequest) request).getLocation().getCopy();
65
				return pt;
66
			}
67
		}
68
		else if (request instanceof DropRequest){
69
			return 	((DropRequest) request).getLocation();
70
		}
71
		return null;
72
	}
73
	
74
	public static class CombinedFragmentNodeFigure extends DefaultSizeNodeFigure{
75
76
		public CombinedFragmentNodeFigure(int width, int height) {
77
			super(width, height);
78
		}
79
		
80
		protected ConnectionAnchor createAnchor(PrecisionPoint p) {
81
			if (p==null)
82
				// If the old terminal for the connection anchor cannot be resolved (by SlidableAnchor) a null
83
				// PrecisionPoint will passed in - this is handled here
84
				return createDefaultAnchor();
85
			return new AnchorHelper.IntersectionPointAnchor(this, p);
86
		}
87
	}
88
	
89
	public static class IntersectionPointAnchor extends SlidableAnchor{
90
91
		public IntersectionPointAnchor(IFigure fig, PrecisionPoint p) {
92
			super(fig,p);
93
		}
94
		
95
		public IntersectionPointAnchor(IFigure fig) {
96
			super(fig);
97
		}
98
		
99
		protected Point getLocation(Point ownReference, Point foreignReference) {
100
			PointList intersections = getIntersectionPoints(ownReference, foreignReference);
101
			if (intersections!=null && intersections.size()!=0) {
102
				int size = intersections.size();
103
				double dist = foreignReference.getDistance(ownReference);
104
				for(int i = 0; i < size; i ++){
105
					Point loc = intersections.getPoint(i);
106
					if(isInOrder(foreignReference,ownReference,dist, loc)){
107
						return loc;
108
					}
109
				}
110
				return intersections.getFirstPoint();
111
			}
112
			return null;
113
		}	
114
		
115
		private boolean isInOrder(Point start, Point end, double dist, Point loc) {
116
			double total = loc.getDistance(start);
117
			double dist2 = loc.getDistance(end);
118
			if(total < dist || total < dist2)
119
				return false;
120
			
121
			if(Math.abs(total - dist - dist2) < 0.01)
122
				return true;
123
			
124
			return false;
125
		}	
126
	}
127
128
	public static class FixedAnchorEx extends FixedAnchor {
129
130
		private int location;
131
132
		public FixedAnchorEx(IFigure f, int location) {
133
			super(f, location);
134
			this.location = location;
135
		}
136
137
		public Point getLocation(Point reference) {
138
			if(location == TOP)
139
				return getBox().getTop();
140
			else if(location == BOTTOM)
141
				return getBox().getBottom();
142
143
			return super.getLocation(reference);
144
		}
145
	}
146
	
147
	public static class SideAnchor extends SlidableAnchor{
148
149
		private boolean isRight;
150
151
		public SideAnchor(NodeFigure nodeFigure, PrecisionPoint pt,
152
				boolean isRight) {
153
			super(nodeFigure, pt);
154
			this.isRight = isRight;
155
		}
156
		
157
		public boolean isRight() {
158
			return isRight;
159
		}
160
		
161
		public String getTerminal() {
162
			String side = isRight? "R": "L";
163
			return super.getTerminal() + "{" + side + "}";
164
		}
165
	}
166
	
167
	public static class InnerPointAnchor extends SlidableAnchor{
168
		private PrecisionPoint percent;
169
		private IFigure figure;
170
171
		public InnerPointAnchor(IFigure fig, PrecisionPoint percent) {
172
			super(fig,percent);
173
			this.figure = fig;			
174
			this.percent = percent;
175
		}
176
		
177
		public static InnerPointAnchor createAnchorAtLocation(IFigure fig, PrecisionPoint loc) {
178
			PrecisionPoint p = loc.getPreciseCopy();			
179
			Rectangle b = fig.getBounds().getCopy();
180
			fig.translateToAbsolute(b);
181
						
182
			Dimension d = p.getDifference(b.getTopLeft());
183
			PrecisionPoint per = new PrecisionPoint( d.preciseWidth()/ b.width , d.preciseHeight() / b.height);
184
			return new InnerPointAnchor(fig, per);
185
		}
186
		
187
		protected Point getLocation(Point ownReference, Point foreignReference) {
188
			PrecisionRectangle bounds = new PrecisionRectangle(figure.getBounds());
189
			bounds.setPreciseWidth((bounds.width * percent.preciseX()));
190
			bounds.setPreciseHeight((bounds.height * percent.preciseY()));
191
			figure.translateToAbsolute(bounds);
192
			return bounds.getBottomRight();
193
		}	
194
	}
195
}
(-)src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/InteractionEditPart.java (-102 / +13 lines)
Lines 74-79 Link Here
74
import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
74
import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
75
import org.eclipse.papyrus.uml.diagram.common.providers.UIAdapterImpl;
75
import org.eclipse.papyrus.uml.diagram.common.providers.UIAdapterImpl;
76
import org.eclipse.papyrus.uml.diagram.common.util.MessageDirection;
76
import org.eclipse.papyrus.uml.diagram.common.util.MessageDirection;
77
import org.eclipse.papyrus.uml.diagram.sequence.edit.helpers.AnchorHelper;
77
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.InteractionItemSemanticEditPolicy;
78
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.InteractionItemSemanticEditPolicy;
78
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.SequenceGraphicalNodeEditPolicy;
79
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.SequenceGraphicalNodeEditPolicy;
79
import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
80
import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
Lines 273-336 Link Here
273
		return getContentPane();
274
		return getContentPane();
274
	}
275
	}
275
	
276
	
276
	static class SlidableAnchorEx extends SlidableAnchor{
277
		private PrecisionPoint percent;
278
		private IFigure figure;
279
280
		SlidableAnchorEx(IFigure fig, PrecisionPoint percent) {
281
			super(fig,percent);
282
			this.figure = fig;			
283
			this.percent = percent;
284
		}
285
		
286
		static SlidableAnchorEx createAnchorAtLocation(IFigure fig, PrecisionPoint loc) {
287
			PrecisionPoint p = loc.getPreciseCopy();			
288
			Rectangle b = fig.getBounds().getCopy();
289
			fig.translateToAbsolute(b);
290
						
291
			Dimension d = p.getDifference(b.getTopLeft());
292
			PrecisionPoint per = new PrecisionPoint( d.preciseWidth()/ b.width , d.preciseHeight() / b.height);
293
			return new SlidableAnchorEx(fig, per);
294
		}
295
		
296
		protected Point getLocation(Point ownReference, Point foreignReference) {
297
//			PointList intersections = getIntersectionPoints(ownReference, foreignReference);
298
//			if (intersections!=null && intersections.size()!=0) {
299
//				int size = intersections.size();
300
//				double dist = foreignReference.getDistance(ownReference);
301
//				for(int i = 0; i < size; i ++){
302
//					Point loc = intersections.getPoint(i);
303
//					if(isInOrder(foreignReference,ownReference,dist, loc)){
304
//						return loc;
305
//					}
306
//				}
307
//				return intersections.getFirstPoint();
308
//			}
309
//			return null;
310
			PrecisionRectangle bounds = new PrecisionRectangle(figure.getBounds());
311
			bounds.setPreciseWidth((bounds.width * percent.preciseX()));
312
			bounds.setPreciseHeight((bounds.height * percent.preciseY()));
313
			figure.translateToAbsolute(bounds);
314
			return bounds.getBottomRight();
315
		}	
316
		
317
//		public String getTerminal() {			
318
//			return super.getTerminal() ;
319
//		}
320
//		
321
//		private boolean isInOrder(Point start, Point end, double dist, Point loc) {
322
//			double total = loc.getDistance(start);
323
//			double dist2 = loc.getDistance(end);
324
//			if(total < dist || total < dist2)
325
//				return false;
326
//			
327
//			if(Math.abs(total - dist - dist2) < 0.01)
328
//				return true;
329
//			
330
//			return false;
331
//		}
332
	}
333
334
	/**
277
	/**
335
	 * @generated
278
	 * @generated
336
	 */
279
	 */
Lines 341-353 Link Here
341
		String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.HEIGHT);
284
		String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.HEIGHT);
342
		DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight)){
285
		DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight)){
343
			
286
			
344
//			protected ConnectionAnchor createAnchor(PrecisionPoint p) {
287
			protected ConnectionAnchor createAnchor(PrecisionPoint p) {
345
//				if (p==null)
288
				if (p==null)
346
//					// If the old terminal for the connection anchor cannot be resolved (by SlidableAnchor) a null
289
					// If the old terminal for the connection anchor cannot be resolved (by SlidableAnchor) a null
347
//					// PrecisionPoint will passed in - this is handled here
290
					// PrecisionPoint will passed in - this is handled here
348
//					return createDefaultAnchor();
291
					return createDefaultAnchor();
349
//				return new SlidableAnchorEx(this, p);
292
				return new AnchorHelper.IntersectionPointAnchor(this, p);
350
//			}
293
			}
351
		};
294
		};
352
295
353
		return result;
296
		return result;
Lines 1312-1321 Link Here
1312
	@Override
1255
	@Override
1313
	public ConnectionAnchor getSourceConnectionAnchor(ConnectionEditPart connEditPart) {	
1256
	public ConnectionAnchor getSourceConnectionAnchor(ConnectionEditPart connEditPart) {	
1314
		if(connEditPart instanceof Message7EditPart){
1257
		if(connEditPart instanceof Message7EditPart){
1315
			String terminal = getAnchorId(connEditPart,true);
1258
			String terminal = AnchorHelper.getAnchorId(getEditingDomain(), connEditPart,true);
1316
			if(terminal.length() > 0){
1259
			if(terminal.length() > 0){
1317
				PrecisionPoint pt = SlidableAnchor.parseTerminalString(terminal);
1260
				PrecisionPoint pt = SlidableAnchor.parseTerminalString(terminal);
1318
				return new SlidableAnchorEx(getFigure(),pt);
1261
				return new AnchorHelper.InnerPointAnchor(getFigure(),pt);
1319
			}
1262
			}
1320
		}		
1263
		}		
1321
		
1264
		
Lines 1347-1356 Link Here
1347
	public ConnectionAnchor getTargetConnectionAnchor(ConnectionEditPart connEditPart) {
1290
	public ConnectionAnchor getTargetConnectionAnchor(ConnectionEditPart connEditPart) {
1348
		
1291
		
1349
		if(connEditPart instanceof Message6EditPart){
1292
		if(connEditPart instanceof Message6EditPart){
1350
			String terminal = getAnchorId(connEditPart, false);
1293
			String terminal = AnchorHelper.getAnchorId(getEditingDomain(), connEditPart, false);
1351
			if(terminal.length() > 0){
1294
			if(terminal.length() > 0){
1352
				PrecisionPoint pt = SlidableAnchor.parseTerminalString(terminal);
1295
				PrecisionPoint pt = SlidableAnchor.parseTerminalString(terminal);
1353
				return new SlidableAnchorEx(getFigure(),pt);
1296
				return new AnchorHelper.InnerPointAnchor(getFigure(),pt);
1354
			}
1297
			}
1355
		}
1298
		}
1356
		
1299
		
Lines 1361-1398 Link Here
1361
//		}		
1304
//		}		
1362
		return targetConnectionAnchor;
1305
		return targetConnectionAnchor;
1363
	}	
1306
	}	
1364
	
1365
	private String getAnchorId(ConnectionEditPart connEditPart, final boolean isSource) {
1366
        final org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart connection = 
1367
            (org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart)connEditPart;
1368
        
1369
		String t = ""; //$NON-NLS-1$
1370
		try {
1371
			t = (String) getEditingDomain().runExclusive(
1372
				new RunnableWithResult.Impl() {
1373
1374
				public void run() {
1375
					Anchor a = null;
1376
					if(isSource)
1377
						a = ((Edge)connection.getModel()).getSourceAnchor();
1378
					else
1379
						a = ((Edge)connection.getModel()).getTargetAnchor();
1380
					if (a instanceof IdentityAnchor)
1381
						setResult(((IdentityAnchor) a).getId());
1382
                    else
1383
                        setResult(""); //$NON-NLS-1$
1384
				}
1385
			});
1386
		} catch (InterruptedException e) {
1387
			Trace.catching(DiagramUIPlugin.getInstance(),
1388
				DiagramUIDebugOptions.EXCEPTIONS_CATCHING, getClass(),
1389
				"getTargetConnectionAnchor", e); //$NON-NLS-1$
1390
			Log.error(DiagramUIPlugin.getInstance(),
1391
				DiagramUIStatusCodes.IGNORED_EXCEPTION_WARNING,
1392
				"getTargetConnectionAnchor", e); //$NON-NLS-1$
1393
		}
1394
		return t;
1395
	}
1396
1307
1397
	/**
1308
	/**
1398
	 * Create Anchor
1309
	 * Create Anchor
Lines 1444-1450 Link Here
1444
	 */
1355
	 */
1445
	private ConnectionAnchor createAnchor(Point location) {
1356
	private ConnectionAnchor createAnchor(Point location) {
1446
		//return new SlidableAnchor(getFigure(), BaseSlidableAnchor.getAnchorRelativeLocation(location, getFigure().getBounds()));
1357
		//return new SlidableAnchor(getFigure(), BaseSlidableAnchor.getAnchorRelativeLocation(location, getFigure().getBounds()));
1447
		return SlidableAnchorEx.createAnchorAtLocation(getFigure(), new PrecisionPoint(location));
1358
		return AnchorHelper.InnerPointAnchor.createAnchorAtLocation(getFigure(), new PrecisionPoint(location));
1448
	}		
1359
	}		
1449
1360
1450
}
1361
}
(-)src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/BehaviorExecutionSpecificationEditPart.java (-13 / +7 lines)
Lines 21-31 Link Here
21
import org.eclipse.draw2d.DelegatingLayout;
21
import org.eclipse.draw2d.DelegatingLayout;
22
import org.eclipse.draw2d.IFigure;
22
import org.eclipse.draw2d.IFigure;
23
import org.eclipse.draw2d.PositionConstants;
23
import org.eclipse.draw2d.PositionConstants;
24
import org.eclipse.draw2d.RectangleFigure;
25
import org.eclipse.draw2d.Shape;
24
import org.eclipse.draw2d.Shape;
26
import org.eclipse.draw2d.StackLayout;
27
import org.eclipse.draw2d.geometry.Dimension;
28
import org.eclipse.draw2d.geometry.PrecisionPoint;
29
import org.eclipse.emf.ecore.EStructuralFeature;
25
import org.eclipse.emf.ecore.EStructuralFeature;
30
import org.eclipse.gef.ConnectionEditPart;
26
import org.eclipse.gef.ConnectionEditPart;
31
import org.eclipse.gef.EditPart;
27
import org.eclipse.gef.EditPart;
Lines 38-50 Link Here
38
import org.eclipse.gef.requests.CreateRequest;
34
import org.eclipse.gef.requests.CreateRequest;
39
import org.eclipse.gef.requests.ReconnectRequest;
35
import org.eclipse.gef.requests.ReconnectRequest;
40
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
36
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
41
import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
42
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
37
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
43
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeConnectionRequest;
38
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeConnectionRequest;
44
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeRequest;
39
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeRequest;
45
import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
40
import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
46
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
41
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
47
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
48
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
42
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
49
import org.eclipse.gmf.runtime.notation.NotationPackage;
43
import org.eclipse.gmf.runtime.notation.NotationPackage;
50
import org.eclipse.gmf.runtime.notation.View;
44
import org.eclipse.gmf.runtime.notation.View;
Lines 53-59 Link Here
53
import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter;
47
import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter;
54
import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
48
import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
55
import org.eclipse.papyrus.uml.diagram.common.draw2d.anchors.FixedAnchor;
49
import org.eclipse.papyrus.uml.diagram.common.draw2d.anchors.FixedAnchor;
56
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.AbstractExecutionSpecificationEditPart.FillParentLocator;
50
import org.eclipse.papyrus.uml.diagram.sequence.edit.helpers.AnchorHelper;
57
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.BehaviorExecutionSpecificationItemSemanticEditPolicy;
51
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.BehaviorExecutionSpecificationItemSemanticEditPolicy;
58
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.ElementCreationWithMessageEditPolicy;
52
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.ElementCreationWithMessageEditPolicy;
59
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.ExecutionSpecificationComponentEditPolicy;
53
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.ExecutionSpecificationComponentEditPolicy;
Lines 1040-1046 Link Here
1040
				if(UMLElementTypes.Message_4003.equals(obj)) {
1034
				if(UMLElementTypes.Message_4003.equals(obj)) {
1041
					// Sync Message
1035
					// Sync Message
1042
					if(!createRequest.getTargetEditPart().equals(createRequest.getSourceEditPart())) {
1036
					if(!createRequest.getTargetEditPart().equals(createRequest.getSourceEditPart())) {
1043
						return new FixedAnchor(getFigure(), FixedAnchor.TOP);
1037
						return new AnchorHelper.FixedAnchorEx(getFigure(), FixedAnchor.TOP);
1044
					}
1038
					}
1045
					// otherwise, this is a recursive call, let destination free
1039
					// otherwise, this is a recursive call, let destination free
1046
				}
1040
				}
Lines 1050-1056 Link Here
1050
			ConnectionEditPart connectionEditPart = reconnectRequest.getConnectionEditPart();
1044
			ConnectionEditPart connectionEditPart = reconnectRequest.getConnectionEditPart();
1051
			if(connectionEditPart instanceof MessageEditPart) {
1045
			if(connectionEditPart instanceof MessageEditPart) {
1052
				// Sync Message
1046
				// Sync Message
1053
				return new FixedAnchor(getFigure(), FixedAnchor.TOP);
1047
				return new AnchorHelper.FixedAnchorEx(getFigure(), FixedAnchor.TOP);
1054
			}
1048
			}
1055
		}
1049
		}
1056
1050
Lines 1069-1075 Link Here
1069
	public ConnectionAnchor getTargetConnectionAnchor(ConnectionEditPart connEditPart) {
1063
	public ConnectionAnchor getTargetConnectionAnchor(ConnectionEditPart connEditPart) {
1070
		if(connEditPart instanceof MessageEditPart) {
1064
		if(connEditPart instanceof MessageEditPart) {
1071
			// Sync Message
1065
			// Sync Message
1072
			return new FixedAnchor(getFigure(), FixedAnchor.TOP);
1066
			return new AnchorHelper.FixedAnchorEx(getFigure(), FixedAnchor.TOP);
1073
		}
1067
		}
1074
		return super.getTargetConnectionAnchor(connEditPart);
1068
		return super.getTargetConnectionAnchor(connEditPart);
1075
	}
1069
	}
Lines 1090-1096 Link Here
1090
			for(Object obj : relationshipTypes) {
1084
			for(Object obj : relationshipTypes) {
1091
				if(UMLElementTypes.Message_4005.equals(obj)) {
1085
				if(UMLElementTypes.Message_4005.equals(obj)) {
1092
					// Reply Message
1086
					// Reply Message
1093
					return new FixedAnchor(getFigure(), FixedAnchor.BOTTOM);
1087
					return new AnchorHelper.FixedAnchorEx(getFigure(), FixedAnchor.BOTTOM);
1094
				}
1088
				}
1095
			}
1089
			}
1096
		} else if(request instanceof ReconnectRequest) {
1090
		} else if(request instanceof ReconnectRequest) {
Lines 1098-1104 Link Here
1098
			ConnectionEditPart connectionEditPart = reconnectRequest.getConnectionEditPart();
1092
			ConnectionEditPart connectionEditPart = reconnectRequest.getConnectionEditPart();
1099
			if(connectionEditPart instanceof Message3EditPart) {
1093
			if(connectionEditPart instanceof Message3EditPart) {
1100
				// Reply Message
1094
				// Reply Message
1101
				return new FixedAnchor(getFigure(), FixedAnchor.BOTTOM);
1095
				return new AnchorHelper.FixedAnchorEx(getFigure(), FixedAnchor.BOTTOM);
1102
			}
1096
			}
1103
		}
1097
		}
1104
		return super.getSourceConnectionAnchor(request);
1098
		return super.getSourceConnectionAnchor(request);
Lines 1116-1122 Link Here
1116
	public ConnectionAnchor getSourceConnectionAnchor(ConnectionEditPart connEditPart) {
1110
	public ConnectionAnchor getSourceConnectionAnchor(ConnectionEditPart connEditPart) {
1117
		if(connEditPart instanceof Message3EditPart) {
1111
		if(connEditPart instanceof Message3EditPart) {
1118
			// Reply Message
1112
			// Reply Message
1119
			return new FixedAnchor(getFigure(), FixedAnchor.BOTTOM);
1113
			return new AnchorHelper.FixedAnchorEx(getFigure(), FixedAnchor.BOTTOM);
1120
		}
1114
		}
1121
		return super.getSourceConnectionAnchor(connEditPart);
1115
		return super.getSourceConnectionAnchor(connEditPart);
1122
	}
1116
	}
(-)src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/LifelineEditPart.java (-67 / +7 lines)
Lines 53-59 Link Here
53
import org.eclipse.gef.requests.ChangeBoundsRequest;
53
import org.eclipse.gef.requests.ChangeBoundsRequest;
54
import org.eclipse.gef.requests.CreateConnectionRequest;
54
import org.eclipse.gef.requests.CreateConnectionRequest;
55
import org.eclipse.gef.requests.CreateRequest;
55
import org.eclipse.gef.requests.CreateRequest;
56
import org.eclipse.gef.requests.DropRequest;
57
import org.eclipse.gef.requests.ReconnectRequest;
56
import org.eclipse.gef.requests.ReconnectRequest;
58
import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
57
import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
59
import org.eclipse.gmf.runtime.common.core.command.ICommand;
58
import org.eclipse.gmf.runtime.common.core.command.ICommand;
Lines 104-109 Link Here
104
import org.eclipse.papyrus.uml.diagram.common.editpolicies.BorderItemResizableEditPolicy;
103
import org.eclipse.papyrus.uml.diagram.common.editpolicies.BorderItemResizableEditPolicy;
105
import org.eclipse.papyrus.uml.diagram.common.figure.node.RectangularShadowBorder;
104
import org.eclipse.papyrus.uml.diagram.common.figure.node.RectangularShadowBorder;
106
import org.eclipse.papyrus.uml.diagram.common.providers.UIAdapterImpl;
105
import org.eclipse.papyrus.uml.diagram.common.providers.UIAdapterImpl;
106
import org.eclipse.papyrus.uml.diagram.sequence.edit.helpers.AnchorHelper;
107
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.CustomDiagramDragDropEditPolicy;
107
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.CustomDiagramDragDropEditPolicy;
108
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.ElementCreationWithMessageEditPolicy;
108
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.ElementCreationWithMessageEditPolicy;
109
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.LifelineAppliedStereotypeNodeLabelDisplayEditPolicy;
109
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.LifelineAppliedStereotypeNodeLabelDisplayEditPolicy;
Lines 1898-1904 Link Here
1898
		}
1898
		}
1899
		
1899
		
1900
		if(connEditPart instanceof Message2EditPart){
1900
		if(connEditPart instanceof Message2EditPart){
1901
			String terminal = getTargetAnchorId(connEditPart);
1901
			String terminal = AnchorHelper.getAnchorId(getEditingDomain(), connEditPart, false);
1902
			if(terminal.length() > 0){
1902
			if(terminal.length() > 0){
1903
				int start = terminal.indexOf("{") + 1;
1903
				int start = terminal.indexOf("{") + 1;
1904
				PrecisionPoint pt = SlidableAnchor.parseTerminalString(terminal);
1904
				PrecisionPoint pt = SlidableAnchor.parseTerminalString(terminal);
Lines 1913-1952 Link Here
1913
					if(list.getPoint(0).x > list.getPoint(1).x)
1913
					if(list.getPoint(0).x > list.getPoint(1).x)
1914
						rightHand = false;
1914
						rightHand = false;
1915
				}
1915
				}
1916
				return new SlidableAnchorEx(getNodeFigure(), pt, rightHand);	
1916
				return new AnchorHelper.SideAnchor(getNodeFigure(), pt, rightHand);	
1917
			}
1917
			}
1918
		}		
1918
		}		
1919
		return super.getTargetConnectionAnchor(connEditPart);
1919
		return super.getTargetConnectionAnchor(connEditPart);
1920
	}
1920
	}
1921
1921
1922
	private String getTargetAnchorId(ConnectionEditPart connEditPart) {
1923
        final org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart connection = 
1924
            (org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart)connEditPart;
1925
        
1926
		String t = ""; //$NON-NLS-1$
1927
		try {
1928
			t = (String) getEditingDomain().runExclusive(
1929
				new RunnableWithResult.Impl() {
1930
1931
				public void run() {
1932
					Anchor a = ((Edge)connection.getModel()).getTargetAnchor();
1933
					if (a instanceof IdentityAnchor)
1934
						setResult(((IdentityAnchor) a).getId());
1935
                    else
1936
                        setResult(""); //$NON-NLS-1$
1937
				}
1938
			});
1939
		} catch (InterruptedException e) {
1940
			Trace.catching(DiagramUIPlugin.getInstance(),
1941
				DiagramUIDebugOptions.EXCEPTIONS_CATCHING, getClass(),
1942
				"getTargetConnectionAnchor", e); //$NON-NLS-1$
1943
			Log.error(DiagramUIPlugin.getInstance(),
1944
				DiagramUIStatusCodes.IGNORED_EXCEPTION_WARNING,
1945
				"getTargetConnectionAnchor", e); //$NON-NLS-1$
1946
		}
1947
		return t;
1948
	}
1949
	
1950
	/**
1922
	/**
1951
	 * Create specific anchor to handle connection on top, on center and on bottom of the lifeline
1923
	 * Create specific anchor to handle connection on top, on center and on bottom of the lifeline
1952
	 */
1924
	 */
Lines 1970-1982 Link Here
1970
1942
1971
		ConnectionAnchor anchor = super.getTargetConnectionAnchor(request);
1943
		ConnectionAnchor anchor = super.getTargetConnectionAnchor(request);
1972
		if(anchor instanceof SlidableAnchor) {
1944
		if(anchor instanceof SlidableAnchor) {
1973
			return createSlidableAnchorEx(request, (SlidableAnchor)anchor);
1945
			return createSideAnchor(request, (SlidableAnchor)anchor);
1974
		}
1946
		}
1975
		return anchor;
1947
		return anchor;
1976
	}
1948
	}
1977
1949
1978
	protected ConnectionAnchor createSlidableAnchorEx(Request request, SlidableAnchor sa) {
1950
	protected ConnectionAnchor createSideAnchor(Request request, SlidableAnchor sa) {
1979
		Point loc = getRequestLocation(request);
1951
		Point loc = AnchorHelper.getRequestLocation(request);
1980
		if(loc == null)
1952
		if(loc == null)
1981
			return sa;
1953
			return sa;
1982
		
1954
		
Lines 1987-2007 Link Here
1987
		boolean rightHand = true;
1959
		boolean rightHand = true;
1988
		if(loc.x < bounds.getCenter().x)
1960
		if(loc.x < bounds.getCenter().x)
1989
			rightHand = false;
1961
			rightHand = false;
1990
		return new SlidableAnchorEx(getNodeFigure(), pt, rightHand);
1962
		return new AnchorHelper.SideAnchor(getNodeFigure(), pt, rightHand);
1991
	}
1963
	}
1992
	
1964
	
1993
	private Point getRequestLocation(Request request){
1994
		if (request instanceof ReconnectRequest) {
1995
			if (((DropRequest) request).getLocation() != null) {
1996
				Point pt = ((DropRequest) request).getLocation().getCopy();
1997
				return pt;
1998
			}
1999
		}
2000
		else if (request instanceof DropRequest){
2001
			return 	((DropRequest) request).getLocation();
2002
		}
2003
		return null;
2004
	}
2005
1965
2006
	/**
1966
	/**
2007
	 * Create the dashLine figure
1967
	 * Create the dashLine figure
Lines 2206-2231 Link Here
2206
		return null;
2166
		return null;
2207
	}
2167
	}
2208
	
2168
	
2209
	public static class SlidableAnchorEx extends SlidableAnchor{
2210
2211
		private boolean isRight;
2212
2213
		public SlidableAnchorEx(NodeFigure nodeFigure, PrecisionPoint pt,
2214
				boolean isRight) {
2215
			super(nodeFigure, pt);
2216
			this.isRight = isRight;
2217
		}
2218
		
2219
		public boolean isRight() {
2220
			return isRight;
2221
		}
2222
		
2223
		public String getTerminal() {
2224
			String side = isRight? "R": "L";
2225
			return super.getTerminal() + "{" + side + "}";
2226
		}
2227
	}
2228
	
2229
	public static class PreserveAnchorsPositionCommandEx extends PreserveAnchorsPositionCommand{
2169
	public static class PreserveAnchorsPositionCommandEx extends PreserveAnchorsPositionCommand{
2230
2170
2231
		public PreserveAnchorsPositionCommandEx(ShapeNodeEditPart shapeEP, Dimension sizeDelta, int preserveAxis) {
2171
		public PreserveAnchorsPositionCommandEx(ShapeNodeEditPart shapeEP, Dimension sizeDelta, int preserveAxis) {
(-)src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/ActionExecutionSpecificationEditPart.java (-17 / +7 lines)
Lines 17-37 Link Here
17
import java.util.LinkedList;
17
import java.util.LinkedList;
18
import java.util.List;
18
import java.util.List;
19
19
20
import org.eclipse.draw2d.BorderLayout;
21
import org.eclipse.draw2d.ConnectionAnchor;
20
import org.eclipse.draw2d.ConnectionAnchor;
22
import org.eclipse.draw2d.DelegatingLayout;
21
import org.eclipse.draw2d.DelegatingLayout;
23
import org.eclipse.draw2d.Graphics;
24
import org.eclipse.draw2d.IClippingStrategy;
25
import org.eclipse.draw2d.IFigure;
22
import org.eclipse.draw2d.IFigure;
26
import org.eclipse.draw2d.Locator;
27
import org.eclipse.draw2d.PositionConstants;
23
import org.eclipse.draw2d.PositionConstants;
28
import org.eclipse.draw2d.RectangleFigure;
29
import org.eclipse.draw2d.Shape;
24
import org.eclipse.draw2d.Shape;
30
import org.eclipse.draw2d.StackLayout;
31
import org.eclipse.draw2d.XYLayout;
32
import org.eclipse.draw2d.geometry.Dimension;
33
import org.eclipse.draw2d.geometry.PrecisionPoint;
34
import org.eclipse.draw2d.geometry.Rectangle;
35
import org.eclipse.emf.ecore.EStructuralFeature;
25
import org.eclipse.emf.ecore.EStructuralFeature;
36
import org.eclipse.gef.ConnectionEditPart;
26
import org.eclipse.gef.ConnectionEditPart;
37
import org.eclipse.gef.EditPart;
27
import org.eclipse.gef.EditPart;
Lines 49-55 Link Here
49
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeRequest;
39
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeRequest;
50
import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
40
import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
51
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
41
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
52
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
53
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
42
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
54
import org.eclipse.gmf.runtime.notation.NotationPackage;
43
import org.eclipse.gmf.runtime.notation.NotationPackage;
55
import org.eclipse.gmf.runtime.notation.View;
44
import org.eclipse.gmf.runtime.notation.View;
Lines 58-63 Link Here
58
import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter;
47
import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter;
59
import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
48
import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
60
import org.eclipse.papyrus.uml.diagram.common.draw2d.anchors.FixedAnchor;
49
import org.eclipse.papyrus.uml.diagram.common.draw2d.anchors.FixedAnchor;
50
import org.eclipse.papyrus.uml.diagram.sequence.edit.helpers.AnchorHelper;
61
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.ActionExecutionSpecificationItemSemanticEditPolicy;
51
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.ActionExecutionSpecificationItemSemanticEditPolicy;
62
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.ElementCreationWithMessageEditPolicy;
52
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.ElementCreationWithMessageEditPolicy;
63
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.ExecutionSpecificationComponentEditPolicy;
53
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.ExecutionSpecificationComponentEditPolicy;
Lines 1047-1053 Link Here
1047
				if(UMLElementTypes.Message_4003.equals(obj)) {
1037
				if(UMLElementTypes.Message_4003.equals(obj)) {
1048
					// Sync Message
1038
					// Sync Message
1049
					if(!createRequest.getTargetEditPart().equals(createRequest.getSourceEditPart())) {
1039
					if(!createRequest.getTargetEditPart().equals(createRequest.getSourceEditPart())) {
1050
						return new FixedAnchor(getFigure(), FixedAnchor.TOP);
1040
						return new AnchorHelper.FixedAnchorEx(getFigure(), FixedAnchor.TOP);
1051
					}
1041
					}
1052
					// otherwise, this is a recursive call, let destination free
1042
					// otherwise, this is a recursive call, let destination free
1053
				}
1043
				}
Lines 1057-1063 Link Here
1057
			ConnectionEditPart connectionEditPart = reconnectRequest.getConnectionEditPart();
1047
			ConnectionEditPart connectionEditPart = reconnectRequest.getConnectionEditPart();
1058
			if(connectionEditPart instanceof MessageEditPart) {
1048
			if(connectionEditPart instanceof MessageEditPart) {
1059
				// Sync Message
1049
				// Sync Message
1060
				return new FixedAnchor(getFigure(), FixedAnchor.TOP);
1050
				return new AnchorHelper.FixedAnchorEx(getFigure(), FixedAnchor.TOP);
1061
			}
1051
			}
1062
		}
1052
		}
1063
1053
Lines 1076-1082 Link Here
1076
	public ConnectionAnchor getTargetConnectionAnchor(ConnectionEditPart connEditPart) {
1066
	public ConnectionAnchor getTargetConnectionAnchor(ConnectionEditPart connEditPart) {
1077
		if(connEditPart instanceof MessageEditPart) {
1067
		if(connEditPart instanceof MessageEditPart) {
1078
			// Sync Message
1068
			// Sync Message
1079
			return new FixedAnchor(getFigure(), FixedAnchor.TOP);
1069
			return new AnchorHelper.FixedAnchorEx(getFigure(), FixedAnchor.TOP);
1080
		}
1070
		}
1081
		return super.getTargetConnectionAnchor(connEditPart);
1071
		return super.getTargetConnectionAnchor(connEditPart);
1082
	}
1072
	}
Lines 1097-1103 Link Here
1097
			for(Object obj : relationshipTypes) {
1087
			for(Object obj : relationshipTypes) {
1098
				if(UMLElementTypes.Message_4005.equals(obj)) {
1088
				if(UMLElementTypes.Message_4005.equals(obj)) {
1099
					// Reply Message
1089
					// Reply Message
1100
					return new FixedAnchor(getFigure(), FixedAnchor.BOTTOM);
1090
					return new AnchorHelper.FixedAnchorEx(getFigure(), FixedAnchor.BOTTOM);
1101
				}
1091
				}
1102
			}
1092
			}
1103
		} else if(request instanceof ReconnectRequest) {
1093
		} else if(request instanceof ReconnectRequest) {
Lines 1105-1111 Link Here
1105
			ConnectionEditPart connectionEditPart = reconnectRequest.getConnectionEditPart();
1095
			ConnectionEditPart connectionEditPart = reconnectRequest.getConnectionEditPart();
1106
			if(connectionEditPart instanceof Message3EditPart) {
1096
			if(connectionEditPart instanceof Message3EditPart) {
1107
				// Reply Message
1097
				// Reply Message
1108
				return new FixedAnchor(getFigure(), FixedAnchor.BOTTOM);
1098
				return new AnchorHelper.FixedAnchorEx(getFigure(), FixedAnchor.BOTTOM);
1109
			}
1099
			}
1110
		}
1100
		}
1111
		return super.getSourceConnectionAnchor(request);
1101
		return super.getSourceConnectionAnchor(request);
Lines 1123-1129 Link Here
1123
	public ConnectionAnchor getSourceConnectionAnchor(ConnectionEditPart connEditPart) {
1113
	public ConnectionAnchor getSourceConnectionAnchor(ConnectionEditPart connEditPart) {
1124
		if(connEditPart instanceof Message3EditPart) {
1114
		if(connEditPart instanceof Message3EditPart) {
1125
			// Reply Message
1115
			// Reply Message
1126
			return new FixedAnchor(getFigure(), FixedAnchor.BOTTOM);
1116
			return new AnchorHelper.FixedAnchorEx(getFigure(), FixedAnchor.BOTTOM);
1127
		}
1117
		}
1128
		return super.getSourceConnectionAnchor(connEditPart);
1118
		return super.getSourceConnectionAnchor(connEditPart);
1129
	}
1119
	}
(-)src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/ConsiderIgnoreFragmentEditPart.java (-1 / +2 lines)
Lines 46-51 Link Here
46
import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
46
import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
47
import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
47
import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
48
import org.eclipse.papyrus.uml.diagram.common.providers.UIAdapterImpl;
48
import org.eclipse.papyrus.uml.diagram.common.providers.UIAdapterImpl;
49
import org.eclipse.papyrus.uml.diagram.sequence.edit.helpers.AnchorHelper;
49
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.CombinedFragmentItemComponentEditPolicy;
50
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.CombinedFragmentItemComponentEditPolicy;
50
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.ConsiderIgnoreFragmentItemSemanticEditPolicy;
51
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.ConsiderIgnoreFragmentItemSemanticEditPolicy;
51
import org.eclipse.papyrus.uml.diagram.sequence.figures.CombinedFragmentFigure;
52
import org.eclipse.papyrus.uml.diagram.sequence.figures.CombinedFragmentFigure;
Lines 164-170 Link Here
164
		IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
165
		IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
165
		String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.WIDTH);
166
		String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.WIDTH);
166
		String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.HEIGHT);
167
		String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.HEIGHT);
167
		DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
168
		DefaultSizeNodeFigure result = new AnchorHelper.CombinedFragmentNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
168
169
169
		return result;
170
		return result;
170
	}
171
	}
(-)src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CombinedFragmentEditPart.java (-2 / +9 lines)
Lines 21-31 Link Here
21
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
21
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
22
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
22
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
23
import org.eclipse.core.runtime.preferences.InstanceScope;
23
import org.eclipse.core.runtime.preferences.InstanceScope;
24
import org.eclipse.draw2d.ConnectionAnchor;
24
import org.eclipse.draw2d.IFigure;
25
import org.eclipse.draw2d.IFigure;
25
import org.eclipse.draw2d.Shape;
26
import org.eclipse.draw2d.Shape;
26
import org.eclipse.draw2d.StackLayout;
27
import org.eclipse.draw2d.StackLayout;
27
import org.eclipse.draw2d.geometry.Dimension;
28
import org.eclipse.draw2d.geometry.Dimension;
28
import org.eclipse.draw2d.geometry.Point;
29
import org.eclipse.draw2d.geometry.Point;
30
import org.eclipse.draw2d.geometry.PrecisionPoint;
29
import org.eclipse.draw2d.geometry.Rectangle;
31
import org.eclipse.draw2d.geometry.Rectangle;
30
import org.eclipse.emf.common.notify.Notification;
32
import org.eclipse.emf.common.notify.Notification;
31
import org.eclipse.emf.common.util.EList;
33
import org.eclipse.emf.common.util.EList;
Lines 38-43 Link Here
38
import org.eclipse.emf.transaction.RunnableWithResult;
40
import org.eclipse.emf.transaction.RunnableWithResult;
39
import org.eclipse.emf.transaction.TransactionalEditingDomain;
41
import org.eclipse.emf.transaction.TransactionalEditingDomain;
40
import org.eclipse.emf.transaction.util.TransactionUtil;
42
import org.eclipse.emf.transaction.util.TransactionUtil;
43
import org.eclipse.gef.ConnectionEditPart;
41
import org.eclipse.gef.EditPart;
44
import org.eclipse.gef.EditPart;
42
import org.eclipse.gef.EditPolicy;
45
import org.eclipse.gef.EditPolicy;
43
import org.eclipse.gef.Request;
46
import org.eclipse.gef.Request;
Lines 61-68 Link Here
61
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
64
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
62
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
65
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
63
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
66
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
67
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElementRequest;
64
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
68
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
65
import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
69
import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
70
import org.eclipse.gmf.runtime.draw2d.ui.figures.BaseSlidableAnchor;
66
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
71
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
67
import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
72
import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
68
import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
73
import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
Lines 73-78 Link Here
73
import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
78
import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
74
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
79
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
75
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
80
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
81
import org.eclipse.gmf.runtime.gef.ui.figures.SlidableAnchor;
76
import org.eclipse.gmf.runtime.gef.ui.internal.parts.TextCellEditorEx;
82
import org.eclipse.gmf.runtime.gef.ui.internal.parts.TextCellEditorEx;
77
import org.eclipse.gmf.runtime.notation.Bounds;
83
import org.eclipse.gmf.runtime.notation.Bounds;
78
import org.eclipse.gmf.runtime.notation.FillStyle;
84
import org.eclipse.gmf.runtime.notation.FillStyle;
Lines 92-97 Link Here
92
import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
98
import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
93
import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusNodeFigure;
99
import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusNodeFigure;
94
import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
100
import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper;
101
import org.eclipse.papyrus.uml.diagram.sequence.edit.helpers.AnchorHelper;
95
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.CombinedFragmentItemComponentEditPolicy;
102
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.CombinedFragmentItemComponentEditPolicy;
96
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.CombinedFragmentItemSemanticEditPolicy;
103
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.CombinedFragmentItemSemanticEditPolicy;
97
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.SequenceGraphicalNodeEditPolicy;
104
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.SequenceGraphicalNodeEditPolicy;
Lines 103-108 Link Here
103
import org.eclipse.papyrus.uml.diagram.sequence.util.CommandHelper;
110
import org.eclipse.papyrus.uml.diagram.sequence.util.CommandHelper;
104
import org.eclipse.papyrus.uml.diagram.sequence.util.InteractionOperatorKindCompatibleMapping;
111
import org.eclipse.papyrus.uml.diagram.sequence.util.InteractionOperatorKindCompatibleMapping;
105
import org.eclipse.papyrus.uml.diagram.sequence.util.LifelineCoveredByUpdater;
112
import org.eclipse.papyrus.uml.diagram.sequence.util.LifelineCoveredByUpdater;
113
import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceRequestConstant;
106
import org.eclipse.swt.SWT;
114
import org.eclipse.swt.SWT;
107
import org.eclipse.swt.graphics.Color;
115
import org.eclipse.swt.graphics.Color;
108
import org.eclipse.swt.widgets.Display;
116
import org.eclipse.swt.widgets.Display;
Lines 287-293 Link Here
287
		IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
295
		IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
288
		String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.WIDTH);
296
		String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.WIDTH);
289
		String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.HEIGHT);
297
		String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferenceConstantHelper.HEIGHT);
290
		DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
298
		DefaultSizeNodeFigure result = new AnchorHelper.CombinedFragmentNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight)) ;
291
299
292
		return result;
300
		return result;
293
	}
301
	}
Lines 1642-1646 Link Here
1642
			return null;
1650
			return null;
1643
		}
1651
		}
1644
	}
1652
	}
1645
	
1646
}
1653
}

Return to bug 377501