X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.browsing.ui.swt%2Fsrc%2Forg%2Fsimantics%2Fbrowsing%2Fui%2Fswt%2FGraphExplorerFactory.java;h=3312430ddd9903b29a0aa26dee364b3fe0edd3e9;hb=HEAD;hp=de421565951a2a3b025856676954f469c897e534;hpb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/GraphExplorerFactory.java b/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/GraphExplorerFactory.java index de4215659..3312430dd 100644 --- a/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/GraphExplorerFactory.java +++ b/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/GraphExplorerFactory.java @@ -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; @@ -24,6 +25,7 @@ import org.simantics.browsing.ui.GraphExplorer; import org.simantics.browsing.ui.NodeContext; import org.simantics.browsing.ui.SelectionDataResolver; import org.simantics.browsing.ui.SelectionFilter; +import org.simantics.browsing.ui.common.AdaptableHintContext; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.common.request.PossibleTypedParent; @@ -34,7 +36,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 +51,7 @@ public class GraphExplorerFactory { private IServiceLocator serviceLocator; - private BinaryFunction selectionTransformation = new BinaryFunction() { + private BiFunction selectionTransformation = new BiFunction() { private Resource getModel(final Object object) { if(object instanceof NodeContext) { @@ -90,9 +91,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 +120,7 @@ public class GraphExplorerFactory { return this; } - public GraphExplorerFactory selectionTransformation(BinaryFunction transformation) { + public GraphExplorerFactory selectionTransformation(BiFunction transformation) { this.selectionTransformation = transformation; return this; } @@ -194,7 +194,8 @@ public class GraphExplorerFactory { //GraphExplorerImpl2 explorer = new GraphExplorerImpl2(parent, style); try { Bundle bundle = Platform.getBundle("org.simantics.browsing.ui.nattable"); - Class clazz = (Class)bundle.loadClass("org.simantics.browsing.ui.nattable.NatTableGraphExplorer"); + @SuppressWarnings("unchecked") + Class clazz = (Class)bundle.loadClass("org.simantics.browsing.ui.nattable.NatTableGraphExplorer"); //Class clazz = (Class)bundle.getClass().getClassLoader().loadClass("org.simantics.browsing.ui.nattable.NatTableGraphExplorer"); GraphExplorer explorer = clazz.getConstructor(Composite.class, int.class).newInstance(parent,style); explorer.setSelectionDataResolver(selectionDataResolver);