X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.g3d.csg%2Fsrc%2Forg%2Fsimantics%2Fg3d%2Fcsg%2Feditor%2FCSGEditor2.java;fp=org.simantics.g3d.csg%2Fsrc%2Forg%2Fsimantics%2Fg3d%2Fcsg%2Feditor%2FCSGEditor2.java;h=91b51419c0704a78b72d6cf25f9b5687adfe43c5;hb=53d55c24c779745f188bdb18d32f71d20acb61b2;hp=bed448737e623040ddf4ca9809f62e3d3135e3d5;hpb=f36217aeeb09c0c46f99886ee99772156ce9cfe6;p=simantics%2F3d.git diff --git a/org.simantics.g3d.csg/src/org/simantics/g3d/csg/editor/CSGEditor2.java b/org.simantics.g3d.csg/src/org/simantics/g3d/csg/editor/CSGEditor2.java index bed44873..91b51419 100644 --- a/org.simantics.g3d.csg/src/org/simantics/g3d/csg/editor/CSGEditor2.java +++ b/org.simantics.g3d.csg/src/org/simantics/g3d/csg/editor/CSGEditor2.java @@ -283,12 +283,12 @@ public class CSGEditor2 extends ResourceEditorPart { ren1.SetBackground(0.9,0.9,0.9); ren1.SetGradientBackground(true); - // vtkActor grid = vtkShape.createGridActor(8,1.0,1|2|4); - vtkActor grid = vtkShape.createGridActor(8,1.0, 2 ); - grid.SetPickable(0); - ren1.AddActor(grid); - panel.addDeletable(grid); - + // vtkActor grid = vtkShape.createGridActor(8,1.0,1|2|4); + vtkActor grid = vtkShape.createGridActor(8,1.0, 2 ); + grid.SetPickable(0); + ren1.AddActor(grid); + panel.addDeletable(grid); + } @@ -296,24 +296,24 @@ public class CSGEditor2 extends ResourceEditorPart { protected Menu contextMenu; protected void hookContextMenu() { - MenuManager menuMgr = new MenuManager("#PopupMenu"); - menuMgr.setRemoveAllWhenShown(true); - menuMgr.addMenuListener(new IMenuListener() { - public void menuAboutToShow(IMenuManager manager) { - final IMenuManager m = manager; - List selected = selectionProvider.getSelectedNodes(); - if (selected.size() == 0) { - m.add(new AddPrimitiveAction2(rootNode, BarrelNode.class)); - m.add(new AddPrimitiveAction2(rootNode, BoxNode.class)); - m.add(new AddPrimitiveAction2(rootNode, ConeNode.class)); - m.add(new AddPrimitiveAction2(rootNode, CylinderNode.class)); - m.add(new AddPrimitiveAction2(rootNode, EllipticCylinderNode.class)); - m.add(new AddPrimitiveAction2(rootNode, RectangularSolidNode.class)); - m.add(new AddPrimitiveAction2(rootNode, RegularPrismNode.class)); - m.add(new AddPrimitiveAction2(rootNode, SphereNode.class)); - m.add(new AddPrimitiveAction2(rootNode, TorusNode.class)); - } else if (selected.size() == 1) { - m.add(translateAction); + MenuManager menuMgr = new MenuManager("#PopupMenu"); + menuMgr.setRemoveAllWhenShown(true); + menuMgr.addMenuListener(new IMenuListener() { + public void menuAboutToShow(IMenuManager manager) { + final IMenuManager m = manager; + List selected = selectionProvider.getSelectedNodes(); + if (selected.size() == 0) { + m.add(new AddPrimitiveAction2(rootNode, BarrelNode.class)); + m.add(new AddPrimitiveAction2(rootNode, BoxNode.class)); + m.add(new AddPrimitiveAction2(rootNode, ConeNode.class)); + m.add(new AddPrimitiveAction2(rootNode, CylinderNode.class)); + m.add(new AddPrimitiveAction2(rootNode, EllipticCylinderNode.class)); + m.add(new AddPrimitiveAction2(rootNode, RectangularSolidNode.class)); + m.add(new AddPrimitiveAction2(rootNode, RegularPrismNode.class)); + m.add(new AddPrimitiveAction2(rootNode, SphereNode.class)); + m.add(new AddPrimitiveAction2(rootNode, TorusNode.class)); + } else if (selected.size() == 1) { + m.add(translateAction); m.add(rotateAction); m.add(removeAction); ICSGnode node = (ICSGnode)selected.get(0); @@ -323,16 +323,16 @@ public class CSGEditor2 extends ResourceEditorPart { if (node instanceof CSGparentNode) { m.add(new SplitBooleanOpAction2(rootNode,(CSGparentNode)node)); } - } else if (selected.size() == 2) { - if (selected.get(0).getParent().equals(rootNode) && selected.get(1).getParent().equals(rootNode)) { - Collection nodes = new ArrayList(); - for (IG3DNode n : selected) - nodes.add((ICSGnode)n); - m.add(new AddBooleanOpAction2(rootNode, DifferenceNode.class, nodes)); - m.add(new AddBooleanOpAction2(rootNode, IntersectionNode.class, nodes)); - m.add(new AddBooleanOpAction2(rootNode, UnionNode.class, nodes)); - } - } + } else if (selected.size() == 2) { + if (selected.get(0).getParent().equals(rootNode) && selected.get(1).getParent().equals(rootNode)) { + Collection nodes = new ArrayList(); + for (IG3DNode n : selected) + nodes.add((ICSGnode)n); + m.add(new AddBooleanOpAction2(rootNode, DifferenceNode.class, nodes)); + m.add(new AddBooleanOpAction2(rootNode, IntersectionNode.class, nodes)); + m.add(new AddBooleanOpAction2(rootNode, UnionNode.class, nodes)); + } + } // try { // SimanticsUI.getSession().syncRequest(new ReadRequest() { // @@ -389,12 +389,12 @@ public class CSGEditor2 extends ResourceEditorPart { // // TODO Auto-generated catch block // e.printStackTrace(); // } - - } - }); + + } + }); - contextMenu = menuMgr.createContextMenu(parent); - } + contextMenu = menuMgr.createContextMenu(parent); + } private IContentOutlinePage createOutline() { if (rootNode == null || selectionProvider == null)