Summary: | Compilation Unit not shown in Package Explorer after a rename | ||||||
---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Frederic Fusier <frederic_fusier> | ||||
Component: | Core | Assignee: | Jerome Lanneluc <jerome_lanneluc> | ||||
Status: | VERIFIED FIXED | QA Contact: | |||||
Severity: | major | ||||||
Priority: | P3 | CC: | martinae | ||||
Version: | 3.3 | ||||||
Target Milestone: | 3.3 M7 | ||||||
Hardware: | PC | ||||||
OS: | Windows XP | ||||||
Whiteboard: | |||||||
Attachments: |
|
Description
Frederic Fusier
2007-03-20 06:06:09 EDT
Feel free to change the summary, I cannot find a real good phrase to summarize this scenario... This is the Java element delta log: a.) ElementChangedEvent[source=[Working copy] Test1.java[*]: {CHILDREN | FINE GRAINED | AST AFFECTED} Test12[+]: {} Test1[-]: {}] b.) ElementChangedEvent[source=[Working copy] Test1.java[*]: {CHILDREN | FINE GRAINED} Test1[+]: {} Test12[-]: {}] c.) ElementChangedEvent[source=[Working copy] Test1.java[*]: {AST AFFECTED}] d.) ElementChangedEvent[source=Java Model[*]: {CHILDREN} Test1[*]: {CHILDREN} src[*]: {CHILDREN} p[*]: {CHILDREN} [Working copy] Test1.java[*]: {PRIMARY RESOURCE}] e.) ElementChangedEvent[source=Java Model[*]: {CHILDREN} Test1[*]: {CHILDREN} src[*]: {CHILDREN} p[*]: {CHILDREN} [Working copy] Test1.java[-]: {MOVED_TO(Test12.java [in p [in src [in Test1]]])} Test12.java[+]: {MOVED_FROM([Working copy] Test1.java [in p [in src [in Test1]]])}] f.) ElementChangedEvent[source=[Working copy] Test12.java[*]: {AST AFFECTED}] g.) ElementChangedEvent[source=[Working copy] Test12.java[*]: {AST AFFECTED}] h.) ElementChangedEvent[source=Java Model[*]: {CHILDREN} Test1[*]: {CHILDREN} src[*]: {CHILDREN} p[*]: {CHILDREN} Test1.java[+]: {}] i.) ElementChangedEvent[source=Test1.java[*]: {CHILDREN | FINE GRAINED} package p[+]: {} Test1[+]: {}] j.) ElementChangedEvent[source=Java Model[*]: {CHILDREN} Test1[*]: {CHILDREN} src[*]: {CHILDREN} p[*]: {CHILDREN} [Working copy] Test1.java[-]: {PRIMARY WORKING COPY} [Working copy] Test12.java[*]: {PRIMARY WORKING COPY}] k.) ElementChangedEvent[source=[Working copy] Test1.java[*]: {AST AFFECTED}] In a.), the user uses the new lightweight UI to rename type Test1 to Test12 directly in the editor In b.), the refactoring internally reverts the change so it can invoke the original refactoring In e.), the real refactoring takes place, CU is moved In h.), the new type is created as Test1 In j.), the new type is opened in the editor, but the delta looks wrong: 'Test1.java' removed, 'Test12.java' modified Thats why the package explorer removes Test1 again. Problem comes from a checkpoint made by refactoring in the middle of a batch operation. The working copy discard is done after the checkpoint but we still think that we're going to get a resource delta (JavaModelOperation.hasModifiedResource() returns true). Thus the delta corresponding to the working copy discard is never fired. Created attachment 62752 [details]
Proposed fix and regression test
The fix consists in changing DeltaProcessor#firePostChangeDelta(...) to reset the 'has modified resource' attribute on the JavaModelOperation.
Fix and test released for 3.3M7 in HEAD Verified for 3.3 M7 using build I20070427-0010 |