/** * 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); } }); }