]> gerrit.simantics Code Review - simantics/3d.git/blob
cffd0730e375818e7f98f7dc2830dd41388ac0b2
[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             public void setEditorSelection(boolean addShapes) {\r
31 \r
32                 List<IGraphicsNode> sel = getSelectedObjects();\r
33                 for (IGraphicsNode o : adapter.getNodes())\r
34                         if (o instanceof ISelectableNode) {\r
35                                 if (sel.contains(o)) {\r
36                                 ((ISelectableNode)o).setSelected(true);\r
37                         } else {\r
38                                 ((ISelectableNode)o).setSelected(false);\r
39                         }\r
40                         }\r
41             }\r
42 \r
43             @Override\r
44             protected void setEditorHighlightSelection() {\r
45                 List<IGraphicsNode> sel = getInteractiveSelectedObjects();\r
46                 for (IGraphicsNode o : adapter.getNodes())\r
47                         if (o instanceof ISelectableNode) {\r
48                                 if (sel.contains(o)) {\r
49                                 ((ISelectableNode)o).setHighlighted(true);\r
50                         } else {\r
51                                 ((ISelectableNode)o).setHighlighted(false);\r
52                         }\r
53                         }\r
54             }\r
55 \r
56 }\r