DefaultProjectOperationsImplementation.doRenameProject is too similar to doMoveProject, when all it should be doing is changing some metadata:
1. There is no good reason to close and reopen the project, when it should be the same Project object as before, i.e. assert project == nue. The MoveOperationImplementation's should be the same as well.
2. Calling MoveOperationImplementation methods is suspect. These are designed for an actual move, where project != nue. For example, J2SEProjectOperations loads and then restores various private metadata, some of which is unnecessary if you are only changing the <name>. Worse, AntProjectHelper.notifyDeleted is called, which could cause problems later when saving metadata.
#1 can be fixed in DPOI. #2 could be worked around in the project type, e.g. by doing nothing harmful in notifyMoving and having notifyMoved explicitly checking whether original == this. Or it might be cleaner to have a separate RenameOperationImplementation. (Not clear how to maintain compatibility in that case.)
Created attachment 96926 [details]
Includes new SPI (minus apichanges); usage; and a sample implementation in j2seproject.
Please review this API change.
*** Bug 180369 has been marked as a duplicate of this bug. ***
TM01 I would move handle.finish(); (DefaultProjectOperationsImplementation.java) to the finally block.
TM01 - not really necessary since the ProgressHandle is only actually displayed in a dialog, which is always closed when the operation finishes (whether successfully or not). I'm sure the code could be cleaned up in various ways but I don't think there is any visible bug in this area. Anyway the same comment would apply to any of the project operations, not just rename, so it is orthogonal to this issue.
Committed with updates also for ant.freeform and apisupport.project, and fixed main window title to immediately update when the selected project's name changes (previously you had to change the selection before this happened). core-main #83c32e15b1b6
Integrated into 'main-golden', will be available in build *201004160201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
User: Jesse Glick <firstname.lastname@example.org>
Log: Issue #183680: offer a simplified way of renaming a project when it is not physically moved.