From ee06aa180a730b402042b4dbbf1514923086edd3 Mon Sep 17 00:00:00 2001 From: Marko Luukkainen Date: Thu, 24 Oct 2019 17:17:02 +0300 Subject: [PATCH] Run piping rules for all added components when closing pipe routing This should reduce the amount of unsynchronised changes gitlab #35 Change-Id: I5834089a3f7d0e150e46d6cb6b8f53d058ef7ec8 --- .../plant3d/actions/RoutePipeAction.java | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/org.simantics.plant3d/src/org/simantics/plant3d/actions/RoutePipeAction.java b/org.simantics.plant3d/src/org/simantics/plant3d/actions/RoutePipeAction.java index 5c787037..b40d7e0b 100644 --- a/org.simantics.plant3d/src/org/simantics/plant3d/actions/RoutePipeAction.java +++ b/org.simantics.plant3d/src/org/simantics/plant3d/actions/RoutePipeAction.java @@ -114,7 +114,7 @@ public class RoutePipeAction extends vtkSwtAction { public void deattach() { deactivate(); startComponent = null; - nodeMap.commit("Route pipe"); + deattachUI(); super.deattach(); panel.refresh(); @@ -422,11 +422,23 @@ public class RoutePipeAction extends vtkSwtAction { state = ToolState.SELECTING_SPLIT; } public void deactivate() { - for (PipelineComponent component : added) { - component.getControlPoint().setDeletable(true); - } + if (added.size() > 0) { + for (PipelineComponent component : added) { + component.getControlPoint().setDeletable(true); + } + + for (PipelineComponent comp : added) { + PipingRules.requestUpdate(comp.getControlPoint()); + } + try { + PipingRules.update(); + nodeMap.commit("Route pipe"); + } catch (Exception e) { + ExceptionUtils.logAndShowError(e); + } + added.clear(); + } - added.clear(); startComponent.getControlPoint().setDeletable(startRemovable); direction = null; -- 2.47.1