Sanjeet A
Sanjeet A

Reputation: 5227

Changing Plugin Action Icon from code

I am developing a plugin for Android Studio (Intellij Idea). I want to change the icon when an action is being performed.

But its not changing the icon.

Here is the code -

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});*/
    }

Upvotes: 4

Views: 347

Answers (1)

Meo
Meo

Reputation: 12501

Use com.intellij.openapi.actionSystem.AnActionEvent#getPresentation

Upvotes: 5

Related Questions