Java 类com.intellij.util.ConstantFunction 实例源码

项目:intellij-ce-playground    文件:DomFileDescription.java   
/**
 * Consider using {@link DomService#getXmlFileHeader(com.intellij.psi.xml.XmlFile)} when implementing this.
 */
@SuppressWarnings({"MethodMayBeStatic"})
@NotNull
public List<String> getAllowedNamespaces(@NotNull String namespaceKey, @NotNull XmlFile file) {
  final NotNullFunction<XmlTag, List<String>> function = myNamespacePolicies.get(namespaceKey);
  if (function instanceof ConstantFunction) {
    return function.fun(null);
  }

  if (function != null) {
    final XmlDocument document = file.getDocument();
    if (document != null) {
      final XmlTag tag = document.getRootTag();
      if (tag != null) {
        return function.fun(tag);
      }
    }
  } else {
    return Collections.singletonList(namespaceKey);
  }
  return Collections.emptyList();
}
项目:idea-php-laravel-plugin    文件:TemplateLineMarker.java   
@NotNull
private LineMarkerInfo getRelatedPopover(@NotNull String singleItemTitle, @NotNull String singleItemTooltipPrefix, @NotNull PsiElement lineMarkerTarget, @NotNull Collection<GotoRelatedItem> gotoRelatedItems, @NotNull Icon icon) {
    // single item has no popup
    String title = singleItemTitle;
    if(gotoRelatedItems.size() == 1) {
        String customName = gotoRelatedItems.iterator().next().getCustomName();
        if(customName != null) {
            title = String.format(singleItemTooltipPrefix, customName);
        }
    }

    return new LineMarkerInfo<>(
        lineMarkerTarget,
        lineMarkerTarget.getTextRange(),
        icon,
        6,
        new ConstantFunction<>(title),
        new RelatedPopupGotoLineMarker.NavigationHandler(gotoRelatedItems),
        GutterIconRenderer.Alignment.RIGHT
    );
}
项目:idea-php-shopware-plugin    文件:SmartyTemplateLineMarkerProvider.java   
private LineMarkerInfo getRelatedPopover(String singleItemTitle, String singleItemTooltipPrefix, PsiElement lineMarkerTarget, List<GotoRelatedItem> gotoRelatedItems) {

        // single item has no popup
        String title = singleItemTitle;
        if(gotoRelatedItems.size() == 1) {
            String customName = gotoRelatedItems.get(0).getCustomName();
            if(customName != null) {
                title = String.format(singleItemTooltipPrefix, customName);
            }
        }

        return new LineMarkerInfo<>(
            lineMarkerTarget,
            lineMarkerTarget.getTextRange(),
            ShopwarePluginIcons.SHOPWARE_LINEMARKER,
            6,
            new ConstantFunction<>(title),
            new fr.adrienbrault.idea.symfony2plugin.dic.RelatedPopupGotoLineMarker.NavigationHandler(gotoRelatedItems),
            GutterIconRenderer.Alignment.RIGHT
        );
    }
