Bug 83599

Summary: CU dirty after move refactoring
Product: [Eclipse Project] JDT Reporter: Dani Megert <daniel_megert>
Component: CoreAssignee: Jerome Lanneluc <jerome_lanneluc>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: P3 CC: baikuo21, john.arthorne
Version: 3.1   
Target Milestone: 3.1 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Dani Megert CLA 2005-01-25 06:42:44 EST
Plug-in export (JDT HEAD + JDT Core v_532c) for I20050125-0800

1. Open a CU
2. Move the CU from to package anotherPack
==> CU in editor is now dirty but should be saved

Works when using jdtcore.jar from last I-build.

Marking as major since I don't know which other side-effects this might have.
Comment 1 Jerome Lanneluc CLA 2005-01-25 17:46:57 EST
Looks like the file is saved (if you revert the editor, the content doesn't
change). It is just marked as dirty. But I don't know why.

Dani, how does the editor find out it is dirty ?
Comment 2 Dani Megert CLA 2005-01-26 03:30:14 EST
This is done via IFileBuffer. If you commit a buffer it sets the dirty state
(IFileBuffer.isDirty()) to false and notifies all listeners (includes editors)
via  TextFileBufferManager.fireDirtyStateChanged(...).

Do you no longer call commit(...) and just save the file on disk?

Let me know if I can help to track it down.
Comment 3 Dirk Baeumer CLA 2005-01-26 04:35:27 EST
*** Bug 83686 has been marked as a duplicate of this bug. ***
Comment 4 Jerome Lanneluc CLA 2005-01-26 04:41:07 EST
Thanks for helping. It looks like we never called commit (even in previous
builds) while doing a move. We just move the file, update its contents and fire
the right delta. 

However we used to not do any side effect on the IDocument. We do now since we
use the IDocument to do the code manipulation. I'll see if I can use a new
IDocument instead, unless you prefer this solution.
Comment 5 Dani Megert CLA 2005-01-26 04:44:47 EST
>unless you prefer this solution.
No, because the refactoring currently wants the file to be in a saved state. It
would look strange (at least to me) to have it unsaved afterwards.
Comment 6 Jerome Lanneluc CLA 2005-01-26 07:26:07 EST
Changed CopyResourceElementsOperation to do the side effect only on the
IDocument of the destionation cu.
Added regression test CopyMoveResourceTests#testWorkingCopy2()
Comment 7 Jerome Lanneluc CLA 2005-01-28 06:35:41 EST
*** Bug 83861 has been marked as a duplicate of this bug. ***
Comment 8 David Audel CLA 2005-02-15 11:04:22 EST
Verified in I20050214-0927