ClassInstanceCreation fieldCreation =
((ConstructorCreationSupport) child.getCreationSupport()).getCreation();
menuExpression = DomGenerics.arguments(fieldCreation).get(1);
}
// create new Menu
JavaInfo menu =
JavaInfoUtils.createJavaInfo(
getEditor(),
"com.extjs.gxt.ui.client.widget.menu.Menu",
new ConstructorCreationSupport());
// prepare "new Menu()" source
String menuSource;
{
StatementTarget statementTarget =
new StatementTarget(AstNodeUtils.getEnclosingStatement(menuExpression), true);
NodeTarget nodeTarget = new NodeTarget(statementTarget);
menuSource = menu.getCreationSupport().add_getSource(nodeTarget);
}
// replace "null" with "new Menu()"
menuExpression = getEditor().replaceExpression(menuExpression, menuSource);
menu.setVariableSupport(new EmptyVariableSupport(menu, menuExpression));
menu.getCreationSupport().add_setSourceExpression(menuExpression);
// add Menu as child
menu.setAssociation(new ConstructorChildAssociation());
addChild(menu);
}