Refactor projects and files

Refactoring includes moving or renaming projects or project elements.

For best results, keep the following in mind when performing refactoring operations:

  • Before refactoring, all users should check in their changes.

  • After refactoring, all users should get the updated project from source control.

Refactoring includes renaming files within a project and moving a file between two different projects. The Dimensions CM for Eclipse integration retains the file history when you move a file between projects using the refactoring option.

When performing a move between projects as part of refactoring, we strongly recommend that you set the files to be updated as part of the refactoring in Local Mode. This is not necessary when working with Dimensions CM streams.

If the files are checked out, there is a conflict with the removal of the source file from source control as part of the cross-project move operation. The checked out revision will not be removed from source control, and you will receive a message to this effect in the console. The checked out revision will remain in Dimensions CM and will be picked up by subsequent project structure synchronization operations. These revisions must have the checkout canceled and be removed from the source project using the desktop client.

A particular case of this is moving a file to a different package in the second project. The Eclipse java tooling identifies that it needs to update the file with the new package name and initiates a checkout operation.

If the file is checked out, then the subsequent attempt to remove it from source control will not remove the checked out revision. Thus the recommendation to use local mode. This will make the file writable and the java refactoring code will be able to update the file as part of the move to the new package in the target project. As it is not checked out, the remove will succeed.

The same will apply if files are checked out by another user prior to performing the refactoring. The revision checked out to the other user will not be removed and a warning will be issued in the console. These revisions must have the checkout canceled and be removed from the source project using the desktop client as the appropriate user.

We recommend using the Team > Refresh Project Status feature to check that files which will be updated and moved are not checked out by other users (The Lock icon or layered Lock icon) or are not checked out by you and other users (The layered Check icon) prior to performing the refactoring.

Back to top

See also: