]> gerrit.simantics Code Review - simantics/3d.git/blobdiff - org.simantics.plant3d/src/org/simantics/plant3d/editor/Plant3DEditor.java
Editor internal toolbar for Plant3D editor
[simantics/3d.git] / org.simantics.plant3d / src / org / simantics / plant3d / editor / Plant3DEditor.java
index 5d755d06f7e3d6b74f704365d1c8dc06c452551b..4059d938f0d939f754dd0204190cf1452703d487 100644 (file)
@@ -8,9 +8,12 @@ import java.util.Set;
 import org.eclipse.jface.action.IMenuListener;
 import org.eclipse.jface.action.IMenuManager;
 import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.layout.GridLayoutFactory;
 import org.eclipse.jface.viewers.ISelectionChangedListener;
 import org.eclipse.jface.viewers.ISelectionProvider;
 import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.DisposeEvent;
 import org.eclipse.swt.events.DisposeListener;
 import org.eclipse.swt.layout.FillLayout;
@@ -25,6 +28,7 @@ import org.simantics.db.exception.DatabaseException;
 import org.simantics.g3d.scenegraph.NodeMap;
 import org.simantics.g3d.scenegraph.RenderListener;
 import org.simantics.g3d.scenegraph.base.INode;
+import org.simantics.g3d.toolbar.ToolComposite;
 import org.simantics.g3d.vtk.action.RemoveAction;
 import org.simantics.g3d.vtk.common.HoverHighlighter;
 import org.simantics.g3d.vtk.common.NodeSelectionProvider2;
@@ -89,10 +93,12 @@ import vtk.vtkSimpleMotionBlurPass;
 public class Plant3DEditor extends ResourceEditorPart {
 
        private Composite parent;
+       protected ToolComposite toolComposite;
        private Resource input;
 //     private InteractiveVtkPanel panel;
 //     private SWTAWTComponent component;
        private InteractiveVtkComposite panel;
+
        
        private P3DRootNode rootNode;
        private IMapping<Resource,INode> mapping;
@@ -117,7 +123,9 @@ public class Plant3DEditor extends ResourceEditorPart {
        @Override
        public void createPartControl(Composite parent) {
                this.parent = parent;
-               parent.setLayout (new FillLayout ());
+               //parent.setLayout (new FillLayout ());
+               
+        
 //             component = new SWTAWTComponent(parent,SWT.NONE) {
 //                     
 //                     @Override
@@ -134,9 +142,17 @@ public class Plant3DEditor extends ResourceEditorPart {
                IResourceEditorInput rei = (IResourceEditorInput)getEditorInput();
                input = rei.getResource();
                
+               toolComposite = new ToolComposite(parent, SWT.BORDER);
+           toolComposite.setVisible(true);
+               
                panel = new InteractiveVtkComposite(parent);
                
+               GridLayoutFactory.fillDefaults().margins(0, 0).spacing(0, 0).applyTo(parent);
+        GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(getPanel().getComponent());
                
+      
+        GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(toolComposite);
+        
                //IActionBars actionBars = getEditorSite().getActionBars();
 
                hookContextMenu();
@@ -246,13 +262,13 @@ public class Plant3DEditor extends ResourceEditorPart {
        
        protected void createActions() {
            focusAction = new FocusAction(panel, cameraAction);
-               translateAction = new TranslateAction(panel,nodeMap);
-               translateInlineAction = new TranslateInlineAction(panel, nodeMap);
-               translateFreeVariableLengthAction = new TranslateFreeVariableLengthAction(panel, getRootNode());
-               rotateAction = new RotateAction(panel,nodeMap);
+               translateAction = new TranslateAction(panel,nodeMap,toolComposite);
+               translateInlineAction = new TranslateInlineAction(panel, nodeMap,toolComposite);
+               translateFreeVariableLengthAction = new TranslateFreeVariableLengthAction(panel, getRootNode(), toolComposite);
+               rotateAction = new RotateAction(panel,nodeMap,toolComposite);
                removeAction = new RemoveAction(nodeMap);
                removeSplitAction = new RemoveAndSplitAction(nodeMap);
-               routePipeAction = new RoutePipeAction(panel,rootNode);
+               routePipeAction = new RoutePipeAction(panel,rootNode, toolComposite);
                addComponentAction = new AddComponentAction(panel, rootNode, getLibraryUri());
                reversePipeRunAction = new ReversePipeRunAction(nodeMap);
        }