import javax.swing.JOptionPane;
import org.forester.analysis.AncestralTaxonomyInference;
+import org.forester.analysis.AncestralTaxonomyInferenceException;
import org.forester.archaeopteryx.MainFrameApplication;
import org.forester.archaeopteryx.TreePanel;
import org.forester.phylogeny.Phylogeny;
import org.forester.ws.uniprot.UniProtWsTools;
-public class TaxonomyDataObtainer implements Runnable {
+public class TaxonomyDataObtainer extends RunnableProcess {
private final Phylogeny _phy;
private final MainFrameApplication _mf;
}
private void execute() {
- _mf.getMainPanel().getCurrentTreePanel().setWaitCursor();
+ start( _mf, "taxonomy data" );
SortedSet<String> not_found = null;
try {
not_found = AncestralTaxonomyInference.obtainDetailedTaxonomicInformation( _phy, _delete );
}
catch ( final UnknownHostException e ) {
- _mf.getMainPanel().getCurrentTreePanel().setArrowCursor();
JOptionPane.showMessageDialog( _mf,
"Could not connect to \"" + getBaseUrl() + "\"",
"Network error during taxonomic information gathering",
return;
}
catch ( final IOException e ) {
- _mf.getMainPanel().getCurrentTreePanel().setArrowCursor();
+ e.printStackTrace();
+ JOptionPane.showMessageDialog( _mf,
+ e.toString(),
+ "Failed to obtain taxonomic information",
+ JOptionPane.ERROR_MESSAGE );
+ return;
+ }
+ catch ( final AncestralTaxonomyInferenceException e ) {
e.printStackTrace();
JOptionPane.showMessageDialog( _mf,
e.toString(),
return;
}
finally {
- _mf.getMainPanel().getCurrentTreePanel().setArrowCursor();
+ end( _mf );
+ }
+ if ( _phy == null || _phy.isEmpty() ) {
+ try {
+ JOptionPane.showMessageDialog( _mf,
+ "None of the external node taxonomies could be resolved",
+ "Taxonomy Tool Failed",
+ JOptionPane.WARNING_MESSAGE );
+ }
+ catch ( final Exception e ) {
+ // Not important if this fails, do nothing.
+ }
+ return;
}
_treepanel.setTree( _phy );
_mf.showWhole();