从代码中更改插件操作图标

时间:2016-05-14 17:17:41

标签: android android-studio plugins intellij-idea

我正在为Android Studio(Intellij Idea)开发一个插件。我想在执行某个动作时更改图标。

但它没有改变图标。

这是代码 -

public void actionPerformed(AnActionEvent event) {

        Project project = event.getData(PlatformDataKeys.PROJECT);

        ActionManager actionManager = event.getActionManager();
        AnAction anAction = actionManager.getAction("York.toggle");
        Presentation presentation = anAction.getTemplatePresentation();
        presentation.setIcon(IconLoader.getIcon("/icons/ic_fav_search_24dp.png"));


        /*String adbPath = getAdpPathOnMachine(project);
        BroadcastHelper.main(new String[]{adbPath});*/
    }

1 个答案:

答案 0 :(得分:2)

使用com.intellij.openapi.actionSystem.AnActionEvent#getPresentation