Search in sources :

Example 11 with LayeredIcon

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

the class FileTypeRenderer method customize.

@Override
public void customize(JList list, FileType type, int index, boolean selected, boolean hasFocus) {
    LayeredIcon layeredIcon = new LayeredIcon(2);
    layeredIcon.setIcon(EMPTY_ICON, 0);
    final Icon icon = type.getIcon();
    if (icon != null) {
        layeredIcon.setIcon(icon, 1, (-icon.getIconWidth() + EMPTY_ICON.getIconWidth()) / 2, (EMPTY_ICON.getIconHeight() - icon.getIconHeight()) / 2);
    }
    setIcon(layeredIcon);
    String description = type.getDescription();
    String trimmedDescription = StringUtil.capitalizeWords(description.replaceAll("(?i)\\s*file(?:s)?$", ""), true);
    if (isDuplicated(description)) {
        setText(trimmedDescription + " (" + type.getName() + ")");
    } else {
        setText(trimmedDescription);
    }
}
Also used : LayeredIcon(com.intellij.ui.LayeredIcon) EmptyIcon(com.intellij.util.ui.EmptyIcon) LayeredIcon(com.intellij.ui.LayeredIcon)

Example 12 with LayeredIcon

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

the class TestIconProvider method getIcon.

@Override
public Icon getIcon(@NotNull PsiElement element, int flags) {
    final TestFramework[] testFrameworks = Extensions.getExtensions(TestFramework.EXTENSION_NAME);
    for (TestFramework framework : testFrameworks) {
        try {
            if (framework.isIgnoredMethod(element)) {
                final Icon ignoredTestIcon = AllIcons.RunConfigurations.IgnoredTest;
                final LayeredIcon icon = new LayeredIcon(ignoredTestIcon, PlatformIcons.PUBLIC_ICON);
                icon.setIcon(PlatformIcons.PUBLIC_ICON, 1, ignoredTestIcon.getIconWidth(), 0);
                return icon;
            }
        } catch (AbstractMethodError ignored) {
        }
    }
    for (TestFramework framework : testFrameworks) {
        try {
            if (framework.isTestMethod(element)) {
                final LayeredIcon mark = new LayeredIcon(PlatformIcons.METHOD_ICON, AllIcons.RunConfigurations.TestMark, PlatformIcons.PUBLIC_ICON);
                mark.setIcon(PlatformIcons.PUBLIC_ICON, 2, PlatformIcons.METHOD_ICON.getIconWidth(), 0);
                return mark;
            }
        } catch (AbstractMethodError ignore) {
        }
    }
    return null;
}
Also used : LayeredIcon(com.intellij.ui.LayeredIcon) TestFramework(com.intellij.testIntegration.TestFramework) LayeredIcon(com.intellij.ui.LayeredIcon)

Example 13 with LayeredIcon

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

the class XBreakpointBase method setIcon.

protected void setIcon(Icon icon) {
    if (!XDebuggerUtilImpl.isEmptyExpression(getConditionExpression())) {
        LayeredIcon newIcon = new LayeredIcon(2);
        newIcon.setIcon(icon, 0);
        newIcon.setIcon(AllIcons.Debugger.Question_badge, 1, 10, 6);
        myIcon = JBUI.scale(newIcon);
    } else {
        myIcon = icon;
    }
}
Also used : LayeredIcon(com.intellij.ui.LayeredIcon)

Example 14 with LayeredIcon

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

the class FlexStructureViewTest method testBug3.

