From 19308b2d36f9a4b37c3f81757ae8acd213b7823e Mon Sep 17 00:00:00 2001 From: Tuukka Lehtonen Date: Thu, 20 Feb 2020 23:55:15 +0200 Subject: [PATCH] Use slf4j logging in ModelledView gitlab #473 Change-Id: I6b0bbbb4a8fe375ee0ad434d3e8f42c1c235f3e8 --- .../META-INF/MANIFEST.MF | 3 ++- .../org/simantics/views/swt/ModelledView.java | 22 +++++++++---------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/bundles/org.simantics.views.swt/META-INF/MANIFEST.MF b/bundles/org.simantics.views.swt/META-INF/MANIFEST.MF index 18048f38c..f90a7a7dd 100644 --- a/bundles/org.simantics.views.swt/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.views.swt/META-INF/MANIFEST.MF @@ -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 diff --git a/bundles/org.simantics.views.swt/src/org/simantics/views/swt/ModelledView.java b/bundles/org.simantics.views.swt/src/org/simantics/views/swt/ModelledView.java index f50954857..f32fac686 100644 --- a/bundles/org.simantics.views.swt/src/org/simantics/views/swt/ModelledView.java +++ b/bundles/org.simantics.views.swt/src/org/simantics/views/swt/ModelledView.java @@ -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); } } -- 2.47.1