package org.simantics.plant3d.actions; import org.simantics.g3d.scenegraph.base.INode; import org.simantics.g3d.vtk.action.RemoveAction; import org.simantics.g3d.vtk.common.VTKNodeMap; import org.simantics.plant3d.scenegraph.PipelineComponent; public class RemoveAndSplitAction extends RemoveAction { public RemoveAndSplitAction(VTKNodeMap nodeMap) { super(nodeMap); setText("Remove/Split"); } @Override public boolean isRemovable(INode node) { if (!super.isRemovable(node)) return false; if (!(node instanceof PipelineComponent)) return false; PipelineComponent pc = (PipelineComponent)node; if (pc.getNext() != null && pc.getPrevious() != null) return true; else return false; } @Override protected void doRemove(INode node) { PipelineComponent pc = (PipelineComponent)node; pc.removeAndSplit(); } }