From: Konstantin Bulenkov Date: Thu, 11 Mar 2010 02:59:56 +0000 (+0300) Subject: custom icons for intention actions X-Git-Tag: 94.527 X-Git-Url: https://git.jetbrains.org/?p=idea%2Fcommunity.git;a=commitdiff_plain;h=3e378f5d60d49ff5d31e45ed486328f683871c5c custom icons for intention actions --- diff --git a/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/IntentionListStep.java b/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/IntentionListStep.java index 67ec6f21d985..ed8375b957a4 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/IntentionListStep.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/IntentionListStep.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2010 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +22,7 @@ import com.intellij.codeInsight.hint.HintManager; import com.intellij.codeInsight.intention.EmptyIntentionAction; import com.intellij.codeInsight.intention.IntentionAction; import com.intellij.codeInsight.intention.PreferredAction; +import com.intellij.codeInsight.intention.impl.config.IntentionActionWrapper; import com.intellij.codeInsight.intention.impl.config.IntentionManagerSettings; import com.intellij.codeInspection.ex.QuickFixWrapper; import com.intellij.openapi.application.ApplicationManager; @@ -273,14 +274,18 @@ class IntentionListStep implements ListPopupStep final IntentionAction action = value.getAction(); + Object iconable = null; //custom icon if (action instanceof QuickFixWrapper) { - final QuickFixWrapper quickFix = (QuickFixWrapper)action; - if (quickFix.getFix() instanceof Iconable) { - final Icon icon = ((Iconable)quickFix.getFix()).getIcon(0); - if (icon != null) { - return icon; - } + iconable = ((QuickFixWrapper)action).getFix(); + } else if (action instanceof IntentionActionWrapper) { + iconable = ((IntentionActionWrapper)action).getDelegate(); + } + + if (iconable instanceof Iconable) { + final Icon icon = ((Iconable)iconable).getIcon(0); + if (icon != null) { + return icon; } }