| Summary: | ISaveContext.map() does not remove a file when a null location is specified | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Julien Canches <julien.canches> |
| Component: | Resources | Assignee: | Platform-Resources-Inbox <platform-resources-inbox> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | 3.5.2 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | stalebug | ||
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. If the bug is still relevant, please remove the "stalebug" whiteboard tag. |
Build Identifier: 3.5.2.R35 M20100211-1343 Documentation for ISaveContext.map(IPath, IPath) states about the second parameter: "location: the real (i.e., filesystem) name by which the file should be known for this save, or null to remove the entry" But calling context.map(logicalPath, null) has no effect. Subsequent calls to context.lookup(logicalPath) still return a non-null value. As a consequence, it is impossible to remove a mapped entry for a save participant. This is confirmed by looking at the code (org.eclipse.core.internal.resources.SafeFileTable) in method map(IPath, IPath): public void map(IPath file, IPath aLocation) { if (aLocation == null) table.remove(file); else table.setProperty(file.toOSString(), aLocation.toOSString()); } The remove line should be: table.remove(file.toOSString()); Reproducible: Always Steps to Reproduce: 1. Write a save participant using this skeleton: public class MSaveParticipant implements ISaveParticipant { public void saving(ISaveContext context) { IPath logicalPath = new Path("myFile"); IPath actualPath = new Path("myFile.0"); context.map(logicalPath, actualPath); context.map(logicalPath, null); System.out.println(context.lookup(logicalPath)); } ... } 2. Invoke this save participant from your plugin start method (addSaveParticipant). 3. Run eclipse and close. The method saving() will be invoked. 4. Check the console. null should be printed, but myFile.0 is actually printed.