Saves a log to a text file selected with a chooser. @return the name of the file
()
| 629 | * @return the name of the file |
| 630 | */ |
| 631 | public String saveLogAs() { |
| 632 | int result = getChooser().showSaveDialog(null); |
| 633 | if(result==JFileChooser.APPROVE_OPTION) { |
| 634 | File file = getChooser().getSelectedFile(); |
| 635 | // check to see if file already exists |
| 636 | if(file.exists()) { |
| 637 | int selected = JOptionPane.showConfirmDialog(frame, |
| 638 | ControlsRes.getString("OSPLog.ReplaceExisting_dialog_message") + file.getName() //$NON-NLS-1$ |
| 639 | + ControlsRes.getString("OSPLog.question_mark"), //$NON-NLS-1$ |
| 640 | ControlsRes.getString("OSPLog.ReplaceFile_dialog_title"), //$NON-NLS-1$ |
| 641 | JOptionPane.YES_NO_CANCEL_OPTION); |
| 642 | if(selected!=JOptionPane.YES_OPTION) { |
| 643 | return null; |
| 644 | } |
| 645 | } |
| 646 | String fileName = XML.getRelativePath(file.getAbsolutePath()); |
| 647 | return saveLog(fileName); |
| 648 | } |
| 649 | return null; |
| 650 | } |
| 651 | |
| 652 | /** |
| 653 | * Saves the xml-formatted log records to a file specified by name. |
no test coverage detected