}
public void generate(final Generator generator) {
String title = generator.getName();
GeneratorUI ui = generator.getUI();
if (ui != null) {
ui.setup(generator);
JPanel panel = ui.getPanel();
final DialogDescriptor dd = new DialogDescriptor(panel, title);
if (panel instanceof ValidationPanel) {
ValidationPanel vp = (ValidationPanel) panel;
vp.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
dd.setValid(!((ValidationPanel) e.getSource()).isProblem());
}
});
}
Object result = DialogDisplayer.getDefault().notify(dd);
if (result != NotifyDescriptor.OK_OPTION) {
return;
}
ui.unsetup();
}
final Container container = Lookup.getDefault().lookup(ContainerFactory.class).newContainer();
container.setSource("" + generator.getName());
container.setReport(new Report());