From: Tuukka Lehtonen Date: Tue, 21 Jan 2020 11:25:54 +0000 (+0200) Subject: Stop using SWT.MOZILLA X-Git-Tag: v1.43.0~120 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=7e18cf26899ede3bb984f88c70d70faa1d61e514;p=simantics%2Fplatform.git Stop using SWT.MOZILLA Fixed also logger-related deprecation warnings from VariableDebugger. gitlab #449 Change-Id: I44eaf65389a14b4ac4f7d3efde288d5d67b4c725 --- diff --git a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/GraphDebugger.java b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/GraphDebugger.java index 46d31fabe..559b0e702 100644 --- a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/GraphDebugger.java +++ b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/GraphDebugger.java @@ -496,7 +496,7 @@ public class GraphDebugger extends Composite { public Browser createBrowser(Composite parent) { try { - browser = new Browser(parent, SWT.MOZILLA); + browser = new Browser(parent, SWT.WEBKIT); } catch (SWTError e) { //System.out.println("Could not instantiate Browser: " + e.getMessage()); browser = new Browser(parent, SWT.NONE); diff --git a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/VariableDebugger.java b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/VariableDebugger.java index 697a58939..c1f47624d 100644 --- a/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/VariableDebugger.java +++ b/bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/VariableDebugger.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 Association for Decentralized Information Management + * Copyright (c) 2007, 2020 Association for Decentralized Information Management * in Industry THTH ry. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -65,7 +65,6 @@ import org.simantics.db.Session; import org.simantics.db.common.ResourceArray; import org.simantics.db.common.procedure.adapter.DisposableListener; import org.simantics.db.common.request.UnaryRead; -import org.simantics.db.common.utils.Logger; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.SelectionHints; import org.simantics.db.layer0.request.PossibleURI; @@ -90,6 +89,8 @@ import org.simantics.utils.bytes.Base64; import org.simantics.utils.ui.ErrorLogger; import org.simantics.utils.ui.ISelectionUtils; import org.simantics.utils.ui.PathUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** @@ -98,6 +99,8 @@ import org.simantics.utils.ui.PathUtils; */ public class VariableDebugger extends Composite { + private static final Logger LOGGER = LoggerFactory.getLogger(VariableDebugger.class); + public interface HistoryListener { void historyChanged(); } @@ -166,7 +169,7 @@ public class VariableDebugger extends Composite { @Override public void exception(Throwable t) { - Logger.defaultLogError(t); + LOGGER.error("Page content listener failed unexpectedly", t); } } @@ -261,15 +264,16 @@ public class VariableDebugger extends Composite { @Override public void drop(DropTargetEvent event) { label.setBackground(null); + String uri = null; try { - String uri = parseUri(event); + uri = parseUri(event); if (uri == null) { event.detail = DND.DROP_NONE; return; } changeLocation(uri); } catch (DatabaseException e) { - Logger.defaultLogError(e); + LOGGER.error("Changing location to URI {} failed", uri, e); } } @@ -330,13 +334,14 @@ public class VariableDebugger extends Composite { @Override public void widgetSelected(SelectionEvent e) { + String uri = null; try { - String uri = text.getText(); + uri = text.getText(); // Make sure that URI is resolvable to Variable session.sync(new ResourceURIToVariable(uri)); changeLocation(uri); } catch (DatabaseException e1) { - Logger.defaultLogError(e1); + LOGGER.error("Lookup failed for URI {}", uri, e1); } } @@ -356,7 +361,7 @@ public class VariableDebugger extends Composite { public Browser createBrowser(Composite parent) { try { - browser = new Browser(parent, SWT.MOZILLA); + browser = new Browser(parent, SWT.NONE); } catch (SWTError e) { //System.out.println("Could not instantiate Browser: " + e.getMessage()); browser = new Browser(parent, SWT.NONE); @@ -594,9 +599,9 @@ public class VariableDebugger extends Composite { else return value != null ? getValue(graph, r, value) : "null"; //$NON-NLS-1$ } catch (Throwable e) { try { - Logger.defaultLogError("getValue " + r.getURI(graph), e); //$NON-NLS-1$ + LOGGER.error("getValue({})", r.getURI(graph), e); //$NON-NLS-1$ } catch (DatabaseException e1) { - Logger.defaultLogError(e1); + LOGGER.error("Failed to get URI for problematic value variable", e1); } return e.getMessage(); } @@ -634,7 +639,7 @@ public class VariableDebugger extends Composite { String encoded = Base64.encode(uri.getBytes(utf8)); return encoded; } catch (Exception e) { - Logger.defaultLogError(e); + LOGGER.error("Failed to construct link string for variable", e); //$NON-NLS-1$ return e.getMessage(); } } @@ -681,11 +686,11 @@ public class VariableDebugger extends Composite { String rviString = getRVIString(graph, var); Object node = null; if(var instanceof AbstractChildVariable) { - VariableNode vn = ((AbstractChildVariable)var).node; + VariableNode vn = ((AbstractChildVariable)var).node; if(vn != null) node = vn.node; } if(var instanceof AbstractPropertyVariable) { - VariableNode vn = ((AbstractPropertyVariable)var).node; + VariableNode vn = ((AbstractPropertyVariable)var).node; if(vn != null) node = vn.node; }