Search in sources :

Example 16 with RowIcon

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

the class GrLightMethodBuilder method getElementIcon.

@Override
public Icon getElementIcon(final int flags) {
    Icon methodIcon = myBaseIcon != null ? myBaseIcon : hasModifierProperty(PsiModifier.ABSTRACT) ? PlatformIcons.ABSTRACT_METHOD_ICON : PlatformIcons.METHOD_ICON;
    RowIcon baseIcon = ElementPresentationUtil.createLayeredIcon(methodIcon, this, false);
    return ElementPresentationUtil.addVisibilityIcon(this, flags, baseIcon);
}
Also used : RowIcon(com.intellij.ui.RowIcon) RowIcon(com.intellij.ui.RowIcon)

Example 17 with RowIcon

use of com.intellij.ui.RowIcon 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 18 with RowIcon

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

the class DartServerCompletionContributor method applyVisibility.

private static Icon applyVisibility(Icon base, boolean isPrivate) {
    RowIcon result = new RowIcon(2);
    result.setIcon(base, 0);
    Icon visibility = isPrivate ? PlatformIcons.PRIVATE_ICON : PlatformIcons.PUBLIC_ICON;
    result.setIcon(visibility, 1);
    return result;
}
Also used : RowIcon(com.intellij.ui.RowIcon) RowIcon(com.intellij.ui.RowIcon) LayeredIcon(com.intellij.ui.LayeredIcon)

Example 19 with RowIcon

use of com.intellij.ui.RowIcon 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)

Example 20 with RowIcon

use of com.intellij.ui.RowIcon in project go-lang-idea-plugin by go-lang-plugin-org.

the class GoNamedElementImpl method getIcon.

@Nullable
@Override
public Icon getIcon(int flags) {
    Icon icon = null;
    if (this instanceof GoMethodDeclaration)
        icon = GoIcons.METHOD;
    else if (this instanceof GoFunctionDeclaration)
        icon = GoIcons.FUNCTION;
    else if (this instanceof GoTypeSpec)
        icon = GoIcons.TYPE;
    else if (this instanceof GoVarDefinition)
        icon = GoIcons.VARIABLE;
    else if (this instanceof GoConstDefinition)
        icon = GoIcons.CONSTANT;
    else if (this instanceof GoFieldDefinition)
        icon = GoIcons.FIELD;
    else if (this instanceof GoMethodSpec)
        icon = GoIcons.METHOD;
    else if (this instanceof GoAnonymousFieldDefinition)
        icon = GoIcons.FIELD;
    else if (this instanceof GoParamDefinition)
        icon = GoIcons.PARAMETER;
    else if (this instanceof GoLabelDefinition)
        icon = GoIcons.LABEL;
    if (icon != null) {
        if ((flags & Iconable.ICON_FLAG_VISIBILITY) != 0) {
            RowIcon rowIcon = ElementBase.createLayeredIcon(this, icon, flags);
            rowIcon.setIcon(isPublic() ? PlatformIcons.PUBLIC_ICON : PlatformIcons.PRIVATE_ICON, 1);
            return rowIcon;
        }
        return icon;
    }
    return super.getIcon(flags);
}
Also used : RowIcon(com.intellij.ui.RowIcon) RowIcon(com.intellij.ui.RowIcon) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

RowIcon (com.intellij.ui.RowIcon)34 Nullable (org.jetbrains.annotations.Nullable)10 LayeredIcon (com.intellij.ui.LayeredIcon)7 NotNull (org.jetbrains.annotations.NotNull)7 EmptyIcon (com.intellij.util.ui.EmptyIcon)4 ItemPresentation (com.intellij.navigation.ItemPresentation)2 CompositeAppearance (com.intellij.openapi.roots.ui.util.CompositeAppearance)2 PsiFile (com.intellij.psi.PsiFile)2 LookupElementBuilder (com.intellij.codeInsight.lookup.LookupElementBuilder)1 IconLayerProvider (com.intellij.ide.IconLayerProvider)1 Bookmark (com.intellij.ide.bookmarks.Bookmark)1 AbstractTreeNode (com.intellij.ide.util.treeView.AbstractTreeNode)1 StructureViewTestUtil.getIcon (com.intellij.lang.javascript.StructureViewTestUtil.getIcon)1 FlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration)1 FlexBuildConfigurationManager (com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfigurationManager)1 SimpleDataContext (com.intellij.openapi.actionSystem.impl.SimpleDataContext)1 TextAttributes (com.intellij.openapi.editor.markup.TextAttributes)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 PsiElement (com.intellij.psi.PsiElement)1 CandidateInfo (com.intellij.psi.infos.CandidateInfo)1