]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.views.swt/src/org/simantics/views/swt/ModelledView.java
Use slf4j logging in ModelledView
[simantics/platform.git] / bundles / org.simantics.views.swt / src / org / simantics / views / swt / ModelledView.java
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);
         }
     }