ImportFileType type = determineType(f);
IFileImporter importer = FileImporterFactory.createImporter(type, f);
if (importer.getConfigurationPanel() != null) {
//i18n[ImportTableDataCommand.settingsDialogTitle=Import file settings]
final JDialog dialog = new JDialog(session.getApplication().getMainFrame(), stringMgr.getString("ImportTableDataCommand.settingsDialogTitle"), true);
StateListener dialogState = new StateListener(dialog);
dialog.setLayout(new BorderLayout());
dialog.add(importer.getConfigurationPanel(), BorderLayout.CENTER);
OkClosePanel buttons = new OkClosePanel();
//i18n[ImportTableDataCommand.cancel=Cancel]
buttons.getCloseButton().setText(stringMgr.getString("ImportTableDataCommand.cancel"));
buttons.addListener(dialogState);
dialog.add(buttons, BorderLayout.SOUTH);
dialog.pack();
GUIUtils.centerWithinParent(dialog);
dialog.setVisible(true);
if (!dialogState.isOkPressed()) {
return;
}
}
final ImportFileDialog importFileDialog = new ImportFileDialog(session, importer, table, columns);
importFileDialog.setPreviewData(importer.getPreview(10));
GUIUtils.processOnSwingEventThread(new Runnable() {
public void run() {
session.getApplication().getMainFrame().addWidget(importFileDialog);
importFileDialog.moveToFront();