简体   繁体   中英

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

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 (eg Java, Groovy, etc.)

  • Architecture (eg 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.

Quick look into Community Edition source code helped to compose the following:

Sdk projectSdk = ProjectRootManager.getInstance(project).getSdk();

For module:

Sdk moduleSdk = ((ModuleRootManagerImpl)ModuleRootManager.getInstance(module)).getSdk();

Cannot tell anything about Architecture or Language.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM