From e93918c8a7c79d3abddb07b027f45c0e1a97aa9c Mon Sep 17 00:00:00 2001 From: Ralph Soika Date: Wed, 4 Dec 2024 21:26:46 +0100 Subject: [PATCH] added debug option for changeRoutingPointsOperation --- ...MNChangeRoutingPointsOperationHandler.java | 30 +++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/open-bpmn.glsp-server/src/main/java/org/openbpmn/glsp/operations/BPMNChangeRoutingPointsOperationHandler.java b/open-bpmn.glsp-server/src/main/java/org/openbpmn/glsp/operations/BPMNChangeRoutingPointsOperationHandler.java index 94a82989..d9288e4b 100644 --- a/open-bpmn.glsp-server/src/main/java/org/openbpmn/glsp/operations/BPMNChangeRoutingPointsOperationHandler.java +++ b/open-bpmn.glsp-server/src/main/java/org/openbpmn/glsp/operations/BPMNChangeRoutingPointsOperationHandler.java @@ -52,6 +52,7 @@ public class BPMNChangeRoutingPointsOperationHandler extends GModelOperationHandler { private static Logger logger = Logger.getLogger(BPMNChangeRoutingPointsOperationHandler.class.getName()); + private boolean debug = true; @Inject protected BPMNGModelState modelState; @@ -62,8 +63,11 @@ public Optional createCommand(ChangeRoutingPointsOperation operation) { } private void executeOperation(final ChangeRoutingPointsOperation operation) { + boolean debug = true; List routingPoints = operation.getNewRoutingPoints(); - logger.fine("├── ChangeRoutingPointsOperation - got " + routingPoints.size() + " routing points"); + + if (debug) + System.out.println("├── ChangeRoutingPointsOperation - got " + routingPoints.size() + " routing points"); try { for (ElementAndRoutingPoints routingPoint : routingPoints) { String id = routingPoint.getElementId(); @@ -73,16 +77,21 @@ private void executeOperation(final ChangeRoutingPointsOperation operation) { GEdge edge = (GEdge) modelState.getIndex().get(id).orElse(null); if (edge != null) { - logger.fine("├── edge: " + id); + if (debug) + System.out.println("├── edge: " + id); EList oldPoints = edge.getRoutingPoints(); - logger.fine("│   ├── old points:"); + if (debug) + System.out.println("│   ├── old points:"); for (GPoint ding : oldPoints) { - logger.fine("│   │   ├── " + ding.getX() + "." + ding.getY()); + if (debug) + System.out.println("│   │   ├── " + ding.getX() + "." + ding.getY()); } - logger.fine("│   ├── new points:"); + if (debug) + System.out.println("│   ├── new points:"); for (GPoint ding : newGLSPRoutingPoints) { - logger.fine("│   │   ├── " + ding.getX() + "." + ding.getY()); + if (debug) + System.out.println("│   │   ├── " + ding.getX() + "." + ding.getY()); } edge.getRoutingPoints().clear(); edge.getRoutingPoints().addAll(newGLSPRoutingPoints); @@ -106,12 +115,14 @@ private void executeOperation(final ChangeRoutingPointsOperation operation) { * @param newGLSPRoutingPoints */ private void updateBPMNWayPoints(String id, List newGLSPRoutingPoints) { - logger.fine("├── ChangeRoutingPointsOperation - Update BPMN way points for " + id); + if (debug) + System.out.println("├── ChangeRoutingPointsOperation - Update BPMN way points for " + id); BPMNElement element = modelState.getBpmnModel().findElementById(id); BPMNElementEdge bpmnElementEdge = (BPMNElementEdge) element; try { - logger.fine("│   ├── clearing all waypoints"); + if (debug) + System.out.println("│   ├── clearing all waypoints"); bpmnElementEdge.clearWayPoints(); // find the process @@ -141,7 +152,8 @@ private void updateBPMNWayPoints(String id, List newGLSPRoutingPoints) { } } bpmnPoint = new BPMNPoint(xOffset + point.getX(), yOffset + point.getY()); - logger.fine("│   ├── add waypoint : " + point.getX() + "," + point.getY()); + if (debug) + System.out.println("│   ├── add waypoint : " + point.getX() + "," + point.getY()); bpmnElementEdge.addWayPoint(bpmnPoint); } } catch (Exception e) {