Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: eb51cb32a7dc40a52be8bcc73cb50cb9c5894f37 (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
/*****************************************************************************
 * 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 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * 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.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) {
		// 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);
	}
}

Back to the top