]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/GraphExplorerFactory.java
Replaced use of deprecated BinaryFunction et al with BiFunction et al
[simantics/platform.git] / bundles / org.simantics.browsing.ui.swt / src / org / simantics / browsing / ui / swt / GraphExplorerFactory.java
index de421565951a2a3b025856676954f469c897e534..b99962bf00d579c6ceb3cf8e0d4eea39a85abe73 100644 (file)
@@ -12,6 +12,7 @@
 package org.simantics.browsing.ui.swt;
 
 import java.lang.reflect.Method;
+import java.util.function.BiFunction;
 
 import org.eclipse.core.runtime.Platform;
 import org.eclipse.swt.SWT;
@@ -34,7 +35,6 @@ import org.simantics.db.layer0.SelectionHints;
 import org.simantics.db.layer0.variable.Variable;
 import org.simantics.db.layer0.variable.Variables;
 import org.simantics.simulation.ontology.SimulationResource;
-import org.simantics.utils.datastructures.BinaryFunction;
 import org.simantics.utils.datastructures.hints.IHintContext;
 import org.simantics.utils.ui.ExceptionUtils;
 
@@ -50,7 +50,7 @@ public class GraphExplorerFactory {
 
     private IServiceLocator        serviceLocator;
 
-    private BinaryFunction<Object[], GraphExplorer, Object[]>  selectionTransformation = new BinaryFunction<Object[], GraphExplorer, Object[]>() {
+    private BiFunction<GraphExplorer, Object[], Object[]> selectionTransformation = new BiFunction<GraphExplorer, Object[], Object[]>() {
 
        private Resource getModel(final Object object) {
                if(object instanceof NodeContext) {
@@ -90,9 +90,8 @@ public class GraphExplorerFactory {
                return null;
        }
        
-       
         @Override
-        public Object[] call(GraphExplorer explorer, Object[] objects) {
+        public Object[] apply(GraphExplorer explorer, Object[] objects) {
             Object[] result = new Object[objects.length];
             for (int i = 0; i < objects.length; i++) {
                 IHintContext context = new AdaptableHintContext(SelectionHints.KEY_MAIN);
@@ -120,7 +119,7 @@ public class GraphExplorerFactory {
         return this;
     }
 
-    public GraphExplorerFactory selectionTransformation(BinaryFunction<Object[], GraphExplorer, Object[]> transformation) {
+    public GraphExplorerFactory selectionTransformation(BiFunction<GraphExplorer, Object[], Object[]> transformation) {
         this.selectionTransformation = transformation;
         return this;
     }
@@ -194,7 +193,8 @@ public class GraphExplorerFactory {
         //GraphExplorerImpl2 explorer = new GraphExplorerImpl2(parent, style);
        try {
                Bundle bundle = Platform.getBundle("org.simantics.browsing.ui.nattable");
-               Class<GraphExplorer> clazz = (Class<GraphExplorer>)bundle.loadClass("org.simantics.browsing.ui.nattable.NatTableGraphExplorer");
+               @SuppressWarnings("unchecked")
+                       Class<GraphExplorer> clazz = (Class<GraphExplorer>)bundle.loadClass("org.simantics.browsing.ui.nattable.NatTableGraphExplorer");
                //Class<GraphExplorer> clazz = (Class<GraphExplorer>)bundle.getClass().getClassLoader().loadClass("org.simantics.browsing.ui.nattable.NatTableGraphExplorer");
                GraphExplorer explorer = clazz.getConstructor(Composite.class, int.class).newInstance(parent,style);
                explorer.setSelectionDataResolver(selectionDataResolver);