]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/GraphExplorerFactory.java
Sync git svn branch with SVN repository r33144.
[simantics/platform.git] / bundles / org.simantics.browsing.ui.swt / src / org / simantics / browsing / ui / swt / GraphExplorerFactory.java
index 35a3d1cfb32dbb4764dfba661fab989c6a0e9158..44464b3576ced31074a525c7e2fef41056ad3b1e 100644 (file)
  *******************************************************************************/\r
 package org.simantics.browsing.ui.swt;\r
 \r
+import java.lang.reflect.Method;\r
+\r
+import org.eclipse.core.runtime.Platform;\r
 import org.eclipse.swt.SWT;\r
 import org.eclipse.swt.widgets.Composite;\r
 import org.eclipse.ui.services.IServiceLocator;\r
+import org.osgi.framework.Bundle;\r
 import org.simantics.Simantics;\r
 import org.simantics.browsing.ui.BuiltinKeys;\r
 import org.simantics.browsing.ui.GraphExplorer;\r
@@ -32,6 +36,7 @@ import org.simantics.db.layer0.variable.Variables;
 import org.simantics.simulation.ontology.SimulationResource;\r
 import org.simantics.utils.datastructures.BinaryFunction;\r
 import org.simantics.utils.datastructures.hints.IHintContext;\r
+import org.simantics.utils.ui.ExceptionUtils;\r
 \r
 /**\r
  * @author Tuukka Lehtonen\r
@@ -184,6 +189,26 @@ public class GraphExplorerFactory {
         explorer.setServiceLocator(serviceLocator);\r
         return explorer;\r
     }\r
+    \r
+    public GraphExplorer create3(Composite parent, int style) {\r
+        //GraphExplorerImpl2 explorer = new GraphExplorerImpl2(parent, style);\r
+       try {\r
+               Bundle bundle = Platform.getBundle("org.simantics.browsing.ui.nattable");\r
+               Class<GraphExplorer> clazz = (Class<GraphExplorer>)bundle.loadClass("org.simantics.browsing.ui.nattable.NatTableGraphExplorer");\r
+               //Class<GraphExplorer> clazz = (Class<GraphExplorer>)bundle.getClass().getClassLoader().loadClass("org.simantics.browsing.ui.nattable.NatTableGraphExplorer");\r
+               GraphExplorer explorer = clazz.getConstructor(Composite.class, int.class).newInstance(parent,style);\r
+               explorer.setSelectionDataResolver(selectionDataResolver);\r
+               explorer.setSelectionFilter(selectionFilter);\r
+               explorer.setSelectionTransformation(selectionTransformation);\r
+               Method m = clazz.getMethod("setServiceLocator", IServiceLocator.class);\r
+               m.invoke(explorer, serviceLocator);\r
+               //explorer.setServiceLocator(serviceLocator);\r
+               return explorer;\r
+       } catch (Throwable t) {\r
+               ExceptionUtils.logAndShowError(t);\r
+               return null;\r
+       }\r
+    }\r
 \r
 //    void hookActions(IWorkbenchSite site) {\r
 //        IActionBars actionBars = null;\r