This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
In cases where there is a corrupt configuration file, it is often desirable to revert local modifications to it after logging the error. You can do this by asking for a magic file attribute, but this is essentially impossible to discover and pretty ugly. Better to hide that (for the client) behind a convenience method. See issue #90220 for an example use case. (Would be good to grep sources for "removeWritables".)
Now used also in org.apache.tools.ant.module.wizards.shortcut.ShortcutWizard. BTW if a file is removed from $userdir/config and the containing folder is now empty, the folder should be removed too, recursively (up to $userdir/config itself).
We have "removeWritables" as you pointed out. If you want nicer API, consider passing API review.
Probably need also canRevertConfigFile to check ahead of time for modifications. Would like to use to simplify c50b3b53f3db, though unfortunately it seems that removeWritables is currently not listed on folders, only files??
Feel free to assign back to me.
No patch, no change.
That's why it was assigned to me.
Created attachment 113430 [details] Proposed patch (API plus usages)
Please review.
Added an extra test contradicting comment #3, and tweaked the Templates dialog rename logic a bit to properly handle layer folders with user-added entries. core-main #17c7e53a5354
Integrated into 'main-golden' Changeset: http://hg.netbeans.org/main-golden/rev/17c7e53a5354 User: Jesse Glick <jglick@netbeans.org> Log: #162526: FileObject.revert.