package org.simantics.processeditor.actions; import org.eclipse.jface.action.Action; import org.simantics.processeditor.Activator; import org.simantics.processeditor.dialogs.FloorConfigureDialog; import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase; import com.jme.math.Vector3f; import com.jme.scene.Geometry; public class ConfigureFloorAction extends Action { Geometry floorShape; ThreeDimensionalEditorBase editor; public ConfigureFloorAction(ThreeDimensionalEditorBase editor) { setText("Configure floor"); setImageDescriptor(Activator.imageDescriptorFromPlugin("fi.vtt.proconf.ode", "icons/silk/shape_align_bottom.png")); this.editor = editor; } public void run() { if (floorShape == null) throw new NullPointerException("FloorShape is null"); FloorConfigureDialog dialog = new FloorConfigureDialog(editor.getRenderingComposite().getShell()); if (dialog.open() == FloorConfigureDialog.CANCEL) return; if (dialog.isFloorEnabled()) { if (floorShape.getParent() == null) editor.getRenderingComponent().getNoCastRoot().attachChild(floorShape); } else { floorShape.removeFromParent(); } floorShape.setLocalTranslation(new Vector3f(0.f,(float)dialog.getFloorHeight(),0.f)); } public void setFloorShape(Geometry floorShape) { this.floorShape = floorShape; } }