]> gerrit.simantics Code Review - simantics/3d.git/blob
07f9186ee25298eb3ae4e0a9975c8ea7121de7d0
[simantics/3d.git] /
1 package org.simantics.processeditor.adapters;\r
2 \r
3 import java.util.List;\r
4 \r
5 import org.simantics.proconf.g3d.base.ScenegraphAdapter;\r
6 import org.simantics.proconf.g3d.base.SelectionAdapter;\r
7 import org.simantics.proconf.g3d.scenegraph.IGraphicsNode;\r
8 import org.simantics.proconf.g3d.scenegraph.ISelectableNode;\r
9 \r
10 public class ProcessEditorSelectionAdapter extends SelectionAdapter {\r
11         \r
12         \r
13          public ProcessEditorSelectionAdapter(ScenegraphAdapter adapter) {\r
14                 super(adapter);\r
15          }\r
16 \r
17             @Override\r
18             public void setEditorSelection() {\r
19                 List<IGraphicsNode> sel = getSelectedObjects();\r
20                 for (IGraphicsNode o : adapter.getNodes())\r
21                         if (o instanceof ISelectableNode) {\r
22                                 if (sel.contains(o)) {\r
23                                 ((ISelectableNode)o).setSelected(true);\r
24                         } else {\r
25                                 ((ISelectableNode)o).setSelected(false);\r
26                         }\r
27                         }\r
28             }\r
29 \r
30 \r
31             @Override\r
32             protected void setEditorHighlightSelection() {\r
33                 List<IGraphicsNode> sel = getInteractiveSelectedObjects();\r
34                 for (IGraphicsNode o : adapter.getNodes())\r
35                         if (o instanceof ISelectableNode) {\r
36                                 if (sel.contains(o)) {\r
37                                 ((ISelectableNode)o).setHighlighted(true);\r
38                         } else {\r
39                                 ((ISelectableNode)o).setHighlighted(false);\r
40                         }\r
41                         }\r
42             }\r
43 \r
44 }\r