MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / open

Method open

ij/src/main/java/ij/io/OpenDialog.java:191–220  ·  view source on GitHub ↗
(String title, String path, String fileName)

Source from the content-addressed store, hash-verified

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('/');

Callers 1

OpenDialogMethod · 0.95

Calls 14

getInstanceMethod · 0.95
isMacOSXMethod · 0.95
isJava18Method · 0.95
isWindowsMethod · 0.95
abortMethod · 0.95
replaceAllMethod · 0.80
setDirectoryMethod · 0.80
setFileMethod · 0.80
getFileMethod · 0.80
isActiveMethod · 0.65
containsMethod · 0.45
showMethod · 0.45

Tested by

no test coverage detected