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%2Fwidgets%2FGraphExplorerComposite.java;h=a83c44ab1a3d39daa6573ae55bb0079fb775b4ec;hp=5e324fa760d25fea3e0e8a298299806f7d337d0c;hb=96bb7ef9cbe42d82eb58306d8f9b62392cc29ba8;hpb=ae5bb63c5c88f6569518fed2a24df86fbd0570ff diff --git a/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/widgets/GraphExplorerComposite.java b/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/widgets/GraphExplorerComposite.java index 5e324fa76..a83c44ab1 100644 --- a/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/widgets/GraphExplorerComposite.java +++ b/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/widgets/GraphExplorerComposite.java @@ -363,6 +363,8 @@ public class GraphExplorerComposite extends Composite implements Widget, IAdapta if (args.containsKey("treeView") && Boolean.TRUE.equals(args.get("treeView"))) { explorer = createExplorerControl2(explorerComposite, maxChildren); + } else if (args.containsKey("natTable") && Boolean.TRUE.equals(args.get("natTable"))) { + explorer = createExplorerControl3(explorerComposite, maxChildren); } else { explorer = createExplorerControl(explorerComposite, maxChildren); } @@ -418,7 +420,7 @@ public class GraphExplorerComposite extends Composite implements Widget, IAdapta } public void addListenerToControl(int eventType, Listener listener) { - ((Tree)explorer.getControl()).addListener(eventType, listener); + ((Control)explorer.getControl()).addListener(eventType, listener); } public void finish() { @@ -529,6 +531,7 @@ public class GraphExplorerComposite extends Composite implements Widget, IAdapta DropTarget target = new DropTarget(control, DND.DROP_COPY | DND.DROP_LINK); target.setTransfer(getAcceptedDataTypes()); + if (control instanceof Tree) { target.addDropListener(new DropTargetListener() { Tree tree = (Tree)explorer.getControl(); @@ -570,6 +573,7 @@ public class GraphExplorerComposite extends Composite implements Widget, IAdapta } }); + } // Add workbench listeners and make sure they are cleaned up setWorkbenchListeners(); @@ -1049,6 +1053,19 @@ public class GraphExplorerComposite extends Composite implements Widget, IAdapta return ge; } + + protected GraphExplorer createExplorerControl3(Composite parent, Integer maxChildren) { + GraphExplorerFactory factory = GraphExplorerFactory.getInstance(); + if(maxChildren != null) factory = factory.maxChildrenShown(maxChildren); + + GraphExplorer ge = factory + .selectionDataResolver(new DefaultSelectionDataResolver()) + .selectionTransformation(selectionTransformation) + .setServiceLocator(site) + .create3(parent, style); + + return ge; + } protected void setupDragSource(Session session) { if (dragSource instanceof SessionContainer) {