private DatabaseNavigatorTree createNavigatorTree(Composite parent, DBNNode rootNode) {
        // Create tree
        final DatabaseNavigatorTree navigatorTree = new DatabaseNavigatorTree(parent, rootNode, getTreeStyle(), false, getNavigatorFilter());

        createTreeColumns(navigatorTree);

        navigatorTree.getViewer().addSelectionChangedListener(
            event -> onSelectionChange((IStructuredSelection)event.getSelection())
        );
        navigatorTree.getViewer().getTree().addListener(SWT.MouseDoubleClick, event -> {
            event.doit = false;
        });
        navigatorTree.getViewer().getTree().addMouseListener(new MouseAdapter() {
            @Override
            public void mouseDoubleClick(MouseEvent e) {
                super.mouseDoubleClick(e);
            }

            @Override
            public void mouseDown(MouseEvent e) {
                super.mouseDown(e);
            }

            @Override
            public void mouseUp(MouseEvent e) {
                super.mouseUp(e);
                // Commented because it forced selection reset on connection expand
/*
                Point point = new Point(e.x, e.y);
                TreeItem item = navigatorTree.getViewer().getTree().getItem(point);
                if (item == null) {
                    navigatorTree.getViewer().setSelection(new StructuredSelection());
                } 
*/
            }
        });
        navigatorTree.getViewer().addDoubleClickListener(event -> {
            TreeViewer viewer = tree.getViewer();
            IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
            for (Object node : selection.toArray()) {
                //Object node = selection.getFirstElement();
                if ((node instanceof DBNResource && ((DBNResource) node).getResource() instanceof IFolder)) {
                    toggleNode(viewer, node);
                } else if (node instanceof DBNDataSource) {
                    NavigatorPreferences.DoubleClickBehavior dsBehaviorDefault = CommonUtils.valueOf(
                        NavigatorPreferences.DoubleClickBehavior.class,
                        DBWorkbench.getPlatform().getPreferenceStore().getString(NavigatorPreferences.NAVIGATOR_CONNECTION_DOUBLE_CLICK),
                        NavigatorPreferences.DoubleClickBehavior.EDIT);
                    if (dsBehaviorDefault == NavigatorPreferences.DoubleClickBehavior.EXPAND) {
                        toggleNode(viewer, node);
                    } else {
                        DBPDataSourceContainer dataSource = ((DBNDataSource) node).getObject();
                        switch (dsBehaviorDefault) {
                            case EDIT:
                                NavigatorHandlerObjectOpen.openEntityEditor((DBNDataSource) node, null, UIUtils.getActiveWorkbenchWindow());
                                break;
                            case CONNECT: {
                                UIServiceConnections serviceConnections = DBWorkbench.getService(UIServiceConnections.class);
                                if (serviceConnections != null) {
                                    if (dataSource.isConnected()) {
                                        serviceConnections.disconnectDataSource(dataSource);
                                    } else {
                                        serviceConnections.connectDataSource(dataSource, null);
                                    }
                                }
                                break;
                            }
                            case SQL_EDITOR: {
                                UIServiceSQL serviceSQL = DBWorkbench.getService(UIServiceSQL.class);
                                if (serviceSQL != null) {
                                    serviceSQL.openRecentScript(dataSource);
                                }
                                break;
                            }
                            case SQL_EDITOR_NEW: {
                                UIServiceSQL serviceSQL = DBWorkbench.getService(UIServiceSQL.class);
                                if (serviceSQL != null) {
                                    serviceSQL.openNewScript(dataSource);
                                }
                                break;
                            }
                        }
                    }
                } else if (node instanceof TreeNodeSpecial) {
                    ((TreeNodeSpecial) node).handleDefaultAction(navigatorTree);
                } else {
                    String defaultEditorPageId = null;
                    NavigatorPreferences.DoubleClickBehavior dcBehaviorDefault = CommonUtils.valueOf(
                        NavigatorPreferences.DoubleClickBehavior.class,
                        DBWorkbench.getPlatform().getPreferenceStore().getString(NavigatorPreferences.NAVIGATOR_OBJECT_DOUBLE_CLICK));

                    if (node instanceof DBNDatabaseNode && ((DBNDatabaseNode) node).getObject() instanceof DBSDataContainer) {
                        defaultEditorPageId = DBWorkbench.getPlatform().getPreferenceStore().getString(NavigatorPreferences.NAVIGATOR_DEFAULT_EDITOR_PAGE);
                    }
                    boolean hasChildren = node instanceof DBNNode && ((DBNNode) node).hasChildren(true);
                    if (hasChildren && dcBehaviorDefault == NavigatorPreferences.DoubleClickBehavior.EXPAND) {
                        toggleNode(viewer, node);
                    } else {
                        Map<String, Object> parameters = null;
                        if (!CommonUtils.isEmpty(defaultEditorPageId)) {
                            parameters = Collections.singletonMap(MultiPageDatabaseEditor.PARAMETER_ACTIVE_PAGE, defaultEditorPageId);
                        }
                        NavigatorUtils.executeNodeAction(DBXTreeNodeHandler.Action.open, node, parameters, getSite());
                    }
                }
            }
        });

        // Hook context menu
        NavigatorUtils.addContextMenu(this.getSite(), navigatorTree.getViewer());
        installDragAndDropSupport(navigatorTree);

        DBWorkbench.getPlatform().getPreferenceStore().addPropertyChangeListener(this);

        return navigatorTree;
    }
This is a callback that will allow us to create the viewer and initialize
it.
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/database/NavigatorViewBase.java