1 /*******************************************************************************
2 * Copyright (c) 2012, 2013 Association for Decentralized Information Management in
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.g3d.vtk.action;
14 import org.eclipse.jface.action.Action;
15 import org.simantics.g3d.scenegraph.IG3DNode;
16 import org.simantics.g3d.scenegraph.base.INode;
17 import org.simantics.g3d.scenegraph.structural.IStructuralNode;
18 import org.simantics.g3d.vtk.Activator;
19 import org.simantics.g3d.vtk.common.VTKNodeMap;
21 public class RemoveAction extends Action {
23 private VTKNodeMap nodeMap;
26 public RemoveAction(VTKNodeMap nodeMap) {
28 setImageDescriptor(Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/delete.png"));
29 this.nodeMap = nodeMap;
32 public void setNode(INode node) {
34 setEnabled(isRemovable(node));
37 public boolean isRemovable(INode node) {
38 if ((node instanceof IStructuralNode) && ((IStructuralNode)node).isPartOfInstantiatedModel() && !((IStructuralNode)node).isInstantiatedModelRoot())
47 nodeMap.commit("Remove");
51 protected void doRemove(INode node) {