[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform] Content types, contentTypeBinding

Hi all,

I've been searching through google, this newsgroup, some javadoc and the content type implementation code, but couldn't get an answer for this.

I developped an editor and would like to define dynamically which files it must handle. Thus I created a ContentTypeDescriber who'll be able to do this ... Only to realize it's "describe" methods are never called ... after doing a little debugging through ContentTypeCatalog and the such, I finally found why : I would like my editor to be associated with any file containing XML content, but I *do not know* either the file name or the file extension.

As an example, a file called "foo.bar" or even "cock-a-doodle.doo" could very well contain xml content and thus could be opened as such. The actual implementation for content type binding within eclipse will never call a ContentTypeDescriber's "describe" method if we have defined it to be associated to filename "*" and file extension "*".

org.eclipse.core.internal.content.ContentTypeCatalog#internalFindContentTypesFor(org.eclipse.core.internal.content.ContentTypeMatcher, java.lang.String, java.util.Comparator) is in charge of finding the content type for a given file name. It will try to find a content type for : 1) the file name, 2) the file extension. Wouldn't it be possible to search for the "generic" content types too? This would at the same time allow us to get a content-type describer to try and describe files with no extension.

Regards,
Laurent Goubet
Obeo
begin:vcard
fn:Laurent Goubet
n:Goubet;Laurent
org:Obeo
email;internet:laurent.goubet@xxxxxxx
url:http://www.obeo.fr
version:2.1
end:vcard