项目:consulo-unity3d    文件:UnityEventCSharpMethodLineMarkerProvider.java   
@Nullable
@RequiredReadAction
private static LineMarkerInfo createMarker(final PsiElement element)
{
    CSharpMethodDeclaration methodDeclaration = CSharpLineMarkerUtil.getNameIdentifierAs(element, CSharpMethodDeclaration.class);
    if(methodDeclaration != null)
    {
        Unity3dModuleExtension extension = ModuleUtilCore.getExtension(element, Unity3dModuleExtension.class);
        if(extension == null)
        {
            return null;
        }

        UnityFunctionManager.FunctionInfo magicMethod = findMagicMethod(methodDeclaration);
        if(magicMethod != null)
        {
            return new LineMarkerInfo<>(element, element.getTextRange(), Unity3dIcons.EventMethod, Pass.LINE_MARKERS, new ConstantFunction<>(magicMethod.getDescription()), null,
                    GutterIconRenderer.Alignment.LEFT);
        }
    }

    return null;
}
项目:tools-idea    文件:NavigationGutterIconBuilder.java   
public RelatedItemLineMarkerInfo<PsiElement> createLineMarkerInfo(@NotNull PsiElement element) {
  final MyNavigationGutterIconRenderer renderer = createGutterIconRenderer(element.getProject());
  final String tooltip = renderer.getTooltipText();
  NotNullLazyValue<Collection<? extends GotoRelatedItem>> gotoTargets = new NotNullLazyValue<Collection<? extends GotoRelatedItem>>() {
    @NotNull
    @Override
    protected Collection<? extends GotoRelatedItem> compute() {
      if (myGotoRelatedItemProvider != null) {
        return ContainerUtil.concat(myTargets.getValue(), myGotoRelatedItemProvider);
      }
      return Collections.emptyList();
    }
  };
  return new RelatedItemLineMarkerInfo<PsiElement>(element, element.getTextRange(), renderer.getIcon(), Pass.UPDATE_OVERRIDEN_MARKERS,
                                                   tooltip == null ? null : new ConstantFunction<PsiElement, String>(tooltip),
                                                   renderer.isNavigateAction() ? renderer : null, renderer.getAlignment(),
                                                   gotoTargets);
}
项目:tools-idea    文件:DomFileDescription.java   
/**
 * Consider using {@link DomService#getXmlFileHeader(com.intellij.psi.xml.XmlFile)} when implementing this.
 */
@SuppressWarnings({"MethodMayBeStatic"})
@NotNull
public List<String> getAllowedNamespaces(@NotNull String namespaceKey, @NotNull XmlFile file) {
  final NotNullFunction<XmlTag, List<String>> function = myNamespacePolicies.get(namespaceKey);
  if (function instanceof ConstantFunction) {
    return function.fun(null);
  }

  if (function != null) {
    final XmlDocument document = file.getDocument();
    if (document != null) {
      final XmlTag tag = document.getRootTag();
      if (tag != null) {
        return function.fun(tag);
      }
    }
  } else {
    return Collections.singletonList(namespaceKey);
  }
  return Collections.emptyList();
}
项目:idea-php-symfony2-plugin    文件:TwigLineMarkerProvider.java   
private LineMarkerInfo getRelatedPopover(String singleItemTitle, String singleItemTooltipPrefix, PsiElement lineMarkerTarget, List<GotoRelatedItem> gotoRelatedItems, Icon icon) {

        // single item has no popup
        String title = singleItemTitle;
        if(gotoRelatedItems.size() == 1) {
            String customName = gotoRelatedItems.get(0).getCustomName();
            if(customName != null) {
                title = String.format(singleItemTooltipPrefix, customName);
            }
        }

        return new LineMarkerInfo<>(
            lineMarkerTarget,
            lineMarkerTarget.getTextRange(),
            icon,
            6,
            new ConstantFunction<>(title),
            new RelatedPopupGotoLineMarker.NavigationHandler(gotoRelatedItems),
            GutterIconRenderer.Alignment.RIGHT
        );
    }
