Search in sources :

Example 1 with HighlightUsagesDescriptionLocation

use of com.intellij.codeInsight.highlighting.HighlightUsagesDescriptionLocation in project intellij-plugins by JetBrains.

the class DartElementDescriptionProvider method getElementDescription.

@Nullable
@Override
public String getElementDescription(@NotNull final PsiElement element, @NotNull final ElementDescriptionLocation location) {
    if (!(location instanceof HighlightUsagesDescriptionLocation))
        return null;
    if (element instanceof DartLibraryNameElement)
        return "library " + ((DartLibraryNameElement) element).getName();
    if (element instanceof DartNamedElement) {
        final String name = ((DartNamedElement) element).getName();
        final DartComponentType type = DartComponentType.typeOf(element);
        if (type != null) {
            final String typeText = type.toString().toLowerCase(Locale.US);
            return name != null ? typeText + " " + name : typeText;
        }
    }
    return null;
}
Also used : DartComponentType(com.jetbrains.lang.dart.DartComponentType) HighlightUsagesDescriptionLocation(com.intellij.codeInsight.highlighting.HighlightUsagesDescriptionLocation) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

HighlightUsagesDescriptionLocation (com.intellij.codeInsight.highlighting.HighlightUsagesDescriptionLocation)1 DartComponentType (com.jetbrains.lang.dart.DartComponentType)1 Nullable (org.jetbrains.annotations.Nullable)1