@NotNull
    public List<SQLScriptElement> getSelectedQueries() {
        List<SQLScriptElement> elements = new ArrayList<>();
        ITextSelection selection = (ITextSelection) getSelectionProvider().getSelection();

        if (selection.getLength() > 1) {
            elements.addAll(extractScriptQueries(selection.getOffset(), selection.getLength(), true, false, true));
        } else {
            SQLScriptElement query = extractActiveQuery();
            if (query != null) {
                elements.add(query);
            }
        }

        return elements;
    }
Obtain the add-in instance by its concrete type
plugins/org.jkiss.dbeaver.ui.editors.sql/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditor.java