]> gerrit.simantics Code Review - simantics/3d.git/commitdiff
git-svn-id: https://www.simantics.org/svn/simantics/3d/branches/dev@8676 ac1ea38d...
authorluukkainen <luukkainen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Mon, 19 Jan 2009 11:04:43 +0000 (11:04 +0000)
committerluukkainen <luukkainen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Mon, 19 Jan 2009 11:04:43 +0000 (11:04 +0000)
org.simantics.proconf.processeditor/src/org/simantics/processeditor/actions/ConfigureFloorAction.java [new file with mode: 0644]
org.simantics.proconf.processeditor/src/org/simantics/processeditor/views/ProcessEditor.java

diff --git a/org.simantics.proconf.processeditor/src/org/simantics/processeditor/actions/ConfigureFloorAction.java b/org.simantics.proconf.processeditor/src/org/simantics/processeditor/actions/ConfigureFloorAction.java
new file mode 100644 (file)
index 0000000..3cca915
--- /dev/null
@@ -0,0 +1,42 @@
+package org.simantics.processeditor.actions;\r
+\r
+import org.eclipse.jface.action.Action;\r
+import org.simantics.processeditor.Activator;\r
+import org.simantics.processeditor.dialogs.FloorConfigureDialog;\r
+import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
+\r
+import com.jme.math.Vector3f;\r
+import com.jme.scene.Geometry;\r
+\r
+public class ConfigureFloorAction extends Action {\r
+       \r
+       Geometry floorShape;\r
+       ThreeDimensionalEditorBase editor;\r
+       \r
+       public ConfigureFloorAction(ThreeDimensionalEditorBase editor) {\r
+               setText("Configure floor");\r
+        setImageDescriptor(Activator.imageDescriptorFromPlugin("fi.vtt.proconf.ode", "icons/silk/shape_align_bottom.png"));\r
+        this.editor = editor;\r
+       }\r
+       \r
+       public void run() {\r
+               if (floorShape == null)\r
+                       throw new NullPointerException("FloorShape is null");\r
+               FloorConfigureDialog dialog = new FloorConfigureDialog(editor.getRenderingComposite().getShell());\r
+               if (dialog.open() == FloorConfigureDialog.CANCEL)\r
+                       return;\r
+               if (dialog.isFloorEnabled()) {\r
+                       if (floorShape.getParent() == null)\r
+                               editor.getRenderingComponent().getNoCastRoot().attachChild(floorShape);\r
+               } else {\r
+                       floorShape.removeFromParent();\r
+               }\r
+               floorShape.setLocalTranslation(new Vector3f(0.f,(float)dialog.getFloorHeight(),0.f));\r
+               \r
+       }\r
+       \r
+       public void setFloorShape(Geometry floorShape) {\r
+               this.floorShape = floorShape;\r
+       }\r
+\r
+}\r
index cab340f58440ce735aa21fa4e33acb083e0f6970..b28ae1c5d10c99fc282e6dba365ee8b0d33fcdf7 100644 (file)
@@ -16,7 +16,6 @@ import java.util.HashMap;
 import java.util.List;\r
 import java.util.Map;\r
 \r
-import org.eclipse.jface.action.Action;\r
 import org.eclipse.jface.viewers.ISelection;\r
 import org.eclipse.jface.viewers.ISelectionChangedListener;\r
 import org.eclipse.jface.viewers.SelectionChangedEvent;\r
@@ -30,15 +29,14 @@ import org.simantics.db.management.ISessionContext;
 import org.simantics.layer0.utils.EntityFactory;\r
 import org.simantics.layer0.utils.IEntity;\r
 import org.simantics.layer0.utils.Property;\r
-import org.simantics.processeditor.Activator;\r
 import org.simantics.processeditor.ProcessResource;\r
+import org.simantics.processeditor.actions.ConfigureFloorAction;\r
 import org.simantics.processeditor.actions.InsertComponentAction;\r
 import org.simantics.processeditor.actions.InsertEquipmentAction;\r
 import org.simantics.processeditor.actions.InsertNozzleAction;\r
 import org.simantics.processeditor.actions.RoutePipeAction;\r
 import org.simantics.processeditor.common.ControlPointTools;\r
 import org.simantics.processeditor.common.PipingRules;\r
-import org.simantics.processeditor.dialogs.FloorConfigureDialog;\r
 import org.simantics.processeditor.scenegraph.NonVisibleNode;\r
 import org.simantics.processeditor.scenegraph.PipeComponentNode;\r
 import org.simantics.processeditor.scenegraph.PipeRunNode;\r
@@ -72,7 +70,7 @@ public class ProcessEditor extends ThreeDimensionalEditorBase {
     \r
     private Resource plantResource = null;\r
     \r
-    private Action configureFloorAction = null;\r
+    private ConfigureFloorAction configureFloorAction = null;\r
 \r
     private Geometry floorShape = null;\r
 \r
@@ -100,6 +98,7 @@ public class ProcessEditor extends ThreeDimensionalEditorBase {
        floorShape = FloorShape.getShape(getRenderingComponent().getDisplaySystem().getRenderer(), 100.f,0.2f);\r
        getRenderingComponent().getNoCastRoot().attachChild(floorShape);\r
        floorShape.setLocalTranslation(new Vector3f(0.f,-0.01f,0.f));\r
+       configureFloorAction.setFloorShape(floorShape);\r
     }\r
 \r
     @Override\r
@@ -108,23 +107,7 @@ public class ProcessEditor extends ThreeDimensionalEditorBase {
 \r
         //actions.add(new ShowTrendsAction(this));\r
 \r
-        configureFloorAction = new Action() {\r
-               public void run() {\r
-                       FloorConfigureDialog dialog = new FloorConfigureDialog(ProcessEditor.this.parent.getShell());\r
-                       if (dialog.open() == FloorConfigureDialog.CANCEL)\r
-                               return;\r
-                       if (dialog.isFloorEnabled()) {\r
-                               if (floorShape.getParent() == null)\r
-                                       getRenderingComponent().getNoCastRoot().attachChild(floorShape);\r
-                       } else {\r
-                               floorShape.removeFromParent();\r
-                       }\r
-                       floorShape.setLocalTranslation(new Vector3f(0.f,(float)dialog.getFloorHeight(),0.f));\r
-                       \r
-               }\r
-        };\r
-        configureFloorAction.setText("Configure floor");\r
-        configureFloorAction.setImageDescriptor(Activator.imageDescriptorFromPlugin("fi.vtt.proconf.ode", "icons/silk/shape_align_bottom.png"));\r
+        configureFloorAction = new ConfigureFloorAction(this);\r
 \r
 //        ContextActionFactory extended[] = ContextActionRegistry.getActions("fi.vtt.proconf.shapeeditor.processeditorview");\r
 //        for (ContextActionFactory c : extended) {\r
@@ -547,9 +530,7 @@ public class ProcessEditor extends ThreeDimensionalEditorBase {
                                        });\r
                                }\r
                        });\r
-                       \r
-                       \r
-                       \r
+\r
                        return page;\r
                }\r
                return null;\r