+ private void execute() {
+ start( _mf, "taxonomy data" );
+ SortedSet<String> not_found = null;
+ try {
+ not_found = obtainDetailedTaxonomicInformation( _phy, _delete );
+ }
+ catch ( final UnknownHostException e ) {
+ JOptionPane.showMessageDialog( _mf,
+ "Could not connect to \"" + getBaseUrl() + "\"",
+ "Network error during taxonomic information gathering",
+ JOptionPane.ERROR_MESSAGE );
+ return;
+ }
+ catch ( final IOException e ) {
+ 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(),
+ "Failed to obtain taxonomic information",
+ JOptionPane.ERROR_MESSAGE );
+ return;
+ }
+ finally {
+ 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();
+ _treepanel.setEdited( true );
+ if ( ( not_found != null ) && ( not_found.size() > 0 ) ) {
+ int max = not_found.size();
+ boolean more = false;
+ if ( max > 20 ) {
+ more = true;
+ max = 20;
+ }
+ final StringBuffer sb = new StringBuffer();
+ sb.append( "Not all taxonomies could be resolved.\n" );
+ if ( not_found.size() == 1 ) {
+ if ( _delete ) {
+ sb.append( "The following taxonomy was not found and deleted (if external):\n" );
+ }
+ else {
+ sb.append( "The following taxonomy was not found:\n" );
+ }
+ }
+ else {
+ if ( _delete ) {
+ sb.append( "The following taxonomies were not found and deleted (if external) (total: "
+ + not_found.size() + "):\n" );
+ }
+ else {
+ sb.append( "The following taxonomies were not found (total: " + not_found.size() + "):\n" );
+ }
+ }
+ int i = 0;
+ for( final String string : not_found ) {
+ if ( i > 19 ) {
+ break;
+ }
+ sb.append( string );
+ sb.append( "\n" );
+ ++i;
+ }
+ if ( more ) {
+ sb.append( "..." );
+ }
+ try {
+ JOptionPane.showMessageDialog( _mf,
+ sb.toString(),
+ "Taxonomy Tool Completed",
+ JOptionPane.WARNING_MESSAGE );
+ }
+ catch ( final Exception e ) {
+ // Not important if this fails, do nothing.
+ }
+ }
+ else {
+ try {
+ JOptionPane.showMessageDialog( _mf,
+ "Taxonomy tool successfully completed",
+ "Taxonomy Tool Completed",
+ JOptionPane.INFORMATION_MESSAGE );
+ }
+ catch ( final Exception e ) {
+ // Not important if this fails, do nothing.
+ }
+ }