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

Method run

ij/src/main/java/ij/io/SaveDialog.java:169–203  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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 }

Callers

nothing calls this directly

Calls 8

getInstanceMethod · 0.95
abortMethod · 0.95
noExtensionMethod · 0.95
setExtensionMethod · 0.95
getNameMethod · 0.65
existsMethod · 0.45
getPathMethod · 0.45
equalsMethod · 0.45

Tested by

no test coverage detected