Changeset 3313


Ignore:
Timestamp:
10/25/07 16:10:35 (12 years ago)
Author:
curtis
Message:

Print exceptions to Results window rather than with
IJ.showMessage or JOptionPane, so they can be copy/pasted.

Location:
trunk/loci/plugins
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/plugins/Importer.java

    r3305 r3313  
    9999      catch (FormatException exc) { 
    100100        reportException(exc, quiet, 
    101           "Sorry, there was an error reading the file"); 
     101          "Sorry, there was an error reading the file."); 
    102102        return; 
    103103      } 
    104104      catch (IOException exc) { 
    105105        reportException(exc, quiet, 
    106           "Sorry, there was a I/O problem reading the file"); 
     106          "Sorry, there was a I/O problem reading the file."); 
    107107        return; 
    108108      } 
     
    585585    catch (FormatException exc) { 
    586586      reportException(exc, quiet, 
    587         "Sorry, there was a problem reading the data"); 
     587        "Sorry, there was a problem reading the data."); 
    588588    } 
    589589    catch (IOException exc) { 
    590590      reportException(exc, quiet, 
    591         "Sorry, there was an I/O problem reading the data"); 
     591        "Sorry, there was an I/O problem reading the data."); 
    592592    } 
    593593  } 
     
    819819  /** Reports the given exception with stack trace in an ImageJ error dialog. */ 
    820820  private void reportException(Throwable t, boolean quiet, String msg) { 
    821     t.printStackTrace(); 
    822821    IJ.showStatus(""); 
    823822    if (!quiet) { 
    824823      ByteArrayOutputStream buf = new ByteArrayOutputStream(); 
    825824      t.printStackTrace(new PrintStream(buf)); 
    826       IJ.error("Bio-Formats", msg + ":\n" + buf.toString()); 
     825      String s = new String(buf.toByteArray()); 
     826      StringTokenizer st = new StringTokenizer(s, "\n\r"); 
     827      while (st.hasMoreTokens()) IJ.write(st.nextToken()); 
     828      IJ.error("Bio-Formats Importer", msg); 
    827829    } 
    828830  } 
  • trunk/loci/plugins/LociFunctions.java

    r3172 r3313  
    77import ij.IJ; 
    88import java.io.IOException; 
    9 import javax.swing.JOptionPane; 
    109import loci.formats.*; 
    1110import loci.formats.ome.OMEXMLMetadata; 
     
    261260      IJ.write("Ext.getSeriesName(seriesName)"); 
    262261 
    263       JOptionPane.showMessageDialog(null, 
     262      IJ.showMessage("LOCI Plugins for ImageJ", 
    264263        "The macro extensions are designed to be used within a macro.\n" + 
    265         "Instructions on doing so have been printed to the Results window.\n", 
    266         "LOCI Plugins for ImageJ", JOptionPane.INFORMATION_MESSAGE); 
     264        "Instructions on doing so have been printed to the Results window."); 
    267265    } 
    268266  } 
Note: See TracChangeset for help on using the changeset viewer.