Java Code Examples for org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart#getConnectionFigure()

The following examples show how to use org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart#getConnectionFigure() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FixedBendpointEditPolicy.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
protected void eraseChangeBoundsFeedback(ChangeBoundsRequest request) {
	connectionStart = true;
	router.commitBoxDrag();
	for (ConnectionEditPart connectionEditPart : getAllConnectionParts(request)) {
		List<?> children = connectionEditPart.getChildren();
		Connection connection = connectionEditPart.getConnectionFigure();
		for (Object child : children) {
			if (child instanceof ExternalXtextLabelEditPart) {
				IFigure figure = ((ExternalXtextLabelEditPart) child).getFigure();
				Object currentConstraint = connection.getLayoutManager().getConstraint(figure);
				if (currentConstraint instanceof EdgeLabelLocator) {
					EdgeLabelLocator edgeLabelLocator = (EdgeLabelLocator) currentConstraint;
					edgeLabelLocator.eraseFeedbackData();
				}
			}
		}
	}

}
 
Example 2
Source File: FixedBendpointEditPolicy.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
@SuppressWarnings("restriction")
protected Command getBendpointsChangedCommand(ConnectionEditPart part) {
	Connection connection = part.getConnectionFigure();
	Point ptRef1 = connection.getSourceAnchor().getReferencePoint();
	connection.translateToRelative(ptRef1);

	Point ptRef2 = connection.getTargetAnchor().getReferencePoint();
	connection.translateToRelative(ptRef2);

	TransactionalEditingDomain editingDomain = getHost().getEditingDomain();

	SetConnectionBendpointsAndLabelCommmand sbbCommand = new SetConnectionBendpointsAndLabelCommmand(editingDomain);
	sbbCommand.setEdgeAdapter(new EObjectAdapter((EObject) part.getModel()));
	sbbCommand.setNewPointList(connection.getPoints(), ptRef1, ptRef2);
	sbbCommand.setLabelsToUpdate(part, getInitialPoints(connection));

	return new ICommandProxy(sbbCommand);
}
 
Example 3
Source File: FixedBendpointEditPolicy.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
private void showLineFeedback(ConnectionEditPart connectionEditPart) {
	// XXX: copied from InitialPointsOfRequestDataManager
	List<?> children = connectionEditPart.getChildren();
	Connection connection = connectionEditPart.getConnectionFigure();
	for (Object child : children) {
		if (child instanceof ExternalXtextLabelEditPart) {
			IFigure figure = ((ExternalXtextLabelEditPart) child).getFigure();
			Object currentConstraint = connection.getLayoutManager().getConstraint(figure);
			if (currentConstraint instanceof EdgeLabelLocator) {
				EdgeLabelLocator edgeLabelLocator = (EdgeLabelLocator) currentConstraint;
				edgeLabelLocator.setFeedbackData(getInitialPoints(connection),
						new Vector(edgeLabelLocator.getOffset().x, edgeLabelLocator.getOffset().y),
						SetLabelsOffsetOperation.isEdgeWithObliqueRoutingStyle(connectionEditPart));
			}
		}
	}
}