]> gerrit.simantics Code Review - simantics/3d.git/blobdiff - org.simantics.plant3d/src/org/simantics/plant3d/editor/Plant3DEditor.java
Use generics type variable for mapping db object.
[simantics/3d.git] / org.simantics.plant3d / src / org / simantics / plant3d / editor / Plant3DEditor.java
index 2c94b5daea3fa4d191f7dda53dbc7960f350063d..d3f3c5e47e11d199b838225ee16f7afa6a0fd4e0 100644 (file)
@@ -46,6 +46,7 @@ import org.simantics.plant3d.actions.AddNozzleAction;
 import org.simantics.plant3d.actions.RemoveAndSplitAction;
 import org.simantics.plant3d.actions.RoutePipeAction;
 import org.simantics.plant3d.actions.TranslateInlineAction;
+import org.simantics.plant3d.ontology.Plant3D;
 import org.simantics.plant3d.scenegraph.EndComponent;
 import org.simantics.plant3d.scenegraph.Equipment;
 import org.simantics.plant3d.scenegraph.IP3DNode;
@@ -139,7 +140,7 @@ public class Plant3DEditor extends ResourceEditorPart {
                panel.setPickType(4);
                
                try {
-                       ControlPointFactory.preloadCache();
+                       ControlPointFactory.preloadCache(getLibraryUri());
                        ComponentUtils.preloadCache();
                } catch (Exception e) {
                        ExceptionUtils.logAndShowError("Cannot open Plant3D editor",e);
@@ -227,8 +228,12 @@ public class Plant3DEditor extends ResourceEditorPart {
            return new HoverHighlighter(panel,nodeMap);
        }
        
-       protected SelectionHighlighter<INode> createSelectionHighlighter() {
-           return new SelectionHighlighter<INode>(panel,nodeMap);
+       protected SelectionHighlighter<Resource,INode> createSelectionHighlighter() {
+           return new SelectionHighlighter<Resource,INode>(panel,nodeMap);
+       }
+       
+       protected String getLibraryUri() {
+           return Plant3D.URIs.Builtin;
        }
        
        protected void createActions() {
@@ -243,7 +248,7 @@ public class Plant3DEditor extends ResourceEditorPart {
                
                removeSplitAction = new RemoveAndSplitAction(nodeMap);
                routePipeAction = new RoutePipeAction(panel,rootNode);
-               addComponentAction = new AddComponentAction(panel, rootNode);
+               addComponentAction = new AddComponentAction(panel, rootNode, getLibraryUri());
        }
        
        public void populate() {
@@ -356,7 +361,7 @@ public class Plant3DEditor extends ResourceEditorPart {
                List<IG3DNode> selected = selectionProvider.getSelectedNodes();
                try {
                        if (selected.size() == 0) {
-                               for (Item eq : P3DUtil.getEquipments()) {
+                               for (Item eq : P3DUtil.getEquipments(getLibraryUri())) {
                                        m.add(new AddEquipmentAction(rootNode, eq));
                                }
                        } else if (selected.size() == 1) {
@@ -364,7 +369,7 @@ public class Plant3DEditor extends ResourceEditorPart {
                                if (node instanceof Equipment) {
                                        m.add(translateAction);
                                        m.add(rotateAction);
-                                       for (Item eq : P3DUtil.getNozzles()) {
+                                       for (Item eq : P3DUtil.getNozzles(getLibraryUri())) {
                                                AddNozzleAction add = new AddNozzleAction(rootNode, eq);
                                                add.setEquipment((Equipment)node);
                                                m.add(add);