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

Bug 305390

Summary: encoding change event is not handled.
Product: [Tools] PTP Reporter: John Liu <john_ws_liu>
Component: RDTAssignee: Chris Recoskie <recoskie>
Status: RESOLVED FIXED QA Contact: Chris Recoskie <recoskie>
Severity: normal    
Priority: P3 CC: mikekucera, recoskie
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=305391
Whiteboard:
Bug Depends on: 305391    
Bug Blocks:    
Attachments:
Description Flags
a fix patch, appy to org.eclipse.ptp.rdt.core, org.eclipse.ptp.rdt.core.tests, org.eclipse.ptp.rdt.ui
none
a formatted fix patch, appy to org.eclipse.ptp.rdt.core, org.eclipse.ptp.rdt.core.tests, org.eclipse.ptp.rdt.ui
none
Updated patch, apply to org.eclipse.ptp.rdt.core, org.eclipse.ptp.rdt.core.tests none

Description John Liu CLA 2010-03-10 15:11:45 EST
Build Identifier: 

CDT and RDT do not handle encoding change event, so when an encoding is changed for a file or a project, the remote index is wrong.
There are 3 problems causing this bug:
1, CDT resource listner doesn't handle the encoding change event.
2, Stand-alone indexer doesn't take account of different encoding, it just simply uses the system default encoding.
3, DStore service doesn't pass the files encoding information to the server and server side CDTMiner doesn't handle it.

#1 and 32 will be fixed in cdt and #3 will be fixed in RDT.

Reproducible: Always
Comment 1 John Liu CLA 2010-03-10 15:26:51 EST
Created attachment 161659 [details]
a fix patch, appy to org.eclipse.ptp.rdt.core, org.eclipse.ptp.rdt.core.tests, org.eclipse.ptp.rdt.ui
Comment 2 John Liu CLA 2010-03-11 11:14:15 EST
Created attachment 161756 [details]
a formatted fix patch, appy to org.eclipse.ptp.rdt.core, org.eclipse.ptp.rdt.core.tests, org.eclipse.ptp.rdt.ui
Comment 3 Mike Kucera CLA 2010-03-12 12:32:52 EST
I'm not going to commit this patch until we have some further discussions, because I fell that there are some problems with the approach.

My issue with the patch is the use of scopes and the scope manager to manage the encoding data:

1) We already have a mechanism for passing file information to the remote indexer, IRemoteIndexerInfoProvider. The encoding information should just be added to this object, as we have done every time we've had to pass more information to the remote indexer.

2) We've agreed in the past that we won't store information on the server that duplicates information stored on the client. Having the scope manager hang on to the encoding information goes against this. Storing info on the server means you are now in the business of keeping the client and server in sync (and it makes the server code more complex). Having only one copy of the info on the client guarantees you will never have problems keeping two copies of the same info in sync. This is the approach we have taken so far and I don't see a reason to deviate from it at this point.

3) From what I can tell its only the indexer that uses the encoding information, which is passed over every time there's an index delta (because it might have changed). So if its passing the information every time anyway then why even bother storing it on the server.
Comment 4 John Liu CLA 2010-03-12 18:38:24 EST
(In reply to comment #3)
> I'm not going to commit this patch until we have some further discussions,
> because I fell that there are some problems with the approach.
> My issue with the patch is the use of scopes and the scope manager to manage
> the encoding data:
> 1) We already have a mechanism for passing file information to the remote
> indexer, IRemoteIndexerInfoProvider. The encoding information should just be
> added to this object, as we have done every time we've had to pass more
> information to the remote indexer.
> 2) We've agreed in the past that we won't store information on the server that
> duplicates information stored on the client. Having the scope manager hang on
> to the encoding information goes against this. Storing info on the server means
> you are now in the business of keeping the client and server in sync (and it
> makes the server code more complex). Having only one copy of the info on the
> client guarantees you will never have problems keeping two copies of the same
> info in sync. This is the approach we have taken so far and I don't see a
> reason to deviate from it at this point.
> 3) From what I can tell its only the indexer that uses the encoding
> information, which is passed over every time there's an index delta (because it
> might have changed). So if its passing the information every time anyway then
> why even bother storing it on the server.

Good points, Mike. I was not aware of this mechanism. I will upload the updated patch with your suggested approach soon.
Comment 5 John Liu CLA 2010-03-12 18:41:22 EST
Created attachment 161947 [details]
Updated patch, apply to org.eclipse.ptp.rdt.core, org.eclipse.ptp.rdt.core.tests
Comment 6 Mike Kucera CLA 2010-03-15 13:35:03 EDT
Thanks John. I've committed the new patch with a few minor changes.

Committed to 2.1.
Comment 7 Mike Kucera CLA 2010-03-16 17:29:05 EDT
Fixed in head