Index: org/netbeans/modules/diff/PatchAction.java =================================================================== RCS file: /cvs/diff/src/org/netbeans/modules/diff/PatchAction.java,v retrieving revision 1.12 diff -u -r1.12 PatchAction.java --- org/netbeans/modules/diff/PatchAction.java 6 May 2003 13:13:14 -0000 1.12 +++ org/netbeans/modules/diff/PatchAction.java 1 Jul 2003 15:00:21 -0000 @@ -212,6 +212,7 @@ if (NotifyDescriptor.YES_OPTION.equals(notifyResult)) { showDiffs(appliedFiles, backups); } + removeBackups(appliedFiles, backups); } } @@ -317,7 +318,26 @@ public HelpCtx getHelpCtx() { return new HelpCtx(PatchAction.class); } - + + /** Removes the backup copies of files upon the successful application + * of a patch (.orig files). + * @param files a list of files, to which the patch was successfully applied + * @param backups a map of a form original file -> backup file + */ + private static void removeBackups(ArrayList files, HashMap backups) { + for (int i = 0; i < files.size(); i++) { + try { + ((FileObject) backups.get(files.get(i))).delete(); + } + catch (IOException ioex) { + ErrorManager.getDefault().notify( + ErrorManager.getDefault().annotate(ioex, + NbBundle.getMessage(PatchAction.class, "EXC_CannotRemoveBackup", + ioex.getLocalizedMessage()))); + } + } + } + class ChooserListener implements ActionListener{ private JDialog dialog; private JFileChooser chooser; Index: org/netbeans/modules/diff/Bundle.properties =================================================================== RCS file: /cvs/diff/src/org/netbeans/modules/diff/Bundle.properties,v retrieving revision 1.17 diff -u -r1.17 Bundle.properties --- org/netbeans/modules/diff/Bundle.properties 10 Mar 2003 16:28:11 -0000 1.17 +++ org/netbeans/modules/diff/Bundle.properties 1 Jul 2003 15:00:22 -0000 @@ -44,6 +44,7 @@ MSG_NotFoundFiles=Following files are to be patched, but not found: {0} MSG_PatchAppliedSuccessfully=Patch applied successfully. View applied changes? MSG_PatchAppliedPartially=Patch applied partially. View applied changes? +EXC_CannotRemoveBackup=The backup copy of a file cannot be removed after succesfull application of a patch: {0} # DiffSettingsBeanInfo PROP_diffService=Default Diff Service