{
dialog = new RowBandingDialog();
}
final RowBandingFunction function = findRowbandingFunction(activeContext);
final AbstractReportDefinition report = activeContext.getReportDefinition();
if (function == null)
{
final RowBandingFunction newFunction = new RowBandingFunction();
if (dialog.performEdit(newFunction))
{
report.getExpressions().add(newFunction);
activeContext.getUndo().addChange(ActionMessages.getString("EditRowBandingAction.Text"),
new ExpressionAddedUndoEntry(report.getExpressions().size() - 1, newFunction));
report.notifyNodeChildAdded(function);
}
}
else
{
final RowBandingFunction instance = (RowBandingFunction) function.getInstance();
if (dialog.performEdit(instance))
{
final ExpressionCollection expressionCollection = report.getExpressions();
final int idx = expressionCollection.indexOf(function);
expressionCollection.set(idx, instance);
activeContext.getUndo().addChange(ActionMessages.getString("EditRowBandingAction.Text"),
new ExpressionEditUndoEntry(idx, function, instance));
report.fireModelLayoutChanged(report, ReportModelEvent.NODE_PROPERTIES_CHANGED, instance);
}
}
}