if (activeContext == null)
{
return;
}
final CrosstabRowGroup newGroup = new CrosstabRowGroup();
try
{
Object selectedElement = null;
if (getSelectionModel().getSelectionCount() > 0)
{
selectedElement = getSelectionModel().getSelectedElement(0);
}
if (selectedElement instanceof CrosstabRowGroup)
{
// execution order is important here.
// first unlink the old root-group by setting a new one ...
final CrosstabRowGroup selectedGroup = (CrosstabRowGroup) selectedElement;
final GroupBody oldGroupBody = selectedGroup.getBody();
final CrosstabRowGroupBody newGroupBody = new CrosstabRowGroupBody(newGroup);
selectedGroup.setBody(newGroupBody);
newGroup.setBody(oldGroupBody);
activeContext.getUndo().addChange(ActionMessages.getString("InsertCrosstabRowGroupAction.UndoName"),
new InsertGroupBodyOnGroupUndoEntry(selectedGroup.getObjectID(), oldGroupBody, newGroupBody));
}
}
catch (Exception ex)
{
UncaughtExceptionsModel.getInstance().addException(ex);