// Extract the current project from the expression context.
// This must be set at the time the expression is about to be evaluated
// as either the MRC current project (for XDIME/PAPI) or the related
// owning policy project (for themes/layouts containing expressions)
CurrentProjectProvider projectProvider = (CurrentProjectProvider)
context.getProperty(CurrentProjectProvider.class);
Project currentProject = projectProvider.getCurrentProject();
if (currentProject == null) {
// This should never happen.
throw new IllegalStateException("No current project found to " +
"resolve against.");
}