]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.modeling/src/org/simantics/modeling/ModelingUtils.java
Move platform to only work with JDK's >= 11
[simantics/platform.git] / bundles / org.simantics.modeling / src / org / simantics / modeling / ModelingUtils.java
index 1edf3cd3121a4e4682e5de0012916fcfd0b74ee5..e4e7fce059de58c641499db79298d7ac7300cfc5 100644 (file)
@@ -85,7 +85,6 @@ import org.simantics.db.common.request.ResourceRead2;
 import org.simantics.db.common.request.WriteRequest;
 import org.simantics.db.common.request.WriteResultRequest;
 import org.simantics.db.common.utils.ListUtils;
-import org.simantics.db.common.utils.Logger;
 import org.simantics.db.common.utils.NameUtils;
 import org.simantics.db.common.utils.OrderedSetUtils;
 import org.simantics.db.common.utils.VersionInfo;
@@ -166,12 +165,16 @@ import org.simantics.utils.datastructures.Pair;
 import org.simantics.utils.datastructures.Triple;
 import org.simantics.utils.datastructures.hints.HintContext;
 import org.simantics.utils.ui.dialogs.ListDialog;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * @author Hannu Niemistö
  */
 public class ModelingUtils {
 
+       private static final Logger LOGGER = LoggerFactory.getLogger(ModelingUtils.class);
+
        private ReadGraph g;
        private WriteGraph wg;
        public Layer0 b;
@@ -478,7 +481,7 @@ public class ModelingUtils {
                        
 
                } catch (Exception e) {
-                       Logger.defaultLogError(e);
+                       LOGGER.error("Model import failed", e);
                }
 
        }
@@ -598,7 +601,9 @@ public class ModelingUtils {
        }
 
     public static void untrackDependencies() {
-       untrackDependencies(Simantics.getSession());
+        Session s = Simantics.peekSession();
+        if (s != null)
+            untrackDependencies(s);
     }
 
        public static void untrackDependencies(RequestProcessor processor) {
@@ -615,7 +620,7 @@ public class ModelingUtils {
                 
             });
         } catch (DatabaseException e) {
-            Logger.defaultLogError(e);
+            LOGGER.error("untrackDependenices failed", e);
         }
 
     }
@@ -638,7 +643,7 @@ public class ModelingUtils {
                 
             });
         } catch (DatabaseException e) {
-            Logger.defaultLogError(e);
+            LOGGER.error("trackDependenices failed", e);
         }
 
        }
@@ -1256,7 +1261,7 @@ public class ModelingUtils {
                        return advisor.getRoot();
 
                } catch (Throwable t) {
-                       Logger.defaultLogError("Unexpected exception while importing diagram template.", t);
+                       LOGGER.error("Unexpected exception while importing diagram template.", t);
                } finally {
                }
 
@@ -1442,7 +1447,7 @@ public class ModelingUtils {
                Variant draftStatus = dc.metadata.get(DraftStatusBean.EXTENSION_KEY);
                return MigrationUtils.importSharedOntology(Simantics.getSession(), tg, draftStatus == null);
        } catch (Exception e) {
-               Logger.defaultLogError(e);
+               LOGGER.error("importSharedOntologyWithResult failed", e);
                throw e;
        }
     }