final ReportDocumentContext reportRenderContext = getReportRenderContext();
if (reportRenderContext == null)
{
throw new IllegalStateException("No report render context? Thats bad.");
}
final UndoManager undo = reportRenderContext.getUndo();
final ArrayList<UndoEntry> undos = new ArrayList<UndoEntry>();
for (int i = 0; i < elements.length; i++)
{
final Element element = elements[i];
final Expression attribute = element.getStyleExpression(metaData.getStyleKey());
if (value == null)
{
undos.add(new StyleExpressionEditUndoEntry
(element.getObjectID(), metaData.getStyleKey(), attribute, null));
element.setStyleExpression(metaData.getStyleKey(), null);
element.notifyNodePropertiesChanged();
}
else
{
final Expression expression = value.getInstance();
undos.add(new StyleExpressionEditUndoEntry
(element.getObjectID(), metaData.getStyleKey(), attribute, expression));
element.setStyleExpression(metaData.getStyleKey(), expression);
element.notifyNodePropertiesChanged();
}
}
undo.addChange(Messages.getString("StyleChange"), new CompoundUndoEntry((UndoEntry[]) undos.toArray(new UndoEntry[undos.size()])));
}
return changed;
}