X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.browsing.ui.swt%2Fsrc%2Forg%2Fsimantics%2Fbrowsing%2Fui%2Fswt%2FGraphExplorerFactory.java;h=44464b3576ced31074a525c7e2fef41056ad3b1e;hp=35a3d1cfb32dbb4764dfba661fab989c6a0e9158;hb=96bb7ef9cbe42d82eb58306;hpb=ae5bb63c5c88f6569518fed2a24df86fbd0570ff 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 35a3d1cfb..44464b357 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 @@ -11,9 +11,13 @@ *******************************************************************************/ package org.simantics.browsing.ui.swt; +import java.lang.reflect.Method; + +import org.eclipse.core.runtime.Platform; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.services.IServiceLocator; +import org.osgi.framework.Bundle; import org.simantics.Simantics; import org.simantics.browsing.ui.BuiltinKeys; import org.simantics.browsing.ui.GraphExplorer; @@ -32,6 +36,7 @@ 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; /** * @author Tuukka Lehtonen @@ -184,6 +189,26 @@ public class GraphExplorerFactory { explorer.setServiceLocator(serviceLocator); return explorer; } + + public GraphExplorer create3(Composite parent, int style) { + //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"); + //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); + explorer.setSelectionFilter(selectionFilter); + explorer.setSelectionTransformation(selectionTransformation); + Method m = clazz.getMethod("setServiceLocator", IServiceLocator.class); + m.invoke(explorer, serviceLocator); + //explorer.setServiceLocator(serviceLocator); + return explorer; + } catch (Throwable t) { + ExceptionUtils.logAndShowError(t); + return null; + } + } // void hookActions(IWorkbenchSite site) { // IActionBars actionBars = null;