Supporting extension less files in eclipse.
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Bunty_More
Posted On:   Thursday, April 5, 2007 07:30 AM

Hi,

Please help me on How to identify the type of files which does not have any extension ?
Files may be of type Java,cobol,c etc...
Files will be kind of IFile resource in the Eclipse navigator.

Thanks in advance....!!!

Re: Supporting extension less files in eclipse.

Posted By:   Christopher_Koenigsberg  
Posted On:   Saturday, April 21, 2007 04:01 PM

...Files may be of type Java,cobol,c etc...


So you're getting a file containing arbitrary source code, and you have to read it and guess which language it is written in? What a weird problem, though it does sound like fun. At least you must have a list of the possible languages.


Maybe an initial brute force way would be to run a compiler, preprocessor, or a syntax checker (find them, or write them yourself, I guess, with some regexps, or in lex/flex/ANTLR etc?), for the start of a source code file, in each possible language you might be expecting, one at a time, until one of them doesn't blow up due to invalid syntax? and probably you want to start with the languages that have the most restricted syntax first, at least for the start of a source code file.....

Re: Supporting extension less files in eclipse.

Posted By:   kulbir_singh  
Posted On:   Tuesday, April 17, 2007 05:51 AM

just check the API for IContent, IType, or IContentType

might be it will help u but not sure...


cheers

Kubir Singh
About | Sitemap | Contact