]> gerrit.simantics Code Review - simantics/3d.git/blobdiff - org.simantics.plant3d/src/org/simantics/plant3d/editor/Plant3DEditor.java
Plant3D customization
[simantics/3d.git] / org.simantics.plant3d / src / org / simantics / plant3d / editor / Plant3DEditor.java
index b1bb5000995c394503504c3a3aa54a68bea3ab25..5015e6ea4b8dd9d2e4dfb8798c92f06b6834c757 100644 (file)
@@ -158,39 +158,8 @@ public class Plant3DEditor extends ResourceEditorPart {
                                        // update control points.
                                        // TODO : this should be optimized.
                                        try {
-                                               for (INode node : rootNode.getChild()) {
-                                                       if (node instanceof PipeRun) {
-                                                               for (PipelineComponent pc : ((PipeRun) node).getChild())
-                                                                       pc.sync();
-                                                       } else if (node instanceof Equipment) {
-                                                               for (PipelineComponent pc : ((Equipment) node).getChild())
-                                                                       pc.sync();
-                                                       }
-                                               }
-                                               
-                                               for (INode node : rootNode.getChild()) {
-                                                       if (node instanceof PipeRun) {
-                                                               for (PipelineComponent pc : ((PipeRun) node).getChild())
-                                                                       pc.sync2();
-                                                       } else if (node instanceof Equipment) {
-                                                               for (PipelineComponent pc : ((Equipment) node).getChild())
-                                                                       pc.sync2();
-                                                       }
-                                               }
-                                               for (INode node : rootNode.getChild()) {
-                                                       if (node instanceof PipeRun) {
-                                                               PipingRules.validate((PipeRun)node);
-                                                       }
-                                               }
-                                               PipingRules.setEnabled(true);
-                                               for (INode node : rootNode.getChild()) {
-                                                       if (node instanceof PipeRun) {
-                                                               PipeRun run = (PipeRun)node;
-                                                               for (PipeControlPoint pcp : run.getControlPoints())
-                                                                       PipingRules.positionUpdate(pcp);
-                                                                       
-                                                       }
-                                               }
+                                           P3DUtil.finalizeDBLoad(rootNode);
+                                           
                                        } catch (Exception e) {
                                                throw new DatabaseException(e);
                                        }
@@ -235,21 +204,25 @@ public class Plant3DEditor extends ResourceEditorPart {
                        return;
                }
                
-               translateAction = new TranslateAction(panel,nodeMap);
-               translateInlineAction = new TranslateInlineAction(panel, nodeMap);
-               rotateAction = new RotateAction(panel,nodeMap);
-               removeAction = new RemoveAction(nodeMap) {
-                       public void setNode(IG3DNode node) {
-                               super.setNode(node);
-                               
-                               
-                       }
-               };
-               routePipeAction = new RoutePipeAction(panel,rootNode);
-               addComponentAction = new AddComponentAction(panel, rootNode);
+               createActions();
                
        }
        
+       protected void createActions() {
+           translateAction = new TranslateAction(panel,nodeMap);
+        translateInlineAction = new TranslateInlineAction(panel, nodeMap);
+        rotateAction = new RotateAction(panel,nodeMap);
+        removeAction = new RemoveAction(nodeMap) {
+            public void setNode(IG3DNode node) {
+                super.setNode(node);
+                
+                
+            }
+        };
+        routePipeAction = new RoutePipeAction(panel,rootNode);
+        addComponentAction = new AddComponentAction(panel, rootNode);
+       }
+       
        public void populate() {
                ThreadUtils.asyncExec(panel.getThreadQueue(), new Runnable() {
                        
@@ -353,9 +326,11 @@ public class Plant3DEditor extends ResourceEditorPart {
                                                m.add(add);
                                        }
                                } else if (node instanceof Nozzle) {
-                                       m.add(translateAction);
-                                       m.add(rotateAction);
-                                       Nozzle nozzle = (Nozzle)node;
+                                   Nozzle nozzle = (Nozzle)node;
+                                   if (!nozzle.isFixed()) {
+                                       m.add(translateAction);
+                           m.add(rotateAction);
+                                   }
                                        m.add(routePipeAction);
                                        routePipeAction.setComponent(nozzle);
                                        routePipeAction.setEnabled(nozzle.getNext() == null && nozzle.getPrevious() == null);