com.intellij.codeInsight.daemon.RelatedItemLineMarkerProvider Java Examples
The following examples show how to use
com.intellij.codeInsight.daemon.RelatedItemLineMarkerProvider.
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: RelatedItemLineMarkerGotoAdapter.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull @Override public List<? extends GotoRelatedItem> getItems(@Nonnull PsiElement context) { List<PsiElement> parents = new ArrayList<PsiElement>(); PsiElement current = context; Set<Language> languages = new HashSet<Language>(); while (current != null) { parents.add(current); languages.add(current.getLanguage()); if (current instanceof PsiFile) break; current = current.getParent(); } List<LineMarkerProvider> providers = new ArrayList<LineMarkerProvider>(); for (Language language : languages) { providers.addAll(LineMarkersPass.getMarkerProviders(language, context.getProject())); } List<GotoRelatedItem> items = new ArrayList<GotoRelatedItem>(); for (LineMarkerProvider provider : providers) { if (provider instanceof RelatedItemLineMarkerProvider) { List<RelatedItemLineMarkerInfo> markers = new ArrayList<RelatedItemLineMarkerInfo>(); RelatedItemLineMarkerProvider relatedItemLineMarkerProvider = (RelatedItemLineMarkerProvider)provider; for (PsiElement parent : parents) { ContainerUtil.addIfNotNull(relatedItemLineMarkerProvider.getLineMarkerInfo(parent), markers); } relatedItemLineMarkerProvider.collectNavigationMarkers(parents, markers, true); addItemsForMarkers(markers, items); } } return items; }