call InputTermBuilder.getMatchingAncestor(..) to get a selection that is consistent with the selection you get for actions.