Changeset 7572


Ignore:
Timestamp:
01/21/11 17:53:59 (9 years ago)
Author:
curtis
Message:

Fix up save dialog behavior.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/maven/projects/loci-plugins/src/test/java/Save_As_J2K.java

    r7569 r7572  
    3333 
    3434                // get file to save 
    35                 final SaveDialog saveDialog = new SaveDialog("Save as J2K", "", "j2k"); 
     35                final String title = imp.getTitle(); 
     36                final int dot = title.lastIndexOf("."); 
     37                final String defaultFileName = dot < 0 ? title : title.substring(0, dot); 
     38                final SaveDialog saveDialog = new SaveDialog("Save as J2K", 
     39                        defaultFileName + ".jp2", ".jp2"); 
    3640                final String fileName = saveDialog.getFileName(); 
    3741                final String directory = saveDialog.getDirectory(); 
    38                 final String path = new File(directory, fileName).getPath(); 
     42                if (fileName == null || directory == null) return; // canceled 
     43                final File file = new File(directory, fileName); 
     44                final String path = file.getPath(); 
    3945 
    4046                // write J2K file to disk 
Note: See TracChangeset for help on using the changeset viewer.