I am trying to build a plugin for IntelliJ that when pressing a button, it will load env vars from the web to the current Run Configuration.
I couldn't find a way to reach the current Run Configuration, let alone to edit the env vars.
When trying to create new Action all I get as a parameter is a AnActionEvent
and I couldn't find anything useful there
public class HelloAction extends AnAction {
public HelloAction() {
super("Hello");
}
@Override
public void actionPerformed(AnActionEvent event) {
Project project = event.getProject();
}
}
I would be happy for any clue here
To get the current run configuration, use RunManager.getInstance(project).getSelectedConfiguration().getConfiguration()
. Then check if the returned object implements CommonProgramRunConfigurationParameters
, and if it does, call the setEnvs
method of this interface to change the environment variables.