public void testBug3() throws Exception {
    configureByFiles(null, BASE_PATH + "22.js2", BASE_PATH + "22_2.js2");
    final Object[] items = getTopLevelItems();
    assertEquals(2, items.length);
    assertEquals("XXX", getText(items[0]));
    assertEquals("YYY", getText(items[1]));
    List<? extends AbstractTreeNode> treeNodes = getChildren(items[0]);
    assertEquals(3 + OBJECT_METHODS_COUNT, treeNodes.size());
    assertEquals("constructor():*", getText(treeNodes.get(0)));
    assertEquals("aaa", getText(treeNodes.get(OBJECT_METHODS_COUNT + 1)));
    assertEquals("bbb", getText(treeNodes.get(OBJECT_METHODS_COUNT + 2)));
    AbstractTreeNode node = treeNodes.get(OBJECT_METHODS_COUNT - 5);
    assertEquals("staticFun()", getText(node));
    Icon icon = getIcon(node);
    assertTrue(icon instanceof RowIcon);
    // static mark blended in
    assertTrue(((RowIcon) icon).getIcon(0) instanceof LayeredIcon);
    treeNodes = getChildren(items[1]);
    assertEquals(2 + OBJECT_METHODS_COUNT, treeNodes.size());
    assertEquals("aaa", getText(treeNodes.get(OBJECT_METHODS_COUNT)));
    assertEquals("bbb", getText(treeNodes.get(OBJECT_METHODS_COUNT + 1)));
}
Also used : LayeredIcon(com.intellij.ui.LayeredIcon) AbstractTreeNode(com.intellij.ide.util.treeView.AbstractTreeNode) RowIcon(com.intellij.ui.RowIcon) StructureViewTestUtil.getIcon(com.intellij.lang.javascript.StructureViewTestUtil.getIcon) LayeredIcon(com.intellij.ui.LayeredIcon) RowIcon(com.intellij.ui.RowIcon)

Example 15 with LayeredIcon

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

the class DartMethodHierarchyNodeDescriptor method update.

public final boolean update() {
    boolean changes = super.update();
    final CompositeAppearance oldText = myHighlightedText;
    myHighlightedText = new CompositeAppearance();
    DartClass dartClass = getType();
    if (dartClass == null) {
        if (!myHighlightedText.getText().startsWith(INVALID_PREFIX)) {
            myHighlightedText.getBeginning().addText(INVALID_PREFIX, HierarchyNodeDescriptor.getInvalidPrefixAttributes());
        }
        return true;
    }
    final ItemPresentation presentation = dartClass.getPresentation();
    Icon baseIcon = null;
    Icon stateIcon = null;
    if (presentation != null) {
        myHighlightedText.getEnding().addText(presentation.getPresentableText());
        PsiFile file = dartClass.getContainingFile();
        if (file != null) {
            myHighlightedText.getEnding().addText(" (" + file.getName() + ")", HierarchyNodeDescriptor.getPackageNameAttributes());
        }
        baseIcon = presentation.getIcon(false);
        stateIcon = calculateStateIcon(dartClass);
    }
    if (changes || baseIcon != myRawIcon || stateIcon != myStateIcon) {
        changes = true;
        Icon newIcon = myRawIcon = baseIcon;
        myStateIcon = stateIcon;
        if (myIsBase) {
            final LayeredIcon icon = new LayeredIcon(2);
            icon.setIcon(newIcon, 0);
            newIcon = icon;
            icon.setIcon(AllIcons.Hierarchy.Base, 1, -AllIcons.Hierarchy.Base.getIconWidth() / 2, 0);
        }
        if (myStateIcon != null) {
            newIcon = new RowIcon(myStateIcon, newIcon);
        }
        setIcon(newIcon);
    }
    myName = myHighlightedText.getText();
    if (!Comparing.equal(myHighlightedText, oldText)) {
        changes = true;
    }
    return changes;
}
Also used : LayeredIcon(com.intellij.ui.LayeredIcon) DartClass(com.jetbrains.lang.dart.psi.DartClass) ItemPresentation(com.intellij.navigation.ItemPresentation) CompositeAppearance(com.intellij.openapi.roots.ui.util.CompositeAppearance) PsiFile(com.intellij.psi.PsiFile) RowIcon(com.intellij.ui.RowIcon) LayeredIcon(com.intellij.ui.LayeredIcon) RowIcon(com.intellij.ui.RowIcon)

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