Cristiano Ghersi
Cristiano Ghersi

Reputation: 2122

How to retrieve programming language of current file in Eclipse plugins?

I'm trying to develop an Eclipse plugin that guesses some properties regarding the file that is currently edited.

E.g. I'd like to guess programming language (e.g. Java, C++, xml, etc.), JRE version supported (e.g. for Java projects), etc.

I found something using the following:

ResourcePlugin.GetWorkspace().getRoot().getFileExtension();
ResourcePlugin.GetWorkspace().getNatureDescriptors();
ResourcePlugin.GetWorkspace().getRoot().getPersistentProperties();

but these are not enough for me. Any hint about this?

Upvotes: 2

Views: 78

Answers (1)

Tonny Madsen
Tonny Madsen

Reputation: 12718

Check IFile.getContentDescription().getContentType().getName()... It will give you the basis for how Eclipse choose the editor used to open the file...

Upvotes: 1

Related Questions