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;
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;
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;
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) {
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);
return this;
}
- public GraphExplorerFactory selectionTransformation(BinaryFunction<Object[], GraphExplorer, Object[]> transformation) {
+ public GraphExplorerFactory selectionTransformation(BiFunction<GraphExplorer, Object[], Object[]> transformation) {
this.selectionTransformation = transformation;
return this;
}
//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);