Last modified: August 27th, 2004
This document is a place where to gather the requirements and plan a solution for bug 59899
This is the most basic scenario - affects the IFile#setCharset operation.
Fix: instrument File#setCharset (the long-running version) to mark the file as having encoding changes.
Although the user action is different, this is similar to the scenario above.
Fix: the same as in the case mentioned.
Although this may not be easy to support, it is also a basic requirement. Affected operation: IContainer#setDefaultCharset.
Planned fix: WorkspaceRoot/Project/Folder#setDefaultCharset need to traverse all children and mark those that a) don't have an encoding explicitly set and b) do not belong to any content type that provide a default encoding as having encoding changes.
Actual fix: as planned, except that no deltas are generated for changes to the workspace root.
It is not clear we need any special support here. Not sure whether builders and interesting listeners always simply treat a file being moved as a big change and rebuild the affected model, or they just adjust their model correspondingly (re: resource's path change), without recomputing anything.
Fix: no action required - listeners interested in encoding changes should consider MOVED_FROM/TO deltas as indication the encoding may have changed.
This would cause preference change events to be broadcast. We would have to capture such events and generate a corresponding resource change event. One problem here is that we are in the context of a POST_CHANGE/PRE_DELETE notification (workspace is closed for changes).
Planned fix: project preference changes in this case will be sent while the workspace is still open for business. A project preference change listener has then to (from inside an workspace operation) mark all affected resources as having encoding changes.
Actual fix: when the project preferences file that stores the charset preferences is changed, we fire encoding change events (in a background job) for *all* resources in the project, since we have no means to figure out which ones actually changed.
The changes will be caught when the file is refreshed, but it may not be possible to figure out what the previous values of properties were (for instance, when the properties have never been loaded in memory before). Other than that, is the same scenario as above.
Fix: the same as in the case mentioned.
There will be no way to figure out what the previous values for the properties were. No changes will be detected.
Fix: none.
A preference change listener would have to react appropriately by issuing a resource change event for the workspace root (and all affected children!). This is similar as the case where changes are made directly to the file.
Planned fix: the same as in the case mentioned.
Actual fix: the Platform/UI has been requested to use IWorkspaceRoot#setDefaultCharset instead (bug 71742). This handles the case the user changes its preferences but does not handle the case preferences are imported. This needs more work.
We would have to keep a copy of the preference value somewhere and check it during startup. If it has changed, the same as above would have to be done.
Planned fix: during startup, compare the last workspace encoding (need to remember that somewhere) and the new one. If it has changed, mark the affected files accordingly.
Actual fix: none.
Similar to above.
Planned fix: the same as in the case mentioned.
Actual fix: none.
A regular resource change event is already issued for the content change. Should not have to do anything else.
Fix: no action required. Clients are expected to react to content changes considering that the encoding may have changed.
Planned fix: a preference change listener would have to catch the event and produce the appropriate delta for every affected resource in the whole workspace.
Actual fix: we listen for content type change events and produce the appropriate delta for every affected resource in the whole workspace. We are not smart enough to avoid generating deltas for files that have a user-set encoding, which are not actually affected.
Same as above.
Planned fix: the same as in the case mentioned.Actual fix: when a change to a content type happens, encoding change events will be generated (in a background job) for all files whose names match the content type's current definition.This acknowledgedly misses the case where a file ceases to belong to a content type that used to determine its encoding.
This is caught by the MODE_FROM/MOVED_TO case. Clients are expected to recompute their internal state when a file has its name changed.
Fix: no action required.
There would be no property/registry change events for that.
Fix: none.
The Resources plug-in is not expected to react properly on such situations (it is not supposed to be dynamic-aware).
Fix: none.