Java Code Examples for com.intellij.codeInsight.navigation.NavigationGutterIconBuilder#setTooltipText()

The following examples show how to use com.intellij.codeInsight.navigation.NavigationGutterIconBuilder#setTooltipText() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RelatedPopupGotoLineMarker.java    From idea-php-shopware-plugin with MIT License 6 votes vote down vote up
public static RelatedItemLineMarkerInfo<PsiElement> getSingleLineMarker(SmartyFile smartyFile, Collection<LineMarkerInfo> lineMarkerInfos, GotoRelatedItem gotoRelatedItem) {

        // hell: find any possible small icon
        Icon icon = null;
        if(gotoRelatedItem instanceof RelatedPopupGotoLineMarker.PopupGotoRelatedItem) {
            icon = ((RelatedPopupGotoLineMarker.PopupGotoRelatedItem) gotoRelatedItem).getSmallIcon();
        }

        if(icon == null) {
            icon = ShopwarePluginIcons.SHOPWARE_LINEMARKER;
        }

        NavigationGutterIconBuilder<PsiElement> builder = NavigationGutterIconBuilder.create(icon).
            setTargets(gotoRelatedItem.getElement());

        String customName = gotoRelatedItem.getCustomName();
        if(customName != null) {
            builder.setTooltipText(customName);
        }

        return builder.createLineMarkerInfo(smartyFile);
    }
 
Example 2
Source File: ControllerMethodLineMarkerProvider.java    From idea-php-symfony2-plugin with MIT License 4 votes vote down vote up
@Nullable
public LineMarkerInfo collect(PsiElement psiElement) {
    if(!Symfony2ProjectComponent.isEnabled(psiElement) || psiElement.getNode().getElementType() != PhpTokenTypes.IDENTIFIER) {
        return null;
    }

    PsiElement method = psiElement.getParent();
    if(!(method instanceof Method) || !((Method) method).getAccess().isPublic()) {
        return null;
    }

    List<GotoRelatedItem> gotoRelatedItems = getGotoRelatedItems((Method) method);

    if(gotoRelatedItems.size() == 0) {
        return null;
    }

    // only one item dont need popover
    if(gotoRelatedItems.size() == 1) {

        GotoRelatedItem gotoRelatedItem = gotoRelatedItems.get(0);

        // hell: find any possible small icon
        Icon icon = null;
        if(gotoRelatedItem instanceof RelatedPopupGotoLineMarker.PopupGotoRelatedItem) {
            icon = ((RelatedPopupGotoLineMarker.PopupGotoRelatedItem) gotoRelatedItem).getSmallIcon();
        }

        if(icon == null) {
           icon = Symfony2Icons.SYMFONY_LINE_MARKER;
        }

        NavigationGutterIconBuilder<PsiElement> builder = NavigationGutterIconBuilder.create(icon).
            setTargets(gotoRelatedItems.get(0).getElement());

        String customName = gotoRelatedItems.get(0).getCustomName();
        if(customName != null) {
            builder.setTooltipText(customName);
        }

        return builder.createLineMarkerInfo(psiElement);
    }

    return new LineMarkerInfo<>(
        psiElement,
        psiElement.getTextRange(),
        Symfony2Icons.SYMFONY_LINE_MARKER,
        6,
        new ConstantFunction<>("Related Files"),
        new RelatedPopupGotoLineMarker.NavigationHandler(gotoRelatedItems),
        GutterIconRenderer.Alignment.RIGHT
    );
}