{
return;
}
Arrays.sort(reportElements, new ElementPositionComparator());
final MassElementStyleUndoEntryBuilder builder = new MassElementStyleUndoEntryBuilder(reportElements);
final Element[] carrier = new Element[1];
long totalHeight = 0;
long topmostY = Long.MAX_VALUE;
long bottommostY = Long.MIN_VALUE;
for (int i = 0; i < reportElements.length; i++)
{
final Element element = reportElements[i];
final CachedLayoutData layoutData = ModelUtility.getCachedLayoutData(element);
totalHeight += layoutData.getHeight();
topmostY = Math.min(topmostY, layoutData.getY());
bottommostY = Math.max(bottommostY, layoutData.getY() + layoutData.getHeight());
}
final long gap = (bottommostY - topmostY - totalHeight) / (reportElements.length - 1);
long currentY = topmostY;
for (int i = 0; i < reportElements.length; i++)
{
final Element reportElement = reportElements[i];
final CachedLayoutData layoutData = ModelUtility.getCachedLayoutData(reportElement);
final long height = layoutData.getHeight();
carrier[0] = reportElement;
final Point2D.Double originPoint = new Point2D.Double(StrictGeomUtility.toExternalValue(layoutData.getX()), 0);
final MoveDragOperation mop = new MoveDragOperation
(carrier, originPoint, EmptySnapModel.INSTANCE, EmptySnapModel.INSTANCE);
mop.update(new Point2D.Double(0, StrictGeomUtility.toExternalValue(currentY)), 1);
mop.finish();
currentY += height + gap;
}
final MassElementStyleUndoEntry massElementStyleUndoEntry = builder.finish();
getActiveContext().getUndo().addChange(ActionMessages.getString("DistributeVerticalJustifyAction.UndoName"), massElementStyleUndoEntry);
}