Changeset 1425


Ignore:
Timestamp:
09/06/06 15:50:30 (14 years ago)
Author:
curtis
Message:

Wrap references to OME Notebook in reflection, so that the Data Browser plugin
still works if ome-notebook.jar or forms-1.0.4.jar are not in the classpath.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/plugins/browser/CustomWindow.java

    r1420 r1425  
    3434import javax.swing.event.ChangeEvent; 
    3535import javax.swing.event.ChangeListener; 
    36 import loci.ome.notebook.MetadataNotebook; 
     36import loci.formats.ReflectedUniverse; 
     37import loci.formats.ReflectException; 
     38//import loci.ome.notebook.MetadataNotebook; 
    3739 
    3840public class CustomWindow extends ImageWindow implements ActionListener, 
     
    225227    boolean canDoXML = true; 
    226228    try { 
    227       // disable XML button if ome-java library is not installed 
    228       Class.forName("org.openmicroscopy.xml.OMENode"); 
     229      // disable XML button if proper libraries are not installed 
     230      Class.forName("org.openmicroscopy.xml.OMENode"); // ome-java.jar 
     231      Class.forName("loci.ome.notebook.MetadataNotebook"); // ome-notebook.jar 
     232      Class.forName("com.jgoodies.forms.layout.FormLayout"); // forms-1.0.4.jar 
    229233    } 
    230234    catch (Throwable e) { canDoXML = false; } 
     
    233237      xml.addActionListener(this); 
    234238      xml.setActionCommand("xml"); 
    235       xml.setEnabled(true); 
    236239 
    237240      gbc.gridx = 5; 
     
    481484*/ 
    482485      String[] args = {db.filename}; 
    483       MetadataNotebook metaNote = new MetadataNotebook(args, false, false); 
     486      //MetadataNotebook metaNote = new MetadataNotebook(args, false, false); 
     487      try { 
     488        ReflectedUniverse r = new ReflectedUniverse(); 
     489        r.exec("import loci.ome.notebook.MetadataNotebook"); 
     490        r.setVar("args", args); 
     491        r.setVar("false", false); 
     492        r.exec("new MetadataNotebook(args, false, false)"); 
     493      } 
     494      catch (ReflectException exc) { 
     495        JOptionPane.showMessageDialog(this, 
     496          "Sorry, there has been an error creating the metadata editor.", 
     497          "LOCI 4D Data Browser", JOptionPane.ERROR_MESSAGE); 
     498      } 
    484499    } 
    485500    else if (cmd.equals("options")) { 
Note: See TracChangeset for help on using the changeset viewer.