public InputTableSpec[] getInputSpecs(final Environment env) throws TaskException { ProcessingStep[] steps = inFilterParam_ == null ? null : inFilterParam_.stepsValue(env); TableProducer[] tprods = inTablesParam_.tablesValue(env); final int nIn = tprods.length; InputTableSpec[] specs = new InputTableSpec[nIn]; for (int i = 0; i < nIn; i++) { final int index = i; final TableProducer tprod = tprods[i]; specs[i] = new InputTableSpec(tprod.toString(), steps) { public StarTable getInputTable() throws TaskException { try { logger_.config("Input table " + (index + 1) + "/" + nIn); return tprod.getTable(); } catch (IOException e) { throw new TaskException(e.getMessage(), e); } } }; } return specs; }
/** * Attempts to generate a table from a supplied factory object, and if successful loads it into * TOPCAT. */ private void attemptLoadTable(TableProducer producer, final URI sender, final String tableId) { final LoadingToken token = new LoadingToken("PLASTIC table"); controlWindow_.addLoadingToken(token); /* Attempt to create a table from the message received. */ Throwable error; StarTable table; boolean success; try { table = producer.produceTable(controlWindow_.getTableFactory()); error = null; success = true; } catch (Throwable e) { error = e; table = null; success = false; } /* Do something on the event dispatch thread with the loaded table * or error. */ final boolean success0 = success; final StarTable table0 = table; final Throwable error0 = error; SwingUtilities.invokeLater( new Runnable() { public void run() { if (success0) { loadTable(table0, sender, tableId); } else { ErrorDialog.showError( controlWindow_, "PLASTIC Load Error", error0, "PLASTIC load failed"); } controlWindow_.removeLoadingToken(token); } }); }