Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 190768

Summary: Quick diff marks do not disappear in the vertical ruler of JavaScript editor
Product: [WebTools] WTP Source Editing Reporter: Tomoki Shiratori <shiratori.tomo>
Component: wst.sseAssignee: Nitin Dahyabhai <thatnitind>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 Flags: for.work.things: review+
Version: 2.0   
Target Milestone: 2.0 RC4   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Patch for SSE FileBufferModelManager none

Description Tomoki Shiratori CLA 2007-06-04 05:53:55 EDT
Build ID: I20070517-1700

eclipse-SDK-3.3RC1-win32
+ wtp-sdk-S-2.0RC1-200705250432
+ atf-incubation-0.2.2-v200705251000

Steps To Reproduce:

1. Make sure that JavaScript Syntax Validator and JSLint Validator are enabled.
2. Open a JavaScript file with JavaScript editor.
3. Add some lines in the file. Quick diff marks appear to the left of the lines.
4. Save the file. Then the marks disappear. It is a correct behavior.
5. Open the file again with JavaScript editor.
6. Add some lines in the file again. Quick diff marks appear.
7. Save the file. Then, you will see the marks do not disappear. It is a wrong behavior.

It happens only when JavaScript Syntax Validator and JSLint Validator are enabled. If you disable them, it does not happen. This is because I send this bug to ATF.
Comment 1 Robert Goodman CLA 2007-06-05 08:33:09 EDT
Interesting, atfer this problem occurs I can delete the file from the project, copy a different file with the same name to the project and the quick diff markers show up. 
Comment 2 Robert Goodman CLA 2007-06-05 23:47:20 EDT
This is a really bad bug. I think the problem is in org.eclipse.wst.sse.core.internal.provisional.IModelManager getModelForRead(file). If the file doesn't represent a structure document, the code must be leaving some lock on the file so that it doesn't close correctly. The causes a lot of problems including the contents on the file not matching the contents in the editor. It also causes problems when deleting the file, since the file isn't completely deleted. This occurs when the getModelForRead(file) is made for a JavaScript file. Instead of making the call and testing for null to determine whether the file is a JavaScript file, I will work around the problem by changing the code to determine whether it is a JavaScript file by other means. 

I will also contact the component owner of the ModelManger,  since this seems to be a bug in that component. 
Comment 3 Nitin Dahyabhai CLA 2007-06-06 01:04:22 EDT
(In reply to comment #2)
> I will also contact the component owner of the ModelManger,  since this seems
> to be a bug in that component. 

Consider me contacted.

You're right, in the case of a non-SSE file type, the org.eclipse.wst.sse.core.internal.FileBufferModelManager.getModel(IFile) method will call connect() on the TextFileBufferManager but never call the disconnect() if the document in the buffer is not an IStructuredDocument.  I'm not fully up to speed on ATF's schedule, given that WTP is working on RC3, what sort of timeframe is ATF looking at for a fix?  Will our 2.0.1 builds do?
Comment 4 Nitin Dahyabhai CLA 2007-06-06 01:11:52 EDT
Created attachment 70275 [details]
Patch for SSE FileBufferModelManager

Corrects the SSE FileBufferModelManager so it doesn't keep the file's ITextFileBuffer open.
Comment 5 Robert Goodman CLA 2007-06-06 10:57:49 EDT
I can change the code to work around the problem. I'm going to check to see if the file only has JavaScript content type and does not also have HTML or JSP content type. If the file only has JavaScript content type, I will not call getModelForRead(file). 
Comment 6 Robert Goodman CLA 2007-06-06 12:13:11 EDT
I committed a work around for the problem. I'm transferring the bug to the wst.sse component. 
Comment 7 Nitin Dahyabhai CLA 2007-06-21 23:32:43 EDT
Patch released in RC4 on behalf of bug 193805.