()
| 167 | try { |
| 168 | EventQueue.invokeAndWait(new Runnable() { |
| 169 | public void run() { |
| 170 | JFileChooser fc = new JFileChooser(); |
| 171 | fc.setDialogTitle(title); |
| 172 | fc.setDragEnabled(true); |
| 173 | fc.setTransferHandler(new DragAndDropHandler(fc)); |
| 174 | if (defaultDir!=null) { |
| 175 | File f = new File(defaultDir); |
| 176 | if (f!=null) |
| 177 | fc.setCurrentDirectory(f); |
| 178 | } |
| 179 | if (defaultName!=null) |
| 180 | fc.setSelectedFile(new File(defaultName)); |
| 181 | int returnVal = fc.showSaveDialog(IJ.getInstance()); |
| 182 | if (returnVal!=JFileChooser.APPROVE_OPTION) |
| 183 | {Macro.abort(); return;} |
| 184 | File f = fc.getSelectedFile(); |
| 185 | if(f.exists()) { |
| 186 | int ret = JOptionPane.showConfirmDialog (fc, |
| 187 | "The file "+ f.getName() + " already exists. \nWould you like to replace it?", |
| 188 | "Replace?", |
| 189 | JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); |
| 190 | if (ret!=JOptionPane.OK_OPTION) f = null; |
| 191 | } |
| 192 | if (f==null) |
| 193 | Macro.abort(); |
| 194 | else { |
| 195 | dir = fc.getCurrentDirectory().getPath()+File.separator; |
| 196 | name = fc.getName(f); |
| 197 | if (noExtension(name)) { |
| 198 | if (".raw".equals(ext)) |
| 199 | ext = null; |
| 200 | name = setExtension(name, ext); |
| 201 | } |
| 202 | } |
| 203 | } |
| 204 | }); |
| 205 | } catch (Exception e) {} |
| 206 | } |
nothing calls this directly
no test coverage detected