{
final int contextCount = context.getReportRenderContextCount();
final ArrayList<ReportRenderContext> contexts = new ArrayList<ReportRenderContext>(contextCount);
for (int i = 0; i < contextCount; i++)
{
final ReportRenderContext renderContext = context.getReportRenderContext(i);
if (renderContext == activeContext)
{
continue;
}
if (ModelUtility.isDescendant(renderContext.getReportDefinition(), activeContext.getReportDefinition()) == false)
{
contexts.add(renderContext);
}
}
final ReportRenderContext[] contextArray = contexts.toArray(new ReportRenderContext[contexts.size()]);
final ReportRenderContext[] filteredArray =
CloseReportAction.filterSubreports(getReportDesignerContext(), contextArray);
for (int i = 0; i < filteredArray.length; i++)
{
final ReportRenderContext reportRenderContext = filteredArray[i];
if (CloseReportAction.performCloseReport(getReportDesignerContext(), reportRenderContext) == false)
{
return;
}
}