项目:consulo    文件:NavigationGutterIconBuilder.java   
public RelatedItemLineMarkerInfo<PsiElement> createLineMarkerInfo(@Nonnull PsiElement element) {
  final MyNavigationGutterIconRenderer renderer = createGutterIconRenderer(element.getProject());
  final String tooltip = renderer.getTooltipText();
  NotNullLazyValue<Collection<? extends GotoRelatedItem>> gotoTargets = new NotNullLazyValue<Collection<? extends GotoRelatedItem>>() {
    @Nonnull
    @Override
    protected Collection<? extends GotoRelatedItem> compute() {
      if (myGotoRelatedItemProvider != null) {
        return ContainerUtil.concat(myTargets.getValue(), myGotoRelatedItemProvider);
      }
      return Collections.emptyList();
    }
  };
  return new RelatedItemLineMarkerInfo<PsiElement>(element, element.getTextRange(), renderer.getIcon(), Pass.LINE_MARKERS,
                                                   tooltip == null ? null : new ConstantFunction<PsiElement, String>(tooltip),
                                                   renderer.isNavigateAction() ? renderer : null, renderer.getAlignment(),
                                                   gotoTargets);
}
项目:idea-php-behat-plugin    文件:TestRunLineMarkerProvider.java   
@NotNull
private LineMarkerInfo<PsiElement> createLineMakerInfo(@NotNull PsiElement psiElement, @NotNull Icon icon) {
    return new LineMarkerInfo<>(
        psiElement,
        psiElement.getTextRange(),
        icon,
        6,
        new ConstantFunction<>("Run Test"),
        new MyProgramRunnerGutterIconNavigationHandler(),
        GutterIconRenderer.Alignment.LEFT
    );
}
项目:intellij-ce-playground    文件:ExpectedHighlightingData.java   
private void extractExpectedLineMarkerSet(Document document) {
  String text = document.getText();

  @NonNls String pat = ".*?((<" + LINE_MARKER + ")(?: descr=\"((?:[^\"\\\\]|\\\\\")*)\")?>)(.*)";
  final Pattern p = Pattern.compile(pat, Pattern.DOTALL);
  final Pattern pat2 = Pattern.compile("(.*?)(</" + LINE_MARKER + ">)(.*)", Pattern.DOTALL);

  while (true) {
    Matcher m = p.matcher(text);
    if (!m.matches()) break;
    int startOffset = m.start(1);
    final String descr = m.group(3) != null ? m.group(3) : ANY_TEXT;
    String rest = m.group(4);

    document.replaceString(startOffset, m.end(1), "");

    final Matcher matcher2 = pat2.matcher(rest);
    LOG.assertTrue(matcher2.matches(), "Cannot find closing </" + LINE_MARKER + ">");
    String content = matcher2.group(1);
    int endOffset = startOffset + matcher2.start(3);
    String endTag = matcher2.group(2);

    document.replaceString(startOffset, endOffset, content);
    endOffset -= endTag.length();

    LineMarkerInfo markerInfo = new LineMarkerInfo<PsiElement>(myFile, new TextRange(startOffset, endOffset), null, Pass.LINE_MARKERS,
                                                               new ConstantFunction<PsiElement, String>(descr), null,
                                                               GutterIconRenderer.Alignment.RIGHT);

    lineMarkerInfos.put(document.createRangeMarker(startOffset, endOffset), markerInfo);
    text = document.getText();
  }
}
项目:intellij-ce-playground    文件:NavigationGutterIconBuilder.java   
public RelatedItemLineMarkerInfo<PsiElement> createLineMarkerInfo(@NotNull PsiElement element) {
  final MyNavigationGutterIconRenderer renderer = createGutterIconRenderer(element.getProject());
  final String tooltip = renderer.getTooltipText();
  NotNullLazyValue<Collection<? extends GotoRelatedItem>> gotoTargets = createGotoTargetsThunk(myLazy, myGotoRelatedItemProvider,
                                                                                               evaluateAndForget(myTargets));
  return new RelatedItemLineMarkerInfo<PsiElement>(element, element.getTextRange(), renderer.getIcon(), Pass.UPDATE_OVERRIDEN_MARKERS,
                                                   tooltip == null ? null : new ConstantFunction<PsiElement, String>(tooltip),
                                                   renderer.isNavigateAction() ? renderer : null, renderer.getAlignment(),
                                                   gotoTargets);
}
项目:intellij-ce-playground    文件:AndroidLineMarkerProvider.java   
private static LineMarkerInfo doGetLineMarkerInfo(PsiElement element) {
  final MyMarkerInfo info = getMarkerInfo(element);

  if (info == null) {
    return null;
  }
  final PsiElement anchor = info.myElement;
  final String tooltip = info.myTooltip;

  return new LineMarkerInfo<PsiElement>(
    anchor, anchor.getTextOffset(), info.myIcon, Pass.UPDATE_OVERRIDEN_MARKERS,
    new ConstantFunction<PsiElement, String>(tooltip), new MyNavigationHandler(info));
}
项目:idea-php-oxid-plugin    文件:SmartyTemplateLineMarkerProvider.java   
private LineMarkerInfo getRelatedPopover(String singleItemTitle, String singleItemTooltipPrefix, PsiElement lineMarkerTarget, List<GotoRelatedItem> gotoRelatedItems) {

        // single item has no popup
        String title = singleItemTitle;
        if(gotoRelatedItems.size() == 1) {
            String customName = gotoRelatedItems.get(0).getCustomName();
            if(customName != null) {
                title = String.format(singleItemTooltipPrefix, customName);
            }
        }

        return new LineMarkerInfo<PsiElement>(lineMarkerTarget, lineMarkerTarget.getTextOffset(), OxidPluginIcons.OXID_LINEMARKER, 6, new ConstantFunction<PsiElement, String>(title), new fr.adrienbrault.idea.symfony2plugin.dic.RelatedPopupGotoLineMarker.NavigationHandler(gotoRelatedItems));
    }
