blob: 2dcf0510f93fa88ad631ce5c8ccecb26076fc954 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
/*****************************************************************************
* Copyright (c) 2017 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* CEA LIST - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.sequence.figures;
import org.eclipse.draw2d.ConnectionAnchor;
import org.eclipse.draw2d.PositionConstants;
import org.eclipse.draw2d.geometry.PrecisionPoint;
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.LinkLFSVGNodePlateFigure;
import org.eclipse.papyrus.uml.diagram.sequence.anchors.AnchorConstants;
import org.eclipse.papyrus.uml.diagram.sequence.anchors.NodeBottomAnchor;
import org.eclipse.papyrus.uml.diagram.sequence.anchors.NodeTopAnchor;
import org.eclipse.papyrus.uml.diagram.sequence.edit.helpers.AnchorHelper;
/**
* @since 3.0
*
*/
public class ExecutionSpecificationNodePlate extends LinkLFSVGNodePlateFigure implements ILifelineInternalFigure {
/**
* Constructor.
*
* @param hostEP
* @param width
* @param height
*/
public ExecutionSpecificationNodePlate(GraphicalEditPart hostEP, int width, int height) {
super(hostEP, width, height);
}
/**
* @see org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure#isDefaultAnchorArea(org.eclipse.draw2d.geometry.PrecisionPoint)
*/
@Override
protected boolean isDefaultAnchorArea(PrecisionPoint p) {
return false;
}
@Override
public ConnectionAnchor getConnectionAnchor(String terminal) {
if (AnchorConstants.START_TERMINAL.equals(terminal)) {
return new NodeTopAnchor(this);
} else if (AnchorConstants.END_TERMINAL.equals(terminal)) {
return new NodeBottomAnchor(this);
}
// Use FixedAnchorEx for MessageSync, this will be invoked by mapConnectionAnchor(termial) operation.
if (terminal != null && terminal.indexOf("{") != -1 && terminal.indexOf("}") != -1) {
int position = AnchorHelper.FixedAnchorEx.parsePosition(terminal);
if (PositionConstants.TOP == position || PositionConstants.BOTTOM == position) {
return new AnchorHelper.FixedAnchorEx(this, position);
}
}
return super.getConnectionAnchor(terminal);
}
@Override
public String getConnectionAnchorTerminal(ConnectionAnchor c) {
if (c instanceof NodeTopAnchor) {
return AnchorConstants.START_TERMINAL;
} else if (c instanceof NodeBottomAnchor) {
return AnchorConstants.END_TERMINAL;
}
return super.getConnectionAnchorTerminal(c);
}
}
|