From: Tuukka Lehtonen Date: Thu, 7 Dec 2017 07:03:13 +0000 (+0200) Subject: Use Consumer interface instead of deprecated Callback interface. X-Git-Tag: v1.31.0~1 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F93%2F1293%2F1;p=simantics%2Fsysdyn.git Use Consumer interface instead of deprecated Callback interface. refs #7655 Change-Id: I1693131d49f2dbcd29da41abe2e8c66f72e2aa81 --- diff --git a/bundles/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/participant/SysdynConnectTool.java b/bundles/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/participant/SysdynConnectTool.java index e08193ea..f4faa9fd 100644 --- a/bundles/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/participant/SysdynConnectTool.java +++ b/bundles/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/participant/SysdynConnectTool.java @@ -56,7 +56,6 @@ import org.simantics.sysdyn.ui.elements.SysdynElementHints; import org.simantics.sysdyn.ui.elements.ValveFactory.ValveSceneGraph; import org.simantics.sysdyn.ui.elements.connections.ConnectionClasses; import org.simantics.ui.SimanticsUI; -import org.simantics.utils.datastructures.Callback; import org.simantics.utils.datastructures.Pair; import org.simantics.utils.ui.ErrorLogger; import org.simantics.utils.ui.ExceptionUtils; @@ -461,12 +460,9 @@ public class SysdynConnectTool extends ConnectTool2 { public void perform(WriteGraph graph) throws DatabaseException { builder.create(graph, judgment, controlPoints, startTerminal, endTerminal); } - }, new Callback() { - @Override - public void run(DatabaseException parameter) { - if (parameter != null) - ExceptionUtils.logAndShowError(parameter); - } + }, e -> { + if (e != null) + ExceptionUtils.logAndShowError(e); }); - } + } } diff --git a/bundles/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/LoopNode.java b/bundles/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/LoopNode.java index 865ddf65..57289682 100644 --- a/bundles/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/LoopNode.java +++ b/bundles/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/LoopNode.java @@ -86,7 +86,7 @@ public class LoopNode extends HoverShapeNode { List loopItems = getAllLoopItems(); // Get the diagram where this loop is. - RTreeNode diagramNode = (RTreeNode)NodeUtil.getNearestParentOfType(this, RTreeNode.class); + RTreeNode diagramNode = (RTreeNode)NodeUtil.getPossibleNearestParentOfType(this, RTreeNode.class); if (diagramNode == null) return; diff --git a/bundles/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/VariableValueSubscription.java b/bundles/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/VariableValueSubscription.java index a283e94c..74915bab 100644 --- a/bundles/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/VariableValueSubscription.java +++ b/bundles/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/VariableValueSubscription.java @@ -24,7 +24,6 @@ import org.simantics.db.procedure.Listener; import org.simantics.db.request.ExternalRead; import org.simantics.db.service.QueryControl; import org.simantics.utils.ObjectUtils; -import org.simantics.utils.datastructures.Callback; public class VariableValueSubscription { @@ -106,12 +105,9 @@ public class VariableValueSubscription { requests.add(read); graph.getService(QueryControl.class).gc(graph, requests); } - }, new Callback() { - @Override - public void run(DatabaseException e) { - if (e != null) - e.printStackTrace(); - } + }, e -> { + if (e != null) + e.printStackTrace(); }); }