项目:consulo-unity3d    文件:UnityScriptEventFunctionLineMarkerProvider.java   
@RequiredReadAction
@Nullable
@Override
public LineMarkerInfo getLineMarkerInfo(@NotNull PsiElement element)
{
    if(element.getNode().getElementType() == JSTokenTypes.IDENTIFIER && element.getParent() instanceof JSReferenceExpression && element.getParent().getParent() instanceof JSFunction)
    {
        UnityFunctionManager functionManager = UnityFunctionManager.getInstance();
        Map<String, UnityFunctionManager.FunctionInfo> map = functionManager.getFunctionsByType().get(Unity3dTypes.UnityEngine.MonoBehaviour);
        if(map == null)
        {
            return null;
        }
        UnityFunctionManager.FunctionInfo functionInfo = map.get(element.getText());
        if(functionInfo == null)
        {
            return null;
        }
        Unity3dModuleExtension extension = ModuleUtilCore.getExtension(element, Unity3dModuleExtension.class);
        if(extension == null)
        {
            return null;
        }
        JSFunction jsFunction = (JSFunction) element.getParent().getParent();
        if(jsFunction.getParent() instanceof JSFile)
        {
            if(!isEqualParameters(functionInfo.getParameters(), jsFunction))
            {
                return null;
            }

            return new LineMarkerInfo<>(element, element.getTextRange(), Unity3dIcons.EventMethod, Pass.LINE_MARKERS, new ConstantFunction<>(functionInfo.getDescription()), null,
                    GutterIconRenderer.Alignment.LEFT);
        }
    }
    return null;
}
项目:idea-android-studio-plugin    文件:FragmentRelatedFileLineMarker.java   
@Override
public void collectSlowLineMarkers(@NotNull List<PsiElement> elements, @NotNull Collection<LineMarkerInfo> result) {

    for(PsiElement psiElement : elements) {

        List<GotoRelatedItem> gotoRelatedItems = new ArrayList<GotoRelatedItem>();
        List<PsiFile> psiFiles = new ArrayList<PsiFile>();

        // android studio provide line marker with xml targets only on root classes not on class inside classes like fragments
        // we support all of them :)
        if(psiElement instanceof PsiIdentifier && psiElement.getParent() instanceof PsiClass && !(psiElement.getParent().getParent() instanceof PsiFile)) {

            // simple hack activity provide this on core
            if(isFragmentClass((PsiClass) psiElement.getParent())) {
                Collection<PsiMethodCallExpression> PsiMethodCallExpressions = PsiTreeUtil.collectElementsOfType(psiElement.getParent(), PsiMethodCallExpression.class);
                for(PsiMethodCallExpression methodCallExpression: PsiMethodCallExpressions) {
                    PsiMethod psiMethod = methodCallExpression.resolveMethod();
                    if(psiMethod != null && psiMethod.getName().equals("inflate")) {
                        PsiExpression[] expressions = methodCallExpression.getArgumentList().getExpressions();
                        if(expressions.length > 0 && expressions[0] instanceof PsiReferenceExpression) {
                            PsiFile xmlFile = AndroidUtils.findXmlResource((PsiReferenceExpression) expressions[0]);
                            if(xmlFile != null && !psiFiles.contains(xmlFile)) {
                                psiFiles.add(xmlFile);
                                gotoRelatedItems.add(new GotoRelatedItem(xmlFile));
                            }
                        }
                    }
                }
            }

        }

        if(gotoRelatedItems.size() > 0) {
            result.add(new LineMarkerInfo<PsiElement>(psiElement, psiElement.getTextOffset(), AndroidIcons.AndroidToolWindow, 6, new ConstantFunction<PsiElement, String>("Related Files"), new RelatedPopupGotoLineMarker.NavigationHandler(gotoRelatedItems)));
        }

    }

}
项目:tools-idea    文件:ExpectedHighlightingData.java   
private void extractExpectedLineMarkerSet(Document document) {
  String text = document.getText();

  @NonNls String pat = ".*?((<" + LINE_MARKER + ")(?: descr=\"((?:[^\"\\\\]|\\\\\")*)\")?>)(.*)";
  final Pattern p = Pattern.compile(pat, Pattern.DOTALL);
  final Pattern pat2 = Pattern.compile("(.*?)(</" + LINE_MARKER + ">)(.*)", Pattern.DOTALL);

  while (true) {
    Matcher m = p.matcher(text);
    if (!m.matches()) break;
    int startOffset = m.start(1);
    final String descr = m.group(3) != null ? m.group(3) : ANY_TEXT;
    String rest = m.group(4);

    document.replaceString(startOffset, m.end(1), "");

    final Matcher matcher2 = pat2.matcher(rest);
    LOG.assertTrue(matcher2.matches(), "Cannot find closing </" + LINE_MARKER + ">");
    String content = matcher2.group(1);
    int endOffset = startOffset + matcher2.start(3);
    String endTag = matcher2.group(2);

    document.replaceString(startOffset, endOffset, content);
    endOffset -= endTag.length();

    LineMarkerInfo markerInfo = new LineMarkerInfo<PsiElement>(myFile, new TextRange(startOffset, endOffset), null, Pass.LINE_MARKERS,
                                                               new ConstantFunction<PsiElement, String>(descr), null,
                                                               GutterIconRenderer.Alignment.RIGHT);

    lineMarkerInfos.put(document.createRangeMarker(startOffset, endOffset), markerInfo);
    text = document.getText();
  }
}
项目:consulo-play    文件:PlayBaseTemplateLineMarkerProvider.java   
@Nullable
@Override
public LineMarkerInfo getLineMarkerInfo(@NotNull PsiElement psiElement)
{
    PlayBaseTemplateFile templateFile = findTemplateFile(psiElement);
    if(templateFile != null)
    {

        return new LineMarkerInfo<>(psiElement, psiElement.getTextRange(), PlayJavaIcons.PlayLineMarker, Pass.LINE_MARKERS,
                new ConstantFunction<>("Navigate to template"), GUTTER_ICON_NAVIGATION_HANDLER, GutterIconRenderer.Alignment.LEFT);
    }
    return null;
}
项目:consulo    文件:ExpectedHighlightingData.java   
private void extractExpectedLineMarkerSet(Document document) {
  String text = document.getText();

  @NonNls String pat = ".*?((<" + LINE_MARKER + ")(?: descr=\"((?:[^\"\\\\]|\\\\\")*)\")?>)(.*)";
  final Pattern p = Pattern.compile(pat, Pattern.DOTALL);
  final Pattern pat2 = Pattern.compile("(.*?)(</" + LINE_MARKER + ">)(.*)", Pattern.DOTALL);

  while (true) {
    Matcher m = p.matcher(text);
    if (!m.matches()) break;
    int startOffset = m.start(1);
    final String descr = m.group(3) != null ? m.group(3) : ANY_TEXT;
    String rest = m.group(4);

    document.replaceString(startOffset, m.end(1), "");

    final Matcher matcher2 = pat2.matcher(rest);
    LOG.assertTrue(matcher2.matches(), "Cannot find closing </" + LINE_MARKER + ">");
    String content = matcher2.group(1);
    int endOffset = startOffset + matcher2.start(3);
    String endTag = matcher2.group(2);

    document.replaceString(startOffset, endOffset, content);
    endOffset -= endTag.length();

    LineMarkerInfo markerInfo = new LineMarkerInfo<PsiElement>(myFile, new TextRange(startOffset, endOffset), null, Pass.LINE_MARKERS,
                                                               new ConstantFunction<PsiElement, String>(descr), null,
                                                               GutterIconRenderer.Alignment.RIGHT);

    lineMarkerInfos.put(document.createRangeMarker(startOffset, endOffset), markerInfo);
    text = document.getText();
  }
}
项目:consulo-xml    文件:DomFileDescription.java   
/**
 * Consider using {@link DomService#getXmlFileHeader(com.intellij.psi.xml.XmlFile)} when implementing this.
 */
