@Nullable
    static DBNNode getNodeFromSelection(ISelection selection) {
        DBNNode node = null;
        if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
            Object selectedObject = ((IStructuredSelection)selection).getFirstElement();
            node = RuntimeUtils.getObjectAdapter(selectedObject, DBNNode.class);
        }
        return node;
    }
Sorry, this is a bit over-complicated handler. Historical reasons.
It can create object of specified type (in parameters) or for current selection.
Dynamic menu "Create" fills elements with parameters. Direct contribution of create command will create nearest
object type according to navigator selection.
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/actions/NavigatorHandlerObjectCreateNew.java