From 600dccd8a9699dabafd2308272ae13ab7c1dde9d Mon Sep 17 00:00:00 2001 From: lehtonen Date: Tue, 26 Apr 2016 12:52:04 +0000 Subject: [PATCH] (refs #6400) Changed code to use Consumer instead of Callback git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@32713 ac1ea38d-2e2b-0410-8846-a27921b304fc --- .../simantics/sysdyn/ui/elements/BorderSceneGraph.java | 7 ++++--- .../src/org/simantics/sysdyn/ui/elements/LoopFactory.java | 8 ++++---- .../sysdyn/ui/elements/SysdynTextElementNoBounds.java | 8 ++++---- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/BorderSceneGraph.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/BorderSceneGraph.java index 2126e9c3..e8cd1365 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/BorderSceneGraph.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/BorderSceneGraph.java @@ -12,15 +12,16 @@ package org.simantics.sysdyn.ui.elements; import java.awt.geom.AffineTransform; +import java.util.function.Consumer; + import org.simantics.g2d.element.ElementUtils; import org.simantics.g2d.element.IElement; import org.simantics.g2d.element.SceneGraphNodeKey; import org.simantics.g2d.element.handler.SceneGraph; import org.simantics.scenegraph.g2d.G2DParentNode; -import org.simantics.utils.datastructures.Callback; import org.simantics.utils.datastructures.hints.IHintContext.Key; -public class BorderSceneGraph implements SceneGraph, Callback { +public class BorderSceneGraph implements SceneGraph, Consumer { public static final BorderSceneGraph INSTANCE = new BorderSceneGraph(); @@ -40,7 +41,7 @@ public class BorderSceneGraph implements SceneGraph, Callback { } @Override - public void run(RectangleNode node) { + public void accept(RectangleNode node) { node.setZIndex(-10); } diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/LoopFactory.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/LoopFactory.java index 260588c2..6dd76892 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/LoopFactory.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/LoopFactory.java @@ -21,6 +21,7 @@ import java.awt.geom.Path2D; import java.awt.geom.Point2D; import java.awt.geom.RectangularShape; import java.util.Collection; +import java.util.function.Consumer; import org.simantics.databoard.Bindings; import org.simantics.db.ReadGraph; @@ -68,7 +69,6 @@ import org.simantics.sysdyn.SysdynResource; import org.simantics.sysdyn.ui.properties.LoopTab; import org.simantics.sysdyn.utils.LoopUtils; import org.simantics.ui.SimanticsUI; -import org.simantics.utils.datastructures.Callback; import org.simantics.utils.datastructures.hints.IHintContext.Key; import org.simantics.utils.datastructures.hints.IHintListener; import org.simantics.utils.datastructures.hints.IHintObservable; @@ -302,10 +302,10 @@ public class LoopFactory extends SysdynElementFactory { } @Override - protected Callback getCallback(final IElement e, G2DParentNode parent, Class nodeClass) { - return new Callback() { + protected Consumer getCallback(final IElement e, G2DParentNode parent, Class nodeClass) { + return new Consumer() { @Override - public void run(T node) { + public void accept(T node) { node.setTextListener(new ITextListener() { Resource component; diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/SysdynTextElementNoBounds.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/SysdynTextElementNoBounds.java index 7ea3a497..276bc066 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/SysdynTextElementNoBounds.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/SysdynTextElementNoBounds.java @@ -14,6 +14,7 @@ package org.simantics.sysdyn.ui.elements; import java.awt.Color; import java.awt.geom.AffineTransform; +import java.util.function.Consumer; import org.eclipse.swt.widgets.Control; import org.eclipse.ui.IWorkbenchPage; @@ -46,7 +47,6 @@ import org.simantics.sysdyn.SysdynResource; import org.simantics.sysdyn.ui.utils.SysdynWorkbenchUtils; import org.simantics.sysdyn.ui.utils.VariableNameValidator; import org.simantics.ui.SimanticsUI; -import org.simantics.utils.datastructures.Callback; import org.simantics.utils.datastructures.hints.IHintContext.Key; import org.simantics.utils.datastructures.hints.IHintContext.KeyOf; @@ -85,10 +85,10 @@ public class SysdynTextElementNoBounds extends TextElementNoBounds { // End constructors - protected Callback getCallback(final IElement e, G2DParentNode parent, Class nodeClass) { - return new Callback() { + protected Consumer getCallback(final IElement e, G2DParentNode parent, Class nodeClass) { + return new Consumer() { @Override - public void run(T node) { + public void accept(T node) { node.setTextListener(new ITextListener() { String textBeforeEdit; -- 2.47.1