@SuppressWarnings({"MethodMayBeStatic"})
@NotNull
public List<String> getAllowedNamespaces(@NotNull String namespaceKey, @NotNull XmlFile file)
{
    final NotNullFunction<XmlTag, List<String>> function = myNamespacePolicies.get(namespaceKey);
    if(function instanceof ConstantFunction)
    {
        return function.fun(null);
    }

    if(function != null)
    {
        final XmlDocument document = file.getDocument();
        if(document != null)
        {
            final XmlTag tag = document.getRootTag();
            if(tag != null)
            {
                return function.fun(tag);
            }
        }
    }
    else
    {
        return Collections.singletonList(namespaceKey);
    }
    return Collections.emptyList();
}
项目:intellij-ce-playground    文件:SvnChangeList.java   
private SvnRepositoryContentRevision createRevision(final String path, final boolean isBeforeRevision, final boolean isDir) {
  return SvnRepositoryContentRevision.create(myVcs, myRepositoryRoot, path,
                                             getLocalPath(path, new ConstantFunction<File, Boolean>(isDir)), getRevision(isBeforeRevision));
}
项目:tools-idea    文件:SvnChangeList.java   
private SvnRepositoryContentRevision createRevision(final String path, final boolean isBeforeRevision, final boolean isDir) {
  return SvnRepositoryContentRevision.create(myVcs, myRepositoryRoot, path,
                                             getLocalPath(path, new ConstantFunction<File, Boolean>(isDir)), getRevision(isBeforeRevision));
}
项目:consulo-csharp    文件:LambdaLineMarkerCollector.java   
@NotNull
@Override
public Function<? super PsiElement, String> getCommonTooltip(@NotNull List<MergeableLineMarkerInfo> infos)
{
    return new ConstantFunction<PsiElement, String>("Navigate to lambda delegate");
}
项目:consulo-csharp    文件:LambdaLineMarkerCollector.java   
@RequiredReadAction
@Override
public void collect(PsiElement psiElement, @NotNull Consumer<LineMarkerInfo> lineMarkerInfos)
{
    IElementType elementType = PsiUtilCore.getElementType(psiElement);
    if(elementType == CSharpTokens.DARROW)
    {
        PsiElement parent = psiElement.getParent();
        if(!(parent instanceof CSharpLambdaExpressionImpl))
        {
            return;
        }

        MarkerInfo markerInfo = new MarkerInfo(parent, psiElement.getTextRange(), AllIcons.Gutter.ImplementingFunctional, Pass.UPDATE_ALL, new ConstantFunction<PsiElement,
                String>("Navigate to lambda delegate"), new GutterIconNavigationHandler<PsiElement>()

        {
            @Override
            @RequiredDispatchThread
            public void navigate(MouseEvent e, PsiElement elt)
            {
                if(!(elt instanceof CSharpLambdaExpressionImpl))
                {
                    return;
                }
                CSharpLambdaResolveResult lambdaResolveResult = CSharpLambdaExpressionImplUtil.resolveLeftLambdaTypeRef(elt);
                if(lambdaResolveResult == null)
                {
                    return;
                }

                PsiElement element = lambdaResolveResult.getElement();
                if(element instanceof Navigatable)
                {
                    ((Navigatable) element).navigate(true);
                }
            }
        }, GutterIconRenderer.Alignment.RIGHT); NavigateAction.setNavigateAction(markerInfo, "Navigate to lambda delegate", IdeActions.ACTION_GOTO_SUPER);
        lineMarkerInfos.consume(markerInfo);
    }
}
项目:consulo-csharp    文件:HidingOrOverridingElementCollector.java   
@RequiredReadAction
@Override
public void collect(PsiElement psiElement, @NotNull Consumer<LineMarkerInfo> consumer)
{
    DotNetVirtualImplementOwner virtualImplementOwner = CSharpLineMarkerUtil.findElementForLineMarker(psiElement);
    if(virtualImplementOwner != null)
    {
        PsiElement parentParent = virtualImplementOwner.getParent();
        if(!(parentParent instanceof DotNetTypeDeclaration))
        {
            return;
        }

        Collection<DotNetVirtualImplementOwner> overrideElements = OverrideUtil.collectOverridingMembers(virtualImplementOwner);

        if(overrideElements.isEmpty())
        {
            return;
        }

        Icon icon = null;
        if(virtualImplementOwner.getTypeForImplement() != null)
        {
            icon = CSharpIcons.Gutter.HidingMethod;
        }
        else
        {
            icon = AllIcons.Gutter.ImplementingMethod;
            for(DotNetVirtualImplementOwner overrideElement : overrideElements)
            {
                if(!((DotNetModifierListOwner) overrideElement).hasModifier(DotNetModifier.ABSTRACT))
                {
                    icon = AllIcons.Gutter.OverridingMethod;
                    break;
                }
            }
        }

        LineMarkerInfo<PsiElement> lineMarkerInfo = new LineMarkerInfo<>(psiElement, psiElement.getTextRange(), icon, Pass.LINE_MARKERS, new ConstantFunction<>("Searching for overriding"), OurHandler.INSTANCE, GutterIconRenderer.Alignment.RIGHT);

        consumer.consume(lineMarkerInfo);
    }
}
项目:idea-php-symfony2-plugin    文件:ControllerMethodLineMarkerProvider.java   
@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
    );
}
项目:intellij-ce-playground    文件:DomFileDescription.java   
/**
 * @param namespaceKey namespace identifier
 * @see com.intellij.util.xml.Namespace
 * @param namespaces XML namespace or DTD public or system id value for the given namespaceKey
 */
public final void registerNamespacePolicy(String namespaceKey, final String... namespaces) {
  registerNamespacePolicy(namespaceKey, new ConstantFunction<XmlTag, List<String>>(Arrays.asList(namespaces)));
}
项目:tools-idea    文件:DomFileDescription.java   
/**
 * @param namespaceKey namespace identifier
 * @see com.intellij.util.xml.Namespace
 * @param namespaces XML namespace or DTD public or system id value for the given namespaceKey
 */
public final void registerNamespacePolicy(String namespaceKey, final String... namespaces) {
  registerNamespacePolicy(namespaceKey, new ConstantFunction<XmlTag, List<String>>(Arrays.asList(namespaces)));
}
项目:consulo-xml    文件:DomFileDescription.java   
/**
 * @param namespaceKey namespace identifier
 * @param namespaces   XML namespace or DTD public or system id value for the given namespaceKey
 * @see com.intellij.util.xml.Namespace
 */
public final void registerNamespacePolicy(@NotNull  String namespaceKey, final String... namespaces)
{
    registerNamespacePolicy(namespaceKey, new ConstantFunction<>(Arrays.asList(namespaces)));
}