Action group, Icon doesn't show up for newUI
已回答
The icon appears when I use oldUI mode, but not when I use newUI.
MyIconMappings.json
{
"icons": {
"expui": {
"16x16": {
"logo_dark.svg": "icons/16x16/logo_dark.svg",
"logo_bright.svg": "icons/16x16/logo_bright.svg"
}
}
}
}
plugin.xml
<actions>
<group id="com.test.baseGroup"
class="com.test.MyBaseGroupAction"
icon="MyIcons.logoBright"
text="myGroup"
popup="true"
>
<action …../>
<action …../>
<add-to-group group-id="EditorPopupMenu3" anchor="last"/>
</group>
</actions>
<extensions defaultExtensionNs="com.intellij">
....
<iconMapper mappingFile="MyIconMappings.json"/>
</extensions>
MyBaseGroupAction.java
public class MyBaseGroupAction extends DefaultActionGroup {
@Override
public void update(@NotNull AnActionEvent e) {
this.refreshEnabledAndVisible(e);
}
private void refreshEnabledAndVisible(@NotNull AnActionEvent e) {
final boolean presentFunc = "true".equals(MyConfig.getProperty("m.enabled"));
e.getPresentation().setEnabledAndVisible(presentFunc);
}
}
MyIcons.java
public interface MyIcons {
/**
* Logo
*/
Icon logoBright = IconLoader.getIcon("icons/16x16/logo_bright.svg", MyIcons.class);
}
请先登录再写评论。
The picture I uploaded in the problem disappeared, I failed to upload the picture
Looks like this question is same as questions below, but still not resolve
https://intellij-support.jetbrains.com/hc/en-us/community/posts/10852639299090-Custom-icon-doesn-t-show-up-for-action-group-but-action
https://intellij-support.jetbrains.com/hc/en-us/community/posts/206769015-Icon-for-groups-in-plugin-xml
Please share your sources allowing to reproduce it as there can be multiple reasons that are impossible to catch with the provided information.
I push the demoProject to the git, and the icon appears on Windows platform, but not on MacBookPro.
https://github.com/BellerSun/jetbrains-plugin-demo
Does it appear only on Windows in the New UI now? Or is it displayed in both classic and new UIs on Windows?
It sounds like a bug anyway, so I suggest reporting it on https://youtrack.jetbrains.com/issues/IDEA with tag newUI if it consistently doesn't work in the New UI.
thank for help Karol Lewandowski , i have reported a issue on ‘youtrack’, it is a bug, Nadia Tarashkevich has followed up。
https://youtrack.jetbrains.com/issue/IDEA-338959/Missing-action-group-icon