}
final Component parent = getReportDesignerContext().getView().getParent();
final Window window = LibSwingUtil.getWindowAncestor(parent);
final ConditionalVisibilityDialog dialog;
if (window instanceof JDialog)
{
dialog = new ConditionalVisibilityDialog((JDialog) window);
}
else if (window instanceof JFrame)
{
dialog = new ConditionalVisibilityDialog((JFrame) window);
}
else
{
dialog = new ConditionalVisibilityDialog();
}
final Expression oldExpression = visualElements.get(0).getStyleExpression(ElementStyleKeys.VISIBLE);
dialog.setReportDesignerContext(getReportDesignerContext());
final Expression expression = dialog.performEdit(oldExpression);
if (expression != null)
{
visualElements.get(0).setStyleExpression(ElementStyleKeys.VISIBLE, expression.getInstance());
}
}