Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 329972 - FileBufferModelManager chooses wrong content type for external files
Summary: FileBufferModelManager chooses wrong content type for external files
Status: RESOLVED FIXED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.sse (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.2.3   Edit
Assignee: Rakesh CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-11 03:01 EST by Jens Elmenthaler CLA
Modified: 2010-11-12 11:29 EST (History)
2 users (show)

See Also:
nsand.dev: review+


Attachments
patch (969 bytes, patch)
2010-11-12 02:07 EST, Rakesh CLA
nsand.dev: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jens Elmenthaler CLA 2010-11-11 03:01:07 EST
Build Identifier: Helios

detectContentType(IPath location) calls findContentTypeFor with path instead of file name.

    Platform.getContentTypeManager().findContentTypeFor(input, location.toOSString());

should be

    Platform.getContentTypeManager().findContentTypeFor(input, location.lastSegment());

Reproducible: Always
Comment 1 Rakesh CLA 2010-11-11 04:03:07 EST
Could you attach a test-case, or provide steps where it is failing?
Comment 2 Jens Elmenthaler CLA 2010-11-11 04:19:49 EST
(In reply to comment #1)
> Could you attach a test-case, or provide steps where it is failing?
Have two content type extensions:
   a) one using a file extension: *.xml (should be already there if you have the wst plugins installed).
   b) one using a complete file name, using the same file extension: specific_file.xml

If I open my specific_file.xml from within the Eclipse workspace, the content type for b) is selected. If the specific_file.xml is not part of my Eclipse workspace, but is opened as external file, the xml content type is chosen.

For me it hurts, because the name of the context menu in the XML editor is a different depending on how I open the editor, since the XML editors derive the name of certain context menus from the underlying content type. In one case my context menu contributions appear, in the other they dont't.
Comment 3 Rakesh CLA 2010-11-12 02:07:30 EST
Created attachment 182959 [details]
patch

Platform's ContentTypeManager expects file name to be last name , since it is expected to be mentioned in extension point and not the full name.
I was able to reproduce it with the steps above.
Comment 4 Nick Sandonato CLA 2010-11-12 11:29:37 EST
Patch looks good. Thanks.