]> gerrit.simantics Code Review - simantics/3d.git/commitdiff
Run piping rules for all added components when closing pipe routing 08/3408/1
authorMarko Luukkainen <marko.luukkainen@semantum.fi>
Thu, 24 Oct 2019 14:17:02 +0000 (17:17 +0300)
committerMarko Luukkainen <marko.luukkainen@semantum.fi>
Thu, 24 Oct 2019 14:17:02 +0000 (17:17 +0300)
This should reduce the amount of unsynchronised changes

gitlab #35

Change-Id: I5834089a3f7d0e150e46d6cb6b8f53d058ef7ec8

org.simantics.plant3d/src/org/simantics/plant3d/actions/RoutePipeAction.java

index 5c787037daed939790c0d8030942b9e1e5ea3aa9..b40d7e0b7b469b1ecc507937850e5673ee69ea25 100644 (file)
@@ -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;