X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Farchaeopteryx%2FMainFrameApplication.java;h=0744fdd52638937ccc049f99a0d4f5bfe54d57ed;hb=30ea6e22e29814b611cf523d0b39b9e0197e63dc;hp=6ae6a958ea11c9a597f9f508d3d10ceefec7615b;hpb=b6994b4fd04614be576f79b6df6ea39235e7cfd2;p=jalview.git diff --git a/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java b/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java index 6ae6a95..0744fdd 100644 --- a/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java +++ b/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java @@ -37,8 +37,6 @@ import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; import java.util.HashSet; import java.util.List; @@ -94,8 +92,6 @@ import org.forester.phylogeny.PhylogenyNode; import org.forester.phylogeny.PhylogenyNode.NH_CONVERSION_SUPPORT_VALUE_STYLE; import org.forester.phylogeny.data.Confidence; import org.forester.phylogeny.data.Taxonomy; -import org.forester.phylogeny.factories.ParserBasedPhylogenyFactory; -import org.forester.phylogeny.factories.PhylogenyFactory; import org.forester.phylogeny.iterators.PhylogenyNodeIterator; import org.forester.sequence.Sequence; import org.forester.util.BasicDescriptiveStatistics; @@ -786,8 +782,6 @@ public final class MainFrameApplication extends MainFrame { _file_jmenu = MainFrame.createMenu( "File", getConfiguration() ); _file_jmenu.add( _open_item = new JMenuItem( "Read Tree from File..." ) ); _file_jmenu.addSeparator(); - _file_jmenu.add( _open_url_item = new JMenuItem( "Read Tree from URL/Webservice..." ) ); - _file_jmenu.addSeparator(); final WebservicesManager webservices_manager = WebservicesManager.getInstance(); _load_phylogeny_from_webservice_menu_items = new JMenuItem[ webservices_manager .getAvailablePhylogeniesWebserviceClients().size() ]; @@ -831,7 +825,6 @@ public final class MainFrameApplication extends MainFrame { customizeJMenuItem( _open_item ); _open_item .setFont( new Font( _open_item.getFont().getFontName(), Font.BOLD, _open_item.getFont().getSize() + 4 ) ); - customizeJMenuItem( _open_url_item ); for( int i = 0; i < webservices_manager.getAvailablePhylogeniesWebserviceClients().size(); ++i ) { customizeJMenuItem( _load_phylogeny_from_webservice_menu_items[ i ] ); } @@ -1157,87 +1150,6 @@ public final class MainFrameApplication extends MainFrame { System.exit( 0 ); } - @Override - void readPhylogeniesFromURL() { - URL url = null; - Phylogeny[] phys = null; - final String message = "Please enter a complete URL, for example \"http://www.phyloxml.org/examples/apaf.xml\""; - final String url_string = JOptionPane.showInputDialog( this, - message, - "Use URL/webservice to obtain a phylogeny", - JOptionPane.QUESTION_MESSAGE ); - boolean nhx_or_nexus = false; - if ( ( url_string != null ) && ( url_string.length() > 0 ) ) { - try { - url = new URL( url_string ); - PhylogenyParser parser = null; - if ( url.getHost().toLowerCase().indexOf( "tolweb" ) >= 0 ) { - parser = new TolParser(); - } - else { - parser = ParserUtils.createParserDependingOnUrlContents( url, getConfiguration() - .isValidatePhyloXmlAgainstSchema() ); - } - if ( parser instanceof NexusPhylogeniesParser ) { - nhx_or_nexus = true; - } - else if ( parser instanceof NHXParser ) { - nhx_or_nexus = true; - } - if ( _mainpanel.getCurrentTreePanel() != null ) { - _mainpanel.getCurrentTreePanel().setWaitCursor(); - } - else { - _mainpanel.setWaitCursor(); - } - final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance(); - phys = factory.create( url.openStream(), parser ); - } - catch ( final MalformedURLException e ) { - JOptionPane.showMessageDialog( this, - "Malformed URL: " + url + "\n" + e.getLocalizedMessage(), - "Malformed URL", - JOptionPane.ERROR_MESSAGE ); - } - catch ( final IOException e ) { - JOptionPane.showMessageDialog( this, - "Could not read from " + url + "\n" - + ForesterUtil.wordWrap( e.getLocalizedMessage(), 80 ), - "Failed to read URL", - JOptionPane.ERROR_MESSAGE ); - } - catch ( final Exception e ) { - JOptionPane.showMessageDialog( this, - ForesterUtil.wordWrap( e.getLocalizedMessage(), 80 ), - "Unexpected Exception", - JOptionPane.ERROR_MESSAGE ); - } - finally { - if ( _mainpanel.getCurrentTreePanel() != null ) { - _mainpanel.getCurrentTreePanel().setArrowCursor(); - } - else { - _mainpanel.setArrowCursor(); - } - } - if ( ( phys != null ) && ( phys.length > 0 ) ) { - if ( nhx_or_nexus && getOptions().isInternalNumberAreConfidenceForNhParsing() ) { - for( final Phylogeny phy : phys ) { - PhylogenyMethods.transferInternalNodeNamesToConfidence( phy, "" ); - } - } - AptxUtil.addPhylogeniesToTabs( phys, - new File( url.getFile() ).getName(), - new File( url.getFile() ).toString(), - getConfiguration(), - getMainPanel() ); - _mainpanel.getControlPanel().showWhole(); - } - } - activateSaveAllIfNeeded(); - System.gc(); - } - void setMsa( final Msa msa ) { _msa = msa; }