}
if (result == 0)
{
final ReportDocumentContext context = dragContext.getRenderContext();
final UndoManager undo = context.getUndo();
undo.addChange(Messages.getInstance().getString("TocElementDragHandler.UndoEntry"),
new ElementEditUndoEntry(parent.getObjectID(), parent.getElementCount(), null, subReport));
parent.addElement(subReport);
}
else
{
final AbstractRootLevelBand arb = (AbstractRootLevelBand) parent;
final ReportDocumentContext context = dragContext.getRenderContext();
final UndoManager undo = context.getUndo();
undo.addChange(Messages.getInstance().getString("TocElementDragHandler.UndoEntry"),
new BandedSubreportEditUndoEntry(parent.getObjectID(), arb.getSubReportCount(), null, subReport));
arb.addSubReport(subReport);
}
}
else
{
final ReportDocumentContext context = dragContext.getRenderContext();
final UndoManager undo = context.getUndo();
undo.addChange(Messages.getInstance().getString("TocElementDragHandler.UndoEntry"),
new ElementEditUndoEntry(parent.getObjectID(), parent.getElementCount(), null, subReport));
parent.addElement(subReport);
}
dragContext.getRenderContext().getSelectionModel().setSelectedElements(new Object[]{subReport});