]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
(refs #6400) Changed code to use Consumer<T> instead of Callback<T>
authorlehtonen <lehtonen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Tue, 26 Apr 2016 12:52:04 +0000 (12:52 +0000)
committerlehtonen <lehtonen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Tue, 26 Apr 2016 12:52:04 +0000 (12:52 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@32713 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/BorderSceneGraph.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/LoopFactory.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/SysdynTextElementNoBounds.java

index 2126e9c3a5b2e027ca0f819f68155825653004e4..e8cd1365ab1d4180939acd2bba3a4bc32a7a22e4 100644 (file)
 package org.simantics.sysdyn.ui.elements;\r
 \r
 import java.awt.geom.AffineTransform;\r
+import java.util.function.Consumer;\r
+\r
 import org.simantics.g2d.element.ElementUtils;\r
 import org.simantics.g2d.element.IElement;\r
 import org.simantics.g2d.element.SceneGraphNodeKey;\r
 import org.simantics.g2d.element.handler.SceneGraph;\r
 import org.simantics.scenegraph.g2d.G2DParentNode;\r
-import org.simantics.utils.datastructures.Callback;\r
 import org.simantics.utils.datastructures.hints.IHintContext.Key;\r
 \r
-public class BorderSceneGraph implements SceneGraph, Callback<RectangleNode> {\r
+public class BorderSceneGraph implements SceneGraph, Consumer<RectangleNode> {\r
 \r
     public static final BorderSceneGraph INSTANCE         = new BorderSceneGraph();\r
 \r
@@ -40,7 +41,7 @@ public class BorderSceneGraph implements SceneGraph, Callback<RectangleNode> {
     }\r
 \r
     @Override\r
-    public void run(RectangleNode node) {\r
+    public void accept(RectangleNode node) {\r
         node.setZIndex(-10);\r
     }\r
 \r
index 260588c24e0c615281c1538238fe36c3efc2ddba..6dd76892c202a90b6fe995c665c878e570717b1e 100644 (file)
@@ -21,6 +21,7 @@ import java.awt.geom.Path2D;
 import java.awt.geom.Point2D;\r
 import java.awt.geom.RectangularShape;\r
 import java.util.Collection;\r
+import java.util.function.Consumer;\r
 \r
 import org.simantics.databoard.Bindings;\r
 import org.simantics.db.ReadGraph;\r
@@ -68,7 +69,6 @@ import org.simantics.sysdyn.SysdynResource;
 import org.simantics.sysdyn.ui.properties.LoopTab;\r
 import org.simantics.sysdyn.utils.LoopUtils;\r
 import org.simantics.ui.SimanticsUI;\r
-import org.simantics.utils.datastructures.Callback;\r
 import org.simantics.utils.datastructures.hints.IHintContext.Key;\r
 import org.simantics.utils.datastructures.hints.IHintListener;\r
 import org.simantics.utils.datastructures.hints.IHintObservable;\r
@@ -302,10 +302,10 @@ public class LoopFactory extends SysdynElementFactory {
                }\r
 \r
                @Override\r
-               protected <T extends SysdynTextNode> Callback<T> getCallback(final IElement e, G2DParentNode parent, Class<T> nodeClass) {\r
-                       return new Callback<T>() {\r
+               protected <T extends SysdynTextNode> Consumer<T> getCallback(final IElement e, G2DParentNode parent, Class<T> nodeClass) {\r
+                       return new Consumer<T>() {\r
                                @Override\r
-                               public void run(T node) {\r
+                               public void accept(T node) {\r
                                        node.setTextListener(new ITextListener() {\r
 \r
                                                Resource component;\r
index 7ea3a4974bc8653709f3cdc1be7856fb0bbd445d..276bc0669dd32bd6ddda1abc08b76e49f3cd8328 100644 (file)
@@ -14,6 +14,7 @@ package org.simantics.sysdyn.ui.elements;
 \r
 import java.awt.Color;\r
 import java.awt.geom.AffineTransform;\r
+import java.util.function.Consumer;\r
 \r
 import org.eclipse.swt.widgets.Control;\r
 import org.eclipse.ui.IWorkbenchPage;\r
@@ -46,7 +47,6 @@ import org.simantics.sysdyn.SysdynResource;
 import org.simantics.sysdyn.ui.utils.SysdynWorkbenchUtils;\r
 import org.simantics.sysdyn.ui.utils.VariableNameValidator;\r
 import org.simantics.ui.SimanticsUI;\r
-import org.simantics.utils.datastructures.Callback;\r
 import org.simantics.utils.datastructures.hints.IHintContext.Key;\r
 import org.simantics.utils.datastructures.hints.IHintContext.KeyOf;\r
 \r
@@ -85,10 +85,10 @@ public class SysdynTextElementNoBounds extends TextElementNoBounds {
 \r
     // End constructors\r
 \r
-    protected <T extends SysdynTextNode> Callback<T> getCallback(final IElement e, G2DParentNode parent, Class<T> nodeClass) {\r
-        return new Callback<T>() {\r
+    protected <T extends SysdynTextNode> Consumer<T> getCallback(final IElement e, G2DParentNode parent, Class<T> nodeClass) {\r
+        return new Consumer<T>() {\r
             @Override\r
-            public void run(T node) {\r
+            public void accept(T node) {\r
                 node.setTextListener(new ITextListener() {\r
 \r
                     String textBeforeEdit;\r