@Nullable
    public static DBPDataSourceContainer getActiveDataSourceContainer(ExecutionEvent event, boolean useEditor) {
        IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
        IEditorPart activeEditor = useEditor ? HandlerUtil.getActiveEditor(event) : null;
        ISelection selection = HandlerUtil.getCurrentSelection(event);

        return getActiveDataSourceContainer(activeEditor, activePart, selection);
    }
Get execution context from active editor or active selection
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/actions/AbstractDataSourceHandler.java