(String title, String path, String fileName)
| 189 | |
| 190 | // Uses the AWT FileDialog class to display the dialog box |
| 191 | void open(String title, String path, String fileName) { |
| 192 | Frame parent = IJ.getInstance(); |
| 193 | if (parent==null) { |
| 194 | if (sharedFrame==null) sharedFrame = new Frame(); |
| 195 | parent = sharedFrame; |
| 196 | } |
| 197 | if (IJ.isMacOSX() && IJ.isJava18()) { |
| 198 | ImageJ ij = IJ.getInstance(); |
| 199 | if (ij!=null && ij.isActive()) |
| 200 | parent = ij; |
| 201 | else |
| 202 | parent = null; |
| 203 | } |
| 204 | FileDialog fd = new FileDialog(parent, title); |
| 205 | if (path!=null) { |
| 206 | if (IJ.isWindows() && path.contains("/")) |
| 207 | path = path.replaceAll("/","\\\\"); // work around FileDialog.setDirectory() bug |
| 208 | fd.setDirectory(path); |
| 209 | } |
| 210 | if (fileName!=null) |
| 211 | fd.setFile(fileName); |
| 212 | fd.show(); |
| 213 | name = fd.getFile(); |
| 214 | if (name==null) { |
| 215 | if (IJ.isMacOSX()) |
| 216 | System.setProperty("apple.awt.fileDialogForDirectories", "false"); |
| 217 | Macro.abort(); |
| 218 | } else |
| 219 | dir = fd.getDirectory(); |
| 220 | } |
| 221 | |
| 222 | void decodePath(String path) { |
| 223 | int i = path.lastIndexOf('/'); |
no test coverage detected