Report report = container.getReport();
//Report panel
ReportPanel reportPanel = new ReportPanel();
reportPanel.setData(report, container);
DialogDescriptor dd = new DialogDescriptor(reportPanel, NbBundle.getMessage(DesktopImportControllerUI.class, "ReportPanel.title"));
if (!DialogDisplayer.getDefault().notify(dd).equals(NotifyDescriptor.OK_OPTION)) {
reportPanel.destroy();
return;
}
reportPanel.destroy();
final Processor processor = reportPanel.getProcessor();
//Project
Workspace workspace = null;
ProjectController pc = Lookup.getDefault().lookup(ProjectController.class);
ProjectControllerUI pcui = Lookup.getDefault().lookup(ProjectControllerUI.class);
if (pc.getCurrentProject() == null) {
pcui.newProject();
workspace = pc.getCurrentWorkspace();
}
//Process
final ProcessorUI pui = getProcessorUI(processor);
final ValidResult validResult = new ValidResult();
if (pui != null) {
if (pui != null) {
try {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
String title = NbBundle.getMessage(DesktopImportControllerUI.class, "DesktopImportControllerUI.processor.ui.dialog.title");
JPanel panel = pui.getPanel();
pui.setup(processor);
final DialogDescriptor dd2 = new DialogDescriptor(panel, title);
if (panel instanceof ValidationPanel) {
ValidationPanel vp = (ValidationPanel) panel;
vp.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
dd2.setValid(!((ValidationPanel) e.getSource()).isProblem());
}
});
dd2.setValid(!vp.isProblem());
}
Object result = DialogDisplayer.getDefault().notify(dd2);
if (result.equals(NotifyDescriptor.CANCEL_OPTION) || result.equals(NotifyDescriptor.CLOSED_OPTION)) {
validResult.setResult(false);
} else {