{
}
public void actionPerformed(final ActionEvent e)
{
final ReportDesignerContext designerContext = getReportDesignerContext();
if (designerContext == null)
{
return;
}
final ReportDocumentContext activeReportContext = getActiveContext();
if (activeReportContext == null)
{
return;
}
final DocumentContextSelectionModel selectionModel1 = getSelectionModel();
if (selectionModel1 == null)
{
return;
}
final Object leadSelection = selectionModel1.getLeadSelection();
if (leadSelection instanceof Element == false)
{
return;
}
final Element element = (Element) leadSelection;
if (element instanceof SubReport)
{
final int contextCount = designerContext.getReportRenderContextCount();
for (int i = 0; i < contextCount; i++)
{
final ReportRenderContext rrc = designerContext.getReportRenderContext(i);
if (rrc.getReportDefinition() == element)
{
designerContext.setActiveDocument(rrc);
return;
}
}
final SubReport report = (SubReport) element;
try
{
designerContext.addSubReport(activeReportContext, report);
}
catch (ReportDataFactoryException e1)
{
UncaughtExceptionsModel.getInstance().addException(e1);
}