import org.simantics.g3d.tools.AdaptationUtils;
import org.simantics.objmap.graph.IMapping;
import org.simantics.objmap.structural.StructuralResource;
+import org.simantics.utils.ui.AdaptionUtils;
import vtk.vtkProp;
@Override
public void setSelection(ISelection selection) {
+ Collection<IG3DNode> nodes = AdaptionUtils.adaptToCollection(selection, IG3DNode.class);
+ Collection<Resource> resources= AdaptionUtils.adaptToCollection(selection, Resource.class);
+ if (nodes.size() > 0) {
+ processSelection(selection);
+ fireSelectionChanged(this);
+ } else if (resources.size() > 0) {
+ nodes = new ArrayList<IG3DNode>();
+ for (Resource r : resources) {
+ JavaObject n = mapping.get((DBObject)r);
+ if (n instanceof IG3DNode) {
+ nodes.add((IG3DNode)n);
+ }
+ }
+ processSelection(new StructuredSelection(nodes.toArray()));
+ fireSelectionChanged(this);
+ }
}
}
- protected void setColor(E node, boolean edge, double color[]) {
+ public void setColor(E node, boolean edge, double color[]) {
for (vtkProp prop : nodeMap.getRenderObjects(node)) {
if (prop instanceof vtkActor) {
vtkActor act = (vtkActor)prop;