final MessageBox prompt = MessageBox.prompt("Add custom element",
"Please specify element name:");
// TODO BUG IN GXT: TextField is not attached!!!
// => GET NO KEYEVENTS, so do it myself...
ComponentHelper.doAttach(prompt.getTextBox());
prompt.getTextBox().addKeyListener(new KeyListener() {
public void componentKeyUp(ComponentEvent event) {
super.componentKeyUp(event);
if (pressedEnter(event.getKeyCode())) {
prompt.getDialog().close(
prompt.getDialog().getButtonById(Dialog.OK));