Use slf4j logging in ModelledView 97/3897/2
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Thu, 20 Feb 2020 21:55:15 +0000 (23:55 +0200)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Thu, 20 Feb 2020 21:56:19 +0000 (23:56 +0200)
gitlab #473

Change-Id: I6b0bbbb4a8fe375ee0ad434d3e8f42c1c235f3e8

bundles/org.simantics.views.swt/META-INF/MANIFEST.MF
bundles/org.simantics.views.swt/src/org/simantics/views/swt/ModelledView.java

index 18048f38c7654a2b322b317d8370b4f32d537460..f90a7a7dd847d09e556ee73ece6d8ca228c9ab2b 100644 (file)
@@ -16,7 +16,8 @@ Require-Bundle: org.simantics.browsing.ui.swt;bundle-version="1.1.0";visibility:
  org.simantics.project;bundle-version="1.0.1",
  org.simantics.scenegraph.loader;bundle-version="1.0.0";visibility:=reexport,
  org.simantics.scenegraph.ontology;bundle-version="1.0.0",
- org.simantics.utils.thread.swt;bundle-version="1.1.0"
+ org.simantics.utils.thread.swt;bundle-version="1.1.0",
+ org.slf4j.api;bundle-version="1.7.25"
 Export-Package: org.simantics.views.swt
 Bundle-Activator: org.simantics.views.swt.Activator
 Bundle-Vendor: Semantum Oy
index f50954857e7d3611d7956968ece2559d6f9bf8ea..f32fac6865c545fa43e3e3c4beb7da984ffd4368 100644 (file)
@@ -36,9 +36,8 @@ import org.simantics.db.VirtualGraph;
 import org.simantics.db.WriteGraph;
 import org.simantics.db.common.request.WriteRequest;
 import org.simantics.db.common.request.WriteResultRequest;
-import org.simantics.db.common.utils.Logger;
 import org.simantics.db.exception.DatabaseException;
-import org.simantics.db.exception.ServiceNotFoundException;
+import org.simantics.db.exception.RuntimeDatabaseException;
 import org.simantics.db.layer0.util.RemoverUtil;
 import org.simantics.db.layer0.variable.Variable;
 import org.simantics.db.management.ISessionContext;
@@ -49,6 +48,8 @@ import org.simantics.scl.runtime.function.Function1;
 import org.simantics.ui.workbench.IPropertyPage;
 import org.simantics.utils.ui.jface.ActiveSelectionProvider;
 import org.simantics.views.swt.client.base.SWTRoot;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * To use this class, first model your view contents in .pgraph files according
@@ -67,6 +68,8 @@ import org.simantics.views.swt.client.base.SWTRoot;
  */
 public class ModelledView extends SimanticsView implements IPartListener2 {
 
+    private static final Logger LOGGER = LoggerFactory.getLogger(ModelledView.class);
+
     public static final int TIME_BEFORE_DISPOSE_WHEN_HIDDEN = 30000; // ms
     
     private static final boolean           DEBUG             = false;
@@ -114,10 +117,8 @@ public class ModelledView extends SimanticsView implements IPartListener2 {
                             return runtime;
                         }
                     });
-        } catch (ServiceNotFoundException e) {
-            Logger.defaultLogError(e);
-        } catch (DatabaseException e) {
-            Logger.defaultLogError(e);
+        } catch (RuntimeDatabaseException | DatabaseException e) {
+            LOGGER.error("Failed to initialize modelled widget support runtime scenegraph", e);
         }
 
         support = new ModelledSupport(this);
@@ -204,8 +205,7 @@ public class ModelledView extends SimanticsView implements IPartListener2 {
 
             } catch (DatabaseException e) {
 
-                e.printStackTrace();
-                Logger.defaultLogError(e);
+                LOGGER.error("Failed to create modelled controls", e);
 
             }
 
@@ -291,10 +291,8 @@ public class ModelledView extends SimanticsView implements IPartListener2 {
                     RemoverUtil.remove(graph, rt);
                 }
             });
-        } catch (ServiceNotFoundException e) {
-            Logger.defaultLogError(e);
-        } catch (DatabaseException e) {
-            Logger.defaultLogError(e);
+        } catch (RuntimeDatabaseException | DatabaseException e) {
+            LOGGER.error("Failed to dispose of the modelled widget support runtime scenegraph", e);
         }
     }