/** * Cancel pressed. * * @return */ @Override public boolean performCancel() { try { if (data.getJdbcConnection() != null && !data.getJdbcConnection().isClosed()) { data.getJdbcConnection().close(); } } catch (Exception e) { /* Die silently */ } return true; }
/** * Gets executed once the wizard is about to finish * * <p>This will build an appropriate {@link ImportConfiguration} object, depending upon the {@link * ImportWizardModel#getSourceType() source type} and the choices the user made during the process * of the wizard. * * <p>{@link #configuration} will hold a reference of the object. This can be retrieved later on * by {@link #getResultingConfiguration()}. * * @return * @see {@link #getResultingConfiguration()} */ @Override public boolean performFinish() { if (data.getSourceType() == SourceType.CSV) { configuration = new ImportConfigurationCSV( data.getFileLocation(), data.getCharset(), data.getCsvDelimiter(), data.getCsvQuote(), data.getCsvEscape(), data.getCsvLinebreak(), data.getFirstRowContainsHeader()); } else if (data.getSourceType() == SourceType.EXCEL) { configuration = new ImportConfigurationExcel( data.getFileLocation(), data.getExcelSheetIndex(), data.getFirstRowContainsHeader()); } else if (data.getSourceType() == SourceType.JDBC) { configuration = new ImportConfigurationJDBC(data.getJdbcConnection(), data.getSelectedJdbcTable()); } else { throw new RuntimeException("Configuration type not supported"); // $NON-NLS-1$ } for (ImportColumn c : data.getEnabledColumns()) { c.setCleansing(data.isPerformCleansing()); configuration.addColumn(c); } if (data.getSourceType() != SourceType.JDBC) { try { if (data.getJdbcConnection() != null && !data.getJdbcConnection().isClosed()) { data.getJdbcConnection().close(); } } catch (Exception e) { /* Die silently */ } } return true; }