use of org.eclipse.sapphire.ui.diagram.ConnectionService in project liferay-ide by liferay.
the class WorkflowDefinitionLayoutPersistenceService method _handleWorkflowNodeMetaChange.
private void _handleWorkflowNodeMetaChange(WorkflowNodeMetadata workflowNodeMetadata) {
WorkflowNode workflowNode = workflowNodeMetadata.nearest(WorkflowNode.class);
if (workflowNode == null) {
return;
}
DiagramNodePart nodePart = _part().getDiagramNodePart(workflowNode);
if (nodePart != null) {
Position position = workflowNodeMetadata.getPosition();
Value<Integer> valueX = position.getX();
Value<Integer> valueY = position.getY();
DiagramNodeBounds nodeBounds = nodePart.getNodeBounds();
if ((nodeBounds.getX() != valueX.content()) || (nodeBounds.getY() != valueY.content())) {
nodePart.setNodeBounds(new DiagramNodeBounds(valueX.content(), valueY.content()));
}
}
ConnectionService connService = _part().service(ConnectionService.class);
if (workflowNode instanceof CanTransition) {
CanTransition canTransition = (CanTransition) workflowNode;
ElementList<Transition> transitions = canTransition.getTransitions();
for (Transition transition : transitions) {
List<Point> bendpoints = new ArrayList<>();
DiagramConnectionPart connPart = _getConnectionPart(connService, transition);
if (connPart != null) {
TransitionMetadata transitionMetadata = _getTransitionMetadata(transition, workflowNodeMetadata);
if (transitionMetadata != null) {
for (ConnectionBendpoint bendpoint : transitionMetadata.getBendpoints()) {
bendpoints.add(new Point(bendpoint.getX().content(), bendpoint.getY().content()));
}
connPart.resetBendpoints(bendpoints);
}
}
}
}
}
Aggregations