Changeset 7223 for branches


Ignore:
Timestamp:
11/19/10 14:45:58 (10 years ago)
Author:
melissa
Message:

Prevent the 'open' option from being recorded twice. Closes #596.

This is actually a work-around for a problem in ij.io.OpenDialog. OpenDialog forces the macro recorder to record the file path every time 'getFileName()' is called, so if you call that method more than once on an OpenDialog you will see duplicate keys in the recorded macro.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/4.2/components/loci-plugins/src/loci/plugins/in/IdDialog.java

    r7000 r7223  
    4343 
    4444  private OpenDialog od; 
     45  private String name; 
    4546 
    4647  // -- Constructor -- 
     
    9899      String idLabel = options.getLabel(ImporterOptions.KEY_ID); 
    99100      od = new OpenDialog(idLabel, options.getId()); 
    100       if (od.getFileName() == null) return false; 
     101      name = od.getFileName(); 
     102      if (name == null) return false; 
    101103    } 
    102104    else if (options.isHTTP()) { 
     
    112114    if (options.isLocal()) { 
    113115      String dir = od.getDirectory(); 
    114       String name = od.getFileName(); 
    115       if (dir != null || name == null) 
    116       id = dir + name; 
     116      // NB: do not use od.getFileName() here.  That method has been called 
     117      // above, so the macro recorder will record the file path twice if we 
     118      // call od.getFileName() again.  See ticket #596. 
     119      if (dir != null || name == null) { 
     120        id = dir + name; 
     121      } 
    117122 
    118123      // verify validity 
Note: See TracChangeset for help on using the changeset viewer.