Xcos: display the loaded XMI file on the editor 22/18722/2
Clément DAVID [Mon, 28 Nov 2016 16:47:13 +0000 (17:47 +0100)]
Change-Id: Ide78209d4be1c7866a46dd993df30952500b44a9

scilab/modules/xcos/src/java/org/scilab/modules/xcos/io/XcosFileType.java

index e7fe653..acfd5c3 100644 (file)
@@ -143,7 +143,16 @@ public enum XcosFileType {
 
         @Override
         public void load(String file, XcosDiagram into) throws Exception {
-            JavaXMIResource.load(file, into.getUID());
+            View xcosView = JavaController.lookup_view(Xcos.class.getName());
+            try {
+                JavaController.unregister_view(xcosView);
+
+                JavaController controller = new JavaController();
+                JavaXMIResource.load(file, into.getUID());
+                XcosCellFactory.insertChildren(controller, into);
+            } finally {
+                JavaController.register_view(Xcos.class.getName(), xcosView);
+            }
         }
 
         @Override