[英]Show or open my plugin in IntelliJ
I'm developing a plugin for IntelliJ and the default state of the plugin is hide (like the others plugins - Maven Projects, Ant Build etc...)我正在为 IntelliJ 开发一个插件,插件的默认状态是隐藏(就像其他插件一样 - Maven 项目、Ant Build 等......)
My plugin uses the package com.intellij.openapi.ui.popup.BalloonBuilder to show a balloon on part of classes with some logic.我的插件使用 com.intellij.openapi.ui.popup.BalloonBuilder 包在具有某些逻辑的部分类上显示气球。
Now I want to add the functionality to show or open the plugin:现在我想添加显示或打开插件的功能:
builder.setClickHandler(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// Show or open the plugin
}
}, true);
How I do it?我怎么做?
The solution is call to show method on ToolWindow object:解决方法是在 ToolWindow 对象上调用 show 方法:
ToolWindow toolWindow = toolWindowManager.registerToolWindow("MyPlugin", myPanel, ToolWindowAnchor.RIGHT);
builder.setClickHandler(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
toolWindow.show(new Runnable() {
@Override
public void run() {
System.out.print("Showing the plugin!");
}
});
}
}, true);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.