undo.addChange(Messages.getString("SubreportReportElementDragHandler.UndoEntry"),
new ElementEditUndoEntry(parent.getObjectID(), parent.getElementCount(), null, subReport));
parent.addElement(subReport);
}
final ReportDesignerContext designerContext = dragContext.getDesignerContext();
final Window window = LibSwingUtil.getWindowAncestor(designerContext.getView().getParent());
final AbstractReportDefinition reportDefinition = designerContext.getActiveContext().getReportDefinition();
try
{
// Create the new subreport tab and update the active context to point to new subreport.
subReport.setDataFactory(reportDefinition.getDataFactory());
final int idx = designerContext.addSubReport(designerContext.getActiveContext(), subReport);
designerContext.setActiveDocument(designerContext.getReportRenderContext(idx));
}
catch (ReportDataFactoryException e)
{
UncaughtExceptionsModel.getInstance().addException(e);
}