Search in sources :

Example 1 with RowIcon

use of com.intellij.ui.RowIcon in project intellij-elixir by KronicDeth.

the class CallDefinitionHead method getIcon.

/*
     * Instance Methods
     */
/**
     * Returns the icon representing the object.
     *
     * @param unused Used to mean if open/close icons for tree renderer. No longer in use. The parameter is only there for API compatibility reason.
     */
@Nullable
@Override
public Icon getIcon(boolean unused) {
    Icon[] icons = new Icon[] { ElixirIcons.Time.from(callDefinition.time()), ElixirIcons.Visibility.from(visibility), ElixirIcons.CALL_DEFINITION_CLAUSE };
    RowIcon rowIcon = new RowIcon(icons.length);
    for (int layer = 0; layer < icons.length; layer++) {
        rowIcon.setIcon(icons[layer], layer);
    }
    return rowIcon;
}
Also used : RowIcon(com.intellij.ui.RowIcon) RowIcon(com.intellij.ui.RowIcon) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with RowIcon

use of com.intellij.ui.RowIcon in project intellij-elixir by KronicDeth.

the class CallDefinitionSpecification method getIcon.

/**
     * Returns the icon representing the object.
     *
     * @param unused Used to mean if open/close icons for tree renderer. No longer in use. The parameter is only there for API compatibility reason.
     */
@Nullable
@Override
public Icon getIcon(boolean unused) {
    int layers = 3;
    if (callback) {
        layers++;
    }
    RowIcon rowIcon = new RowIcon(layers);
    int layer = 0;
    if (callback) {
        rowIcon.setIcon(ElixirIcons.CALLBACK, layer++);
    }
    Icon timeIcon = ElixirIcons.Time.from(time);
    rowIcon.setIcon(timeIcon, layer++);
    rowIcon.setIcon(ElixirIcons.Visibility.PUBLIC, layer++);
    rowIcon.setIcon(ElixirIcons.SPECIFICATION, layer);
    return rowIcon;
}
Also used : RowIcon(com.intellij.ui.RowIcon) RowIcon(com.intellij.ui.RowIcon) Nullable(org.jetbrains.annotations.Nullable)

Example 3 with RowIcon

use of com.intellij.ui.RowIcon in project intellij-elixir by KronicDeth.

the class FunctionDelegation method getIcon.

/**
     * Returns the icon representing the object.
     *
     * @param unused Used to mean if open/close icons for tree renderer. No longer in use. The parameter is only there for API compatibility reason.
     */
@Nullable
@Override
public Icon getIcon(boolean unused) {
    RowIcon rowIcon = new RowIcon(3);
    // same as {@code def}
    rowIcon.setIcon(ElixirIcons.Time.RUN, 0);
    rowIcon.setIcon(ElixirIcons.Visibility.PUBLIC, 1);
    rowIcon.setIcon(ElixirIcons.CALL_DEFINITION_CLAUSE, 2);
    return rowIcon;
}
Also used : RowIcon(com.intellij.ui.RowIcon) Nullable(org.jetbrains.annotations.Nullable)

Example 4 with RowIcon

use of com.intellij.ui.RowIcon in project intellij-elixir by KronicDeth.

the class Type method getIcon.

/*
     *
     * Instance Methods
     *
     */
/*
     * Public Instance Methods
     */
/**
     * Returns the icon representing the object.
     *
     * @param unused Used to mean if open/close icons for tree renderer. No longer in use. The parameter is only there for API compatibility reason.
     */
@NotNull
@Override
public Icon getIcon(boolean unused) {
    Icon[] icons = new Icon[] { ElixirIcons.Time.COMPILE, ElixirIcons.Visibility.from(visibility), ElixirIcons.TYPE };
    RowIcon rowIcon = new RowIcon(icons.length);
    for (int layer = 0; layer < icons.length; layer++) {
        rowIcon.setIcon(icons[layer], layer);
    }
    return rowIcon;
}
Also used : RowIcon(com.intellij.ui.RowIcon) RowIcon(com.intellij.ui.RowIcon) NotNull(org.jetbrains.annotations.NotNull)

Example 5 with RowIcon

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

the class GrMethodOverrideCompletionProvider method addSuperMethods.

private static void addSuperMethods(final GrTypeDefinition psiClass, CompletionResultSet completionResultSet, boolean toImplement) {
    final Collection<CandidateInfo> candidates = GroovyOverrideImplementExploreUtil.getMethodsToOverrideImplement(psiClass, toImplement);
    for (CandidateInfo candidateInfo : candidates) {
        final PsiMethod method = (PsiMethod) candidateInfo.getElement();
        if (method.isConstructor())
            continue;
        RowIcon icon = new RowIcon(2);
        icon.setIcon(method.getIcon(0), 0);
        icon.setIcon(toImplement ? AllIcons.Gutter.ImplementingMethod : AllIcons.Gutter.OverridingMethod, 1);
        PsiSubstitutor substitutor = candidateInfo.getSubstitutor();
        String parameters = PsiFormatUtil.formatMethod(method, substitutor, PsiFormatUtilBase.SHOW_PARAMETERS, PsiFormatUtilBase.SHOW_NAME);
        String visibility = VisibilityUtil.getVisibilityModifier(method.getModifierList());
        String modifiers = (visibility == PsiModifier.PACKAGE_LOCAL ? "" : visibility + " ");
        PsiType type = substitutor.substitute(method.getReturnType());
        String parentClassName = psiClass == null ? "" : psiClass.getName();
        String signature = modifiers + (type == null ? "" : type.getPresentableText() + " ") + method.getName();
        LookupElementBuilder lookupElement = LookupElementBuilder.create(method, signature).appendTailText(parameters, false).appendTailText("{...}", true).withTypeText(parentClassName).withIcon(icon).withInsertHandler(new GroovyMethodOverrideHandler(psiClass));
        completionResultSet.addElement(lookupElement);
    }
}
Also used : CandidateInfo(com.intellij.psi.infos.CandidateInfo) LookupElementBuilder(com.intellij.codeInsight.lookup.LookupElementBuilder) RowIcon(com.intellij.ui.RowIcon) GroovyMethodOverrideHandler(org.jetbrains.plugins.groovy.lang.completion.handlers.GroovyMethodOverrideHandler)

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