Writes the editor text string to a file. @param target the file @return the saved file, or null if failed
(File target)
| 355 | * @return the saved file, or null if failed |
| 356 | */ |
| 357 | private File saveEditorTextTo(File target) { |
| 358 | if (target == null) |
| 359 | return null; |
| 360 | if (!(target.getParentFile().exists() || target.getParentFile().mkdirs())) |
| 361 | return null; |
| 362 | String path = target.getAbsolutePath(); |
| 363 | try { |
| 364 | BufferedWriter out = new BufferedWriter(new FileWriter(path)); |
| 365 | out.write(textArea.getText()); |
| 366 | out.flush(); |
| 367 | out.close(); |
| 368 | return target; |
| 369 | } catch (IOException ex) { |
| 370 | return null; |
| 371 | } |
| 372 | } |
| 373 | |
| 374 | /** |
| 375 | * Uses a file chooser to define the zip file path. |
no test coverage detected