]> gerrit.simantics Code Review - simantics/3d.git/blobdiff - org.simantics.plant3d/src/org/simantics/plant3d/editor/P3DContentOutlinePage.java
White space clean-up
[simantics/3d.git] / org.simantics.plant3d / src / org / simantics / plant3d / editor / P3DContentOutlinePage.java
index c675b1112f5a3845633c5d6d9cd714d4e1155b39..24a141e464141f27ba4ff41ed068dee654cea1a3 100644 (file)
@@ -1,5 +1,8 @@
 package org.simantics.plant3d.editor;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.eclipse.jface.action.IMenuListener;
 import org.eclipse.jface.action.IMenuManager;
 import org.eclipse.jface.action.MenuManager;
@@ -18,7 +21,6 @@ import org.simantics.g3d.vtk.common.VTKContentOutlinePage;
 import org.simantics.plant3d.Activator;
 import org.simantics.plant3d.scenegraph.EndComponent;
 import org.simantics.plant3d.scenegraph.Equipment;
-import org.simantics.plant3d.scenegraph.InlineComponent;
 import org.simantics.plant3d.scenegraph.Nozzle;
 import org.simantics.plant3d.scenegraph.P3DRootNode;
 import org.simantics.plant3d.scenegraph.PipeRun;
@@ -28,7 +30,7 @@ import org.simantics.plant3d.scenegraph.controlpoint.PipeControlPoint;
 
 public class P3DContentOutlinePage extends VTKContentOutlinePage<Resource, Object>{
        
-       private static final boolean DEBUG = false;
+       private static final boolean DEBUG = true;
        protected Menu contextMenu;
        
        private LocalResourceManager manager = new LocalResourceManager(JFaceResources.getResources());
@@ -57,15 +59,26 @@ public class P3DContentOutlinePage extends VTKContentOutlinePage<Resource, Objec
                                if (parentElement instanceof P3DRootNode) {
                                        return ((P3DRootNode)parentElement).getChild().toArray();
                                }
-                               if (!DEBUG) {
-                                       if (parentElement instanceof PipeRun) {
-                                               return ((PipeRun)parentElement).getSortedChild().toArray();
+                               if (parentElement instanceof PipeRun) {
+                                       if (DEBUG) {
+                                               List<Object> list = new ArrayList<Object>();
+                                               list.addAll(((PipeRun)parentElement).getControlPoints());
+                                               list.addAll(((PipeRun)parentElement).getSortedChild());
+                                               return list.toArray();
                                        }
-                               } else {
+                                       return ((PipeRun)parentElement).getSortedChild().toArray();
+                               }
+                               if (DEBUG) {
                                        if (parentElement instanceof PipelineComponent) {
                                                return new Object[]{((PipelineComponent) parentElement).getControlPoint()};
                                        } else if (parentElement instanceof PipeControlPoint) {
-                                               return new Object[]{((PipeControlPoint) parentElement).getPipelineComponent()};
+                                               PipeControlPoint pcp = (PipeControlPoint) parentElement;
+                                               Object arr[] = new Object[pcp.children.size()+1];
+                                               arr[0] = pcp.getPipelineComponent();
+                                               for (int i = 0; i < pcp.children.size();i++) {
+                                                       arr[i+1] = pcp.children.get(i);
+                                               }
+                                               return arr;
                                        }
                                }
                                return super.getChildren(parentElement);
@@ -111,14 +124,14 @@ public class P3DContentOutlinePage extends VTKContentOutlinePage<Resource, Objec
        }
        
        protected void hookContextMenu(TreeViewer viewer) {
-        MenuManager menuMgr = new MenuManager("#PopupMenu");
-        menuMgr.setRemoveAllWhenShown(true);
-        menuMgr.addMenuListener(new IMenuListener() {
-            public void menuAboutToShow(IMenuManager manager) {
-               createContextMenu(manager);
-            }
-        });
-        contextMenu = menuMgr.createContextMenu(viewer.getTree());
+               MenuManager menuMgr = new MenuManager("#PopupMenu");
+               menuMgr.setRemoveAllWhenShown(true);
+               menuMgr.addMenuListener(new IMenuListener() {
+                       public void menuAboutToShow(IMenuManager manager) {
+                               createContextMenu(manager);
+                       }
+               });
+               contextMenu = menuMgr.createContextMenu(viewer.getTree());
        }
        
        protected void createContextMenu(IMenuManager manager) {