}
void displayedPhylogenyMightHaveChanged( final boolean recalc_longest_ext_node_info ) {
- if ( ( _mainpanel != null ) && ( _mainpanel.getCurrentPhylogeny() != null ) ) {
+ if ( ( _mainpanel != null )
+ && ( _mainpanel.getCurrentPhylogeny() != null && !_mainpanel.getCurrentPhylogeny().isEmpty() ) ) {
if ( getOptions().isShowOverview() ) {
_mainpanel.getCurrentTreePanel().updateOvSizes();
}
* Fit entire tree into window.
*/
void showWhole() {
- if ( _mainpanel.getCurrentScrollPane() == null ) {
+ if ( _mainpanel.getCurrentScrollPane() == null || _mainpanel.getCurrentTreePanel().getPhylogeny().isEmpty() ) {
return;
}
getCurrentTreePanel().updateSetOfCollapsedExternalNodes();
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JRadioButtonMenuItem;
+import javax.swing.SwingUtilities;
import org.forester.archaeopteryx.Options.CLADOGRAM_TYPE;
import org.forester.archaeopteryx.Options.NODE_LABEL_DIRECTION;
_jmenubar.add( _help_jmenu );
}
- public synchronized void updateProcessMenu() {
- System.out.println( "pool size " + _process_pool.size() );
+ public void updateProcessMenu() {
+ // In general Swing is not thread safe.
+ // See "Swing's Threading Policy".
+ SwingUtilities.invokeLater( new Runnable() {
+
+ public void run() {
+ doUpdateProcessMenu();
+ }
+ } );
+ }
+
+ private void doUpdateProcessMenu() {
if ( _process_pool.size() > 0 ) {
if ( _process_menu == null ) {
_process_menu = createMenu( "", getConfiguration() );
_jmenubar.validate();
_jmenubar.repaint();
repaint();
- // _help_jmenu.add( _help_item = new JMenuItem( "Help" ) );
- // _help_jmenu.add( _website_item = new JMenuItem( "Archaeopteryx Home" ) );
- // _aptx_ref_item = new JMenuItem( "Archaeopteryx Reference" );
- // _help_jmenu.add( _phyloxml_website_item = new JMenuItem( "phyloXML Home" ) );
- // _help_jmenu.add( _phyloxml_ref_item = new JMenuItem( "phyloXML Reference" ) );
- // _help_jmenu.addSeparator();
- // _help_jmenu.add( _about_item = new JMenuItem( "About" ) );
- // customizeJMenuItem( _help_item );
- // customizeJMenuItem( _website_item );
- // customizeJMenuItem( _phyloxml_website_item );
- // customizeJMenuItem( _aptx_ref_item );
- // customizeJMenuItem( _phyloxml_ref_item );
- // customizeJMenuItem( _about_item );
- // _phyloxml_ref_item.setToolTipText( PHYLOXML_REF_TOOL_TIP );
- // _aptx_ref_item.setToolTipText( APTX_REF_TOOL_TIP );
- // _jmenubar.add( _help_jmenu );
}
void buildTypeMenu() {
final int graphics_file_height,
final int graphics_file_x,
final int graphics_file_y ) {
+ if ( _phylogeny == null || _phylogeny.isEmpty() ) {
+ return;
+ }
if ( _control_panel.isShowSequenceRelations() ) {
_query_sequence = _control_panel.getSelectedQuerySequence();
}
}
void start( final MainFrame mf, final String name ) {
- //mf.getMainPanel().getCurrentTreePanel().setWaitCursor();
setProcessId( mf.getProcessPool().addProcess( name ) );
mf.updateProcessMenu();
}
ForesterUtil.printWarningMessage( Constants.PRG_NAME, "could not remove process " + getProcessId()
+ " from process pool" );
}
- //mf.getMainPanel().getCurrentTreePanel().setArrowCursor();
mf.updateProcessMenu();
}
}
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(),
return;
}
catch ( final AncestralTaxonomyInferenceException e ) {
- _mf.getMainPanel().getCurrentTreePanel().setArrowCursor();
e.printStackTrace();
JOptionPane.showMessageDialog( _mf,
e.toString(),
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 );