X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Farchaeopteryx%2Ftools%2FAncestralTaxonomyInferrer.java;h=fa159b4ce9971610b2ee84d8255d480312bb886c;hb=a9e626aa67ff9cb1649c371f9d705eb04498cc33;hp=8a93585bb31c9af5bf68e7ec43df90fee6c31eb0;hpb=b6e7f73953742c72d1df633b79a2c39404fbbad0;p=jalview.git diff --git a/forester/java/src/org/forester/archaeopteryx/tools/AncestralTaxonomyInferrer.java b/forester/java/src/org/forester/archaeopteryx/tools/AncestralTaxonomyInferrer.java index 8a93585..fa159b4 100644 --- a/forester/java/src/org/forester/archaeopteryx/tools/AncestralTaxonomyInferrer.java +++ b/forester/java/src/org/forester/archaeopteryx/tools/AncestralTaxonomyInferrer.java @@ -21,7 +21,7 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA // // Contact: phylosoft @ gmail . com -// WWW: www.phylosoft.org/forester +// WWW: https://sites.google.com/site/cmzmasek/home/software/forester package org.forester.archaeopteryx.tools; @@ -31,59 +31,35 @@ import javax.swing.JOptionPane; import org.forester.analysis.AncestralTaxonomyInference; import org.forester.analysis.AncestralTaxonomyInferenceException; -import org.forester.archaeopteryx.Constants; +import org.forester.archaeopteryx.MainFrame; import org.forester.archaeopteryx.MainFrameApplication; import org.forester.archaeopteryx.TreePanel; import org.forester.phylogeny.Phylogeny; -import org.forester.util.ForesterUtil; -import org.forester.ws.uniprot.UniProtWsTools; +import org.forester.ws.seqdb.SequenceDbWsTools; -public class AncestralTaxonomyInferrer implements Runnable { +public class AncestralTaxonomyInferrer extends RunnableProcess { private final Phylogeny _phy; - private final MainFrameApplication _mf; + private final MainFrame _mf; private final TreePanel _treepanel; - private long _process_id; - private long getProcessId() { - return _process_id; - } - - private void setProcessId( final long process_id ) { - _process_id = process_id; - } - - public AncestralTaxonomyInferrer( final MainFrameApplication mf, final TreePanel treepanel, final Phylogeny phy ) { + public AncestralTaxonomyInferrer( final MainFrame mf, final TreePanel treepanel, final Phylogeny phy ) { _phy = phy; _mf = mf; _treepanel = treepanel; } - private String getBaseUrl() { - return UniProtWsTools.BASE_URL; - } - - private void start() { - _mf.getMainPanel().getCurrentTreePanel().setWaitCursor(); - setProcessId( _mf.getProcessPool().addProcess( "ancestral taxonomy" ) ); - } - - private void end() { - final boolean removed = _mf.getProcessPool().removeProcess( getProcessId() ); - if ( !removed ) { - ForesterUtil.printWarningMessage( Constants.PRG_NAME, "could not remove process " + getProcessId() - + " from process pool" ); - } - _mf.getMainPanel().getCurrentTreePanel().setArrowCursor(); + public static String getBaseUrl() { + return SequenceDbWsTools.BASE_UNIPROT_URL; } private void inferTaxonomies() { - start(); + start( _mf, "ancestral taxonomy" ); try { AncestralTaxonomyInference.inferTaxonomyFromDescendents( _phy ); } catch ( final AncestralTaxonomyInferenceException e ) { - end(); + end( _mf ); JOptionPane.showMessageDialog( _mf, e.getMessage(), "Error during ancestral taxonomy inference", @@ -91,7 +67,7 @@ public class AncestralTaxonomyInferrer implements Runnable { return; } catch ( final UnknownHostException e ) { - end(); + end( _mf ); JOptionPane.showMessageDialog( _mf, "Could not connect to \"" + getBaseUrl() + "\"", "Network error during ancestral taxonomy inference", @@ -99,7 +75,7 @@ public class AncestralTaxonomyInferrer implements Runnable { return; } catch ( final Exception e ) { - end(); + end( _mf ); e.printStackTrace(); JOptionPane.showMessageDialog( _mf, e.toString(), @@ -108,8 +84,7 @@ public class AncestralTaxonomyInferrer implements Runnable { return; } catch ( final Error e ) { - end(); - e.printStackTrace(); + end( _mf ); JOptionPane.showMessageDialog( _mf, e.toString(), "Unexpected error during ancestral taxonomy inference", @@ -120,7 +95,7 @@ public class AncestralTaxonomyInferrer implements Runnable { _treepanel.setTree( _phy ); _mf.showWhole(); _treepanel.setEdited( true ); - end(); + end( _mf ); try { JOptionPane.showMessageDialog( _mf, "Ancestral taxonomy inference successfully completed",