@Nullable
    public static DatabaseNavigatorTree getNavigatorTree(@Nullable IServiceLocator locator) {
        DatabaseNavigatorTree tree = DatabaseNavigatorTree.getFromShell(Display.getCurrent());
        if (tree != null) {
            return tree;
        }
        if (locator != null) {
            IWorkbenchPartSite partSite = UIUtils.getWorkbenchPartSite(locator);
            if (partSite != null && partSite.getPart() instanceof DatabaseNavigatorView view) {
                return view.getNavigatorTree();
            }
        }
        return null;
    }
Find selected node for specified UI element
@param element ui element
@return node or null
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/NavigatorUtils.java