Index: ../src-rep/src/apps/datastudio/com/aquafold/datastudio/tools/importtool/ImportDialog.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- ../src-rep/src/apps/datastudio/com/aquafold/datastudio/tools/importtool/ImportDialog.java (revision 58877) +++ ../src-rep/src/apps/datastudio/com/aquafold/datastudio/tools/importtool/ImportDialog.java (revision ) @@ -1389,57 +1389,65 @@ if (nChanged == 3) { // check if the collection is new then do not extract it + String tableName = ""; + if (currentTable.equals(newCollectionName) && newCollectionEntry) { - AFTable temptable = new AFTable(currentDatabase, currentSchema, tableNameField.getSelectedString()); - table = temptable; + tableName = tableNameField.getSelectedString(); } else if(!tableList.contains(currentTable)){ newCollectionName = currentTable; - AFTable temptable = new AFTable(currentDatabase, currentSchema, currentTable); - table = temptable; + tableName = currentTable; } else { - table = ExtractTable.getTable(cp, conn, currentDatabase, currentSchema, currentTable, false, true, true); + tableName = currentTable; + } + + table = getTableInfo(currentDatabase, currentSchema, tableName); + } + } + + private AFTable getTableInfo(String currentDatabase, String currentSchema, String currentTable) { + AFTable table = ExtractTable.getTable(cp, conn, currentDatabase, currentSchema, currentTable, false, true, true); - if (table == null) { - // if the table can't be extracted, then it might be a temp table - table = createdTables.get(currentDatabase + "." + currentSchema + "." + currentTable); - } + if (table == null) { + // if the table can't be extracted, then it might be a temp table + table = createdTables.get(currentDatabase + "." + currentSchema + "." + currentTable); + } - TableModel model; - TableModel m = fileTable.getModel(); - if (m instanceof SampleFileDataModel) { - model = new ColumnInfoModel(cp, table, (SampleFileDataModel) m); - } - else { - model = m; - } - columnTable.setModel(model); - customizeColumnModel(columnTable, model); + TableModel model; + TableModel m = fileTable.getModel(); + if (m instanceof SampleFileDataModel) { + model = new ColumnInfoModel(cp, table, (SampleFileDataModel) m); + } + else { + model = m; + } + columnTable.setModel(model); + customizeColumnModel(columnTable, model); - // Set the width of each column - for (int j = 0; j < model.getColumnCount(); j++) { - TableColumn c = columnTable.getColumn(model.getColumnName(j)); - if (j == 0) { - c.setPreferredWidth(135); - } - else if (j == 1) { - c.setPreferredWidth(90); - if (cp.isMongoDB()) { - columnTable.getColumnModel().getColumn(1).setCellEditor(new DefaultCellEditor(columnTypeEditorField)); - } - } - else if (j == 2) { - c.setPreferredWidth(135); - columnTable.getColumnModel().getColumn(2).setCellEditor(new DefaultCellEditor(columnEditorField)); - } - else if (j == 3) { - c.setPreferredWidth(55); - } - } + // Set the width of each column + for (int j = 0; j < model.getColumnCount(); j++) { + TableColumn c = columnTable.getColumn(model.getColumnName(j)); + if (j == 0) { + c.setPreferredWidth(135); + } + else if (j == 1) { + c.setPreferredWidth(90); + if (cp.isMongoDB()) { + columnTable.getColumnModel().getColumn(1).setCellEditor(new DefaultCellEditor(columnTypeEditorField)); + } + } + else if (j == 2) { + c.setPreferredWidth(135); + columnTable.getColumnModel().getColumn(2).setCellEditor(new DefaultCellEditor(columnEditorField)); + } + else if (j == 3) { + c.setPreferredWidth(55); + } + } - refreshConstantColumns(); + refreshConstantColumns(); - } - } + + return table; } private void refreshConstantColumns() {