Changeset 1931


Ignore:
Timestamp:
12/13/06 17:13:25 (13 years ago)
Author:
curtis
Message:

Only list Image5D and View5D as options if the plugins are available.

Location:
trunk/loci/plugins
Files:
2 edited

Legend:

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

    r1917 r1931  
    3737import java.io.IOException; 
    3838import java.util.Hashtable; 
     39import java.util.Vector; 
    3940import javax.swing.*; 
    4041import loci.formats.*; 
     
    129130    final String stackString = "Open stack with: "; 
    130131 
    131     final String[] stackFormats = new String[] { 
    132       "Standard ImageJ", "LOCI 4D Data Browser", "Image5D", "View 5D" 
    133     }; 
     132    Vector stackTypes = new Vector(); 
     133    stackTypes.add("Standard ImageJ"); 
     134    stackTypes.add("4D Data Browser"); 
     135    if (Util.checkClass("i5d.Image5D")) stackTypes.add("Image5D"); 
     136    if (Util.checkClass("View5D")) stackTypes.add("View5D"); 
     137    final String[] stackFormats = new String[stackTypes.size()]; 
     138    stackTypes.copyInto(stackFormats); 
    134139 
    135140    // load preferences from IJ_Prefs.txt 
     
    743748            ru.exec("i5d.show()"); 
    744749          } 
    745           else if (stackFormat.equals("View 5D")) { 
     750          else if (stackFormat.equals("View5D")) { 
    746751            WindowManager.setTempCurrentImage(imp); 
    747752            IJ.runPlugIn("View5D_", ""); 
  • trunk/loci/plugins/Util.java

    r1544 r1931  
    9999  } 
    100100 
     101  /** Checks whether the given class is available. */ 
     102  public static boolean checkClass(String className) { 
     103    try { Class.forName(className); } 
     104    catch (Throwable t) { return false; } 
     105    return true; 
     106  } 
     107 
    101108  private static void checkLibrary(String className, 
    102109    String jarFile, HashSet hs) 
    103110  { 
    104     try { Class.forName(className); } 
    105     catch (Throwable t) { hs.add(jarFile); } 
     111    if (!checkClass(className)) hs.add(jarFile); 
    106112  } 
    107113 
Note: See TracChangeset for help on using the changeset viewer.