简体   繁体   English

如何在IntelliJ插件中添加事件侦听器?

[英]How do I add an event listener in an IntelliJ plugin?

I am making an IntelliJ plugin and would like to add a RefactoringEventListener to it. 我正在制作一个IntelliJ插件,并希望为它添加一个RefactoringEventListener I implemented the class, but the documentation is unclear on how I register it. 我实现了这个类,但文档不清楚如何注册它。 Do I have to add it somewhere in plugin.xml? 我是否必须在plugin.xml中的某处添加它?

RefactoringEventListener has REFACTORING_EVENT_TOPIC topic, which is the entry point for the listener. RefactoringEventListener具有REFACTORING_EVENT_TOPIC主题,该主题是侦听器的入口点。 You can use it like: 您可以像以下一样使用它:

project.getMessageBus().connect(Disposable)
    .subscribe(RefactoringEventListener.REFACTORING_EVENT_TOPIC, new MyListener())

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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