--- /dev/null
+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
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
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
\r
private Resource plantResource = null;\r
\r
- private Action configureFloorAction = null;\r
+ private ConfigureFloorAction configureFloorAction = null;\r
\r
private Geometry floorShape = null;\r
\r
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
\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
});\r
}\r
});\r
- \r
- \r
- \r
+\r
return page;\r
}\r
return null;\r