Associate file-extension to 2 diff content-types based on file name patterns [message #517568] |
Mon, 01 March 2010 06:17  |
Eclipse User |
|
|
|
Hello folks,
I have a situation with respect to content-type assocation with file extensions.
I have 2 files whose file-name postfix strings are standardized (let's call them ab.xyz and cd.xyz - note the same extension)
*ab.xyz is associated with MyContentType1
*cd.xyz is assocaited with MyContentType2
Now, in my application's preferences - I am able to view *ab.xyz and *cd.xyz under 2 separate categories (which is fine and the way it should be), however when I try to retrieve content-type id for a file named "sample_ab.xyz" "MyContentType2" is returned instead of MyContentType1.Code to get content-type description is delegated to IFile api.
Your thoughts please.
Thanks!
|
|
|
|
|
|
|
Re: Associate file-extension to 2 diff content-types based on file name patterns [message #517603 is a reply to message #517587] |
Mon, 01 March 2010 09:07  |
Eclipse User |
|
|
|
Chetan,
Comments below.
Chetan Kumar wrote:
> Hello Ed,
>
> Then mere file-association with a content-type based on file-names
> will not solve my problem.
Nope.
>
> Ultimately, with this set-up i want to load these 2 files (with same
> extn but different file-name postfix) into 2 different EMF models.
It seems likely then that the namespace of the root element or the name
of the root element should be sufficient to define the content type
without resorting to this notion of the postfix itself making the
distinction...
> The actual ContentType contributions associated with my 2 files is a
> black-box for me.
I'm not sure I understand that comment. Why?
> So, will contributing to EMF content_handler extension-point solve the
> problem ?
Yes, it will solve the problem from and EMF point of view, but the
platform itself uses content types to determine things like editor
associations and for that, the more flexible EMF solution won't help.
> as in, with my ContentHandler implementation - i can override the
> getFactory(URI) method to return based on file-name postfix strings.
>
> + Chetan Kumar
|
|
|
Powered by
FUDForum. Page generated in 0.04422 seconds