Bug 149190 - Setting project preferences checks out files silently
Summary: Setting project preferences checks out files silently
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 3.0.2   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 3.3 M7   Edit
Assignee: John Arthorne CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 160905
Blocks:
  Show dependency tree
 
Reported: 2006-06-29 12:39 EDT by Joef Huang CLA
Modified: 2007-03-27 18:27 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joef Huang CLA 2006-06-29 12:39:21 EDT
Scenario:
1, In a team environment, user1 launches a workspace and maps to a ClearCase stream
2, User1 imports the project with the auto-build on
3, One of the builder calls Eclipse IFILE.setCharset() API on newly generated files as a result of the build
4, Notice .settings/org.eclipse.core.resources.prefs file is silently checked out in user1's view

5, User2 launches a workspace and maps to the same stream as user1
6, User2 imports the project with the auto-build on
7, Build failed with no error
8, Notice in .log file, there are errors complaining about not able to check out .settings/org.eclipse.core.resources.prefs file

Expected result:
Eclipse IFILE.setCharset() API shouldn't check out files silently, whenever it needs to access a file, it should prompt for a check out dialog to get user's attention, or at least it should generate a build report with the detailed error messages inside in order for user to quickly fix the errors and rebuild again.
Comment 1 John Arthorne CLA 2006-07-18 15:40:59 EDT
This is a known problem. There is an API called IFileModificationValidator that is used to notify a repository that an attempt is being made to modify a read-only file.  When the validator receives an edit request, it checks the file out of the repository and makes it writable.  If a Shell is passed along with the edit request, then the validator will prompt the user to confirm before doing so. The code that stores preferences such as the file's charset does not have any knowledge/dependency on any UI, so it can't provide a Shell to use as the parent for the prompt dialog. Thus there is no prompt and the checkout occurs silently.

Can you provide the stack trace from the failure?  It sounds like the builder could do a better job of surfacing the error.
Comment 2 John Arthorne CLA 2006-07-18 15:42:19 EDT
(there is related discussion in bug 130266)
Comment 3 John Arthorne CLA 2007-03-21 18:22:33 EDT
This is an easy fix for M7 now that we have the necessary validateEdit API.
Comment 4 John Arthorne CLA 2007-03-27 17:44:23 EDT
Updating title, since charsets are just stored as project preferences.  The silent checkout problem actually lies in the project preference code.
Comment 5 John Arthorne CLA 2007-03-27 18:27:38 EDT
Fix released.