Search in sources :

Example 26 with LayeredIcon

use of com.intellij.ui.LayeredIcon in project intellij-plugins by JetBrains.

the class FlexIconProvider method getIcon.

@Override
public Icon getIcon(@NotNull PsiElement element, int flags) {
    int transformedFlags = ElementBase.transformFlags(element, flags);
    Icon icon = null;
    if (element instanceof XmlFile) {
        if (JavaScriptSupportLoader.isFlexMxmFile((PsiFile) element)) {
            final JSClass jsClass = XmlBackedJSClassFactory.getXmlBackedClass((XmlFile) element);
            if (jsClass != null) {
                icon = jsClass.getIcon(flags);
            }
        }
    } else if (element instanceof JSFileImpl) {
        final JSNamedElement mainDeclaredElement = ActionScriptResolveUtil.findMainDeclaredElement((JSFileImpl) element);
        if (mainDeclaredElement != null) {
            icon = mainDeclaredElement.getIcon(transformedFlags);
        }
    }
    if (icon != null) {
        final PsiFile psiFile = element.getContainingFile();
        final VirtualFile vFile = psiFile == null ? null : psiFile.getVirtualFile();
        CompilerManager compilerManager = CompilerManager.getInstance(element.getProject());
        if (vFile != null && compilerManager != null && compilerManager.isExcludedFromCompilation(vFile)) {
            icon = new LayeredIcon(icon, PlatformIcons.EXCLUDED_FROM_COMPILE_ICON);
        }
    }
    return icon;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) LayeredIcon(com.intellij.ui.LayeredIcon) XmlFile(com.intellij.psi.xml.XmlFile) CompilerManager(com.intellij.openapi.compiler.CompilerManager) JSNamedElement(com.intellij.lang.javascript.psi.JSNamedElement) PsiFile(com.intellij.psi.PsiFile) LayeredIcon(com.intellij.ui.LayeredIcon) JSClass(com.intellij.lang.javascript.psi.ecmal4.JSClass) JSFileImpl(com.intellij.lang.javascript.psi.impl.JSFileImpl)

Aggregations

LayeredIcon (com.intellij.ui.LayeredIcon)26 CompositeAppearance (com.intellij.openapi.roots.ui.util.CompositeAppearance)6 TextAttributes (com.intellij.openapi.editor.markup.TextAttributes)5 RowIcon (com.intellij.ui.RowIcon)5 NotNull (org.jetbrains.annotations.NotNull)5 EmptyIcon (com.intellij.util.ui.EmptyIcon)4 PsiClass (com.intellij.psi.PsiClass)3 ItemPresentation (com.intellij.navigation.ItemPresentation)2 PsiElement (com.intellij.psi.PsiElement)2 PsiFile (com.intellij.psi.PsiFile)2 DartClass (com.jetbrains.lang.dart.psi.DartClass)2 Nullable (org.jetbrains.annotations.Nullable)2 LookupElement (com.intellij.codeInsight.lookup.LookupElement)1 LookupElementBuilder (com.intellij.codeInsight.lookup.LookupElementBuilder)1 IconLayerProvider (com.intellij.ide.IconLayerProvider)1 UISettings (com.intellij.ide.ui.UISettings)1 AbstractTreeNode (com.intellij.ide.util.treeView.AbstractTreeNode)1 Language (com.intellij.lang.Language)1 StructureViewTestUtil.getIcon (com.intellij.lang.javascript.StructureViewTestUtil.getIcon)1 JSNamedElement (com.intellij.lang.javascript.psi.JSNamedElement)1