]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics/src/org/simantics/SimanticsPlatform.java
Do not merge TG if it is not set as immutable
[simantics/platform.git] / bundles / org.simantics / src / org / simantics / SimanticsPlatform.java
index cf4928fe793e1088d2c28da8587b9ad538d3f370..faee6944da3a356496cdbbc0f40ff710175e917f 100644 (file)
@@ -83,6 +83,7 @@ import org.simantics.graph.db.GraphDependencyAnalyzer;
 import org.simantics.graph.db.GraphDependencyAnalyzer.IU;
 import org.simantics.graph.db.GraphDependencyAnalyzer.IdentityNode;
 import org.simantics.graph.db.IImportAdvisor;
+import org.simantics.graph.db.ImportResult;
 import org.simantics.graph.db.TransferableGraphs;
 import org.simantics.graph.diff.Diff;
 import org.simantics.graph.diff.TransferableGraphDelta1;
@@ -107,6 +108,7 @@ import org.simantics.project.management.WorkspaceUtil;
 import org.simantics.utils.FileUtils;
 import org.simantics.utils.datastructures.Pair;
 import org.simantics.utils.logging.TimeLogger;
+import org.simantics.utils.strings.EString;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -401,15 +403,22 @@ public class SimanticsPlatform implements LifecycleListener {
                                final IImportAdvisor advisor = new OntologyImportAdvisor(tg, mgmt);
                                final GraphBundle oldTG = reinstallTGs.get(tg);
 
+                               boolean createImmutable = tg.getImmutable();
+
                                if (oldTG==null) {
-                                       
-                                       boolean createImmutable = tg.getImmutable();
+
                                 session.getService(XSupport.class).setServiceMode(true, createImmutable);
 
                                        // Install TG
                                        log.log(new Status(IStatus.INFO, Activator.PLUGIN_ID, "Installing "+tg.toString()+" - "+tg.getName()));
-                                       TransferableGraphs.importGraph1(session, new TGTransferableGraphSource(tg.getGraph()), advisor, null);
+                                       ImportResult result = TransferableGraphs.importGraph1(session, new TGTransferableGraphSource(tg.getGraph()), advisor, null);
+                                       if (!result.missingExternals.isEmpty()) {
+                                               log.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Import of " + tg.toString() + " was missing the following external entities:\n" + EString.implode(result.missingExternals)));
+                                       }
                                } else {
+                                       if(!createImmutable)
+                                               continue;
+
                                        // Merge TG
                                        startTransaction(session, false);
                                        TransferableGraphDelta1 delta = new Diff(oldTG.getGraph(), tg.getGraph()).diff();