Bug 53297 - [rename] Renaming a source folder/output folder or one of its parents should automatically be reflected in the Java Build Path [refactoring]
Summary: [rename] Renaming a source folder/output folder or one of its parents should ...
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: All Linux
: P4 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Markus Keller CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 85799 131494 158932 196743 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-02-27 12:40 EST by Jonas Kongslund CLA
Modified: 2010-04-20 14:51 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonas Kongslund CLA 2004-02-27 12:40:35 EST
Assume I have one output folder and two source folders like this: 
 
modules/foo/classes 
modules/foo/src/java 
modules/foo/src/unittest 
 
If I rename the module foo to bar then the changes should automatically be reflected 
in the Java build path. Current behavior is that the build path still points to the old 
folders and the output folder is recreated.
Comment 1 Dirk Baeumer CLA 2004-03-09 12:48:43 EST
Time permitted for 3.0.
Comment 2 Martin Aeschlimann CLA 2006-08-03 11:50:33 EDT
*** Bug 131494 has been marked as a duplicate of this bug. ***
Comment 3 Martin Aeschlimann CLA 2006-08-03 12:16:28 EDT
*** Bug 85799 has been marked as a duplicate of this bug. ***
Comment 4 Martin Aeschlimann CLA 2006-10-04 09:18:24 EDT
*** Bug 158932 has been marked as a duplicate of this bug. ***
Comment 5 Martin Aeschlimann CLA 2007-07-17 06:22:56 EDT
*** Bug 196743 has been marked as a duplicate of this bug. ***
Comment 6 Markus Keller CLA 2010-04-20 14:51:19 EDT
From bug 131494:

There's no java model representation for the IFolder to be renamed, so we just rename the resource.

To update the build path, jdt.core would have to listen to IFolder renames and
then update the classpath "behind the scenes". Since we don't have that style
of automatic updates anywhere else, I guess UI has to do it. However, this is
not trivial, since we would have to

- check for all folder moves/renames whether there's a nested source folder

- see how we can use IPackageFragmentRoot#move(..) to move the source folders
(this updates references in classpaths of referring projects). The problem here
is that the source folder is a child of the renamed folder, and thus we would
have to do some manual dance to make sure that source and target are both
available for the move. This can become arbitrarily complex in the general
case, so I guess it would be easier to just update the classpath manually in
this case (if we want to support it at all).