How to programmatically retrieve information like language, OS, Architecture, etc. regarding the current project

Hi all,

I'm pretty new to IntelliJ plugin development and I was wondering if there's the possibility to retrieve some information regarding the current project (or better the current edited file).
The information I'd like to have access are the following:
- Language (e.g. Java, Groovy, etc.)
- Architecture (e.g. x86, x64, etc.) and OS (WindowsXP, LinuxUbuntu, MAC OS X, etc.) of the machine where IntelliJ is running onto
- For Java projects, JVM used to build the project

I'm extending a DumbAwareAction and in the actionPerformed(AnActionEvent event) method I found something like this:
        Project project = event.getData(PlatformDataKeys.PROJECT);
but I cannot find such information here

Please, help me! :)

Thank you very much
Best
cghersi

---
Original message URL: http://devnet.jetbrains.net/message/5508991#5508991

3 comments
Comment actions Permalink

I recommend reading the PsiFile documentation http://confluence.jetbrains.com/display/IDEADEV/IntelliJ+IDEA+Architectural+Overview#IntelliJIDEAArchitecturalOverview-PsiFiles
The PsiFile will contain the method getFileTye() which will contain a lot of language information. Note, files may also be using language injection, and there is a useful util library to access such information
Please also see the JavaPsiFacade for a Java specific API

If you want to access OS specific information, this is available statically within the system properties, ie with System.getProperty("os.name"). I'm not sure if intellij offers a tyesafe wrapper or such to this information however.

Hopefully this is enough to get you started :)

0
Comment actions Permalink

Some OS info is additionally available via com.intellij.openapi.util.SystemInfo


0
Comment actions Permalink

For anyone passing by, please also see this duplicated post - http://devnet.jetbrains.com/thread/452610

0

Please sign in to leave a comment.