How do I listen to run events within my own intellij plugin?
Answered
I want to implement my own hot deploy plugin, so I need to listen to the service's `Run` event and `Debugger` event.
I know that debug events need to use XDebuggerManagerListener and i got debugger event.
now i have implemented RunManagerListener for the run event, but it doesn't work, I can't listen to the service startup message. What should I do?
Please sign in to leave a comment.
RunManagerListener seems like a listener for run configuration management events, not execution events.
Please try with subscribing to com.intellij.execution.ExecutionManager#EXECUTION_TOPIC.
Thanks for your help, now I can get running events.
There is another problem that I want to add an agent before running or debugging by adding -javaagent agent.jar. What should I do to get the command when the service starts and add it.
When i use com.intellij.execution.process.BaseProcessHandler#getCommandLine got the java command.
How do I modify it now to achieve the purpose of adding the agent parameter.
Please try with "com.intellij.runConfigurationExtension" extension point:
https://upsource.jetbrains.com/idea-ce/file/idea-ce-6a856f22b82f6478cd6fbdc0f281c28d5c75b712/java/execution/impl/src/com/intellij/execution/RunConfigurationExtension.java
Sorry to bother you again. I have a little problem now.
Ff I have a lib directory in the root directory of the plugin with a jar file in it, I want to get the path of this jar in the -javaagent parameter, this path How should I get it.
The directory structure is as follows
Hi,
Please check PathManager.getPluginsPath() or PluginManagerCore.getPlugin(<your plugin ID>).getPath().
PS
Please keep posts focused on a single topic. It will be easier for other developers to find the answers they are looking for.