本文整理汇总了Java中com.intellij.codeInsight.daemon.LineMarkerProvider类的典型用法代码示例。如果您正苦于以下问题:Java LineMarkerProvider类的具体用法?Java LineMarkerProvider怎么用?Java LineMarkerProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LineMarkerProvider类属于com.intellij.codeInsight.daemon包,在下文中一共展示了LineMarkerProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: assertLineMarker
import com.intellij.codeInsight.daemon.LineMarkerProvider; //导入依赖的package包/类
public void assertLineMarker(@NotNull PsiElement psiElement, @NotNull LineMarker.Assert assertMatch) {
final List<PsiElement> elements = collectPsiElementsRecursive(psiElement);
for (LineMarkerProvider lineMarkerProvider : LineMarkerProviders.INSTANCE.allForLanguage(psiElement.getLanguage())) {
Collection<LineMarkerInfo> lineMarkerInfos = new ArrayList<LineMarkerInfo>();
lineMarkerProvider.collectSlowLineMarkers(elements, lineMarkerInfos);
if(lineMarkerInfos.size() == 0) {
continue;
}
for (LineMarkerInfo lineMarkerInfo : lineMarkerInfos) {
if(assertMatch.match(lineMarkerInfo)) {
return;
}
}
}
fail(String.format("Fail that '%s' matches on of '%s' PsiElements", assertMatch.getClass(), elements.size()));
}
示例2: doCollectInformation
import com.intellij.codeInsight.daemon.LineMarkerProvider; //导入依赖的package包/类
@Override
public void doCollectInformation(@NotNull ProgressIndicator progress) {
final List<LineMarkerInfo> lineMarkers = new ArrayList<LineMarkerInfo>();
final FileViewProvider viewProvider = myFile.getViewProvider();
final Set<Language> relevantLanguages = viewProvider.getLanguages();
for (Language language : relevantLanguages) {
PsiElement psiRoot = viewProvider.getPsi(language);
if (!HighlightingLevelManager.getInstance(myProject).shouldHighlight(psiRoot)) continue;
List<PsiElement> elements = CollectHighlightsUtil.getElementsInRange(psiRoot, myBounds.getStartOffset(), myBounds.getEndOffset());
if (elements.isEmpty()) {
elements = Collections.singletonList(psiRoot);
}
final List<LineMarkerProvider> providers = getMarkerProviders(language, myProject);
addLineMarkers(elements, providers, lineMarkers, progress);
collectLineMarkersForInjected(lineMarkers, elements, this, myFile, progress);
}
myMarkers = mergeLineMarkers(lineMarkers, myEditor);
}
示例3: doCollectInformation
import com.intellij.codeInsight.daemon.LineMarkerProvider; //导入依赖的package包/类
@Override
public void doCollectInformation(@NotNull ProgressIndicator progress) {
final FileViewProvider viewProvider = myFile.getViewProvider();
final Set<Language> relevantLanguages = viewProvider.getLanguages();
List<LineMarkerInfo> markers = new SmartList<LineMarkerInfo>();
for (Language language : relevantLanguages) {
PsiElement psiRoot = viewProvider.getPsi(language);
if (psiRoot == null || !HighlightingLevelManager.getInstance(myProject).shouldHighlight(psiRoot)) continue;
List<PsiElement> elements = CollectHighlightsUtil.getElementsInRange(psiRoot, myBounds.getStartOffset(), myBounds.getEndOffset());
final List<LineMarkerProvider> providers = LineMarkersPass.getMarkerProviders(language, myProject);
addLineMarkers(elements, providers, markers, progress);
LineMarkersPass.collectLineMarkersForInjected(markers, elements, this, myFile, progress);
}
myMarkers = LineMarkersPass.mergeLineMarkers(markers, myEditor);
}
示例4: doCollectInformation
import com.intellij.codeInsight.daemon.LineMarkerProvider; //导入依赖的package包/类
@Override
public void doCollectInformation(@NotNull ProgressIndicator progress) {
final FileViewProvider viewProvider = myFile.getViewProvider();
final Set<Language> relevantLanguages = viewProvider.getLanguages();
List<LineMarkerInfo> markers = new SmartList<LineMarkerInfo>();
for (Language language : relevantLanguages) {
PsiElement psiRoot = viewProvider.getPsi(language);
if (psiRoot == null || !HighlightLevelUtil.shouldHighlight(psiRoot)) continue;
List<PsiElement> elements = CollectHighlightsUtil.getElementsInRange(psiRoot, myStartOffset, myEndOffset);
final List<LineMarkerProvider> providers = LineMarkersPass.getMarkerProviders(language, myProject);
addLineMarkers(elements, providers, markers, progress);
LineMarkersPass.collectLineMarkersForInjected(markers, elements, this, myFile, progress);
}
myMarkers = markers;
}
示例5: assertLineMarker
import com.intellij.codeInsight.daemon.LineMarkerProvider; //导入依赖的package包/类
public void assertLineMarker(@NotNull PsiElement psiElement, @NotNull LineMarker.Assert assertMatch) {
final List<PsiElement> elements = collectPsiElementsRecursive(psiElement);
for (LineMarkerProvider lineMarkerProvider : LineMarkerProviders.INSTANCE.allForLanguage(psiElement.getLanguage())) {
Collection<LineMarkerInfo> lineMarkerInfos = new ArrayList<>();
lineMarkerProvider.collectSlowLineMarkers(elements, lineMarkerInfos);
if(lineMarkerInfos.size() == 0) {
continue;
}
for (LineMarkerInfo lineMarkerInfo : lineMarkerInfos) {
if(assertMatch.match(lineMarkerInfo)) {
return;
}
}
}
fail(String.format("Fail that '%s' matches on of '%s' PsiElements", assertMatch.getClass(), elements.size()));
}
开发者ID:Haehnchen,项目名称:idea-php-annotation-plugin,代码行数:22,代码来源:AnnotationLightCodeInsightFixtureTestCase.java
示例6: assertLineMarkerIsEmpty
import com.intellij.codeInsight.daemon.LineMarkerProvider; //导入依赖的package包/类
public void assertLineMarkerIsEmpty(@NotNull PsiElement psiElement) {
final List<PsiElement> elements = collectPsiElementsRecursive(psiElement);
for (LineMarkerProvider lineMarkerProvider : LineMarkerProviders.INSTANCE.allForLanguage(psiElement.getLanguage())) {
Collection<LineMarkerInfo> lineMarkerInfos = new ArrayList<LineMarkerInfo>();
lineMarkerProvider.collectSlowLineMarkers(elements, lineMarkerInfos);
if(lineMarkerInfos.size() > 0) {
fail(String.format("Fail that line marker is empty because it matches '%s'", lineMarkerProvider.getClass()));
}
}
}
示例7: getGutterNavigationDestinationElements
import com.intellij.codeInsight.daemon.LineMarkerProvider; //导入依赖的package包/类
static List<GotoRelatedItem> getGutterNavigationDestinationElements(LineMarkerInfo.LineMarkerGutterIconRenderer gutter) {
LineMarkerProvider lineMarkerProvider1 = LineMarkersPass.getMarkerProviders(JavaLanguage.INSTANCE, gutter
.getLineMarkerInfo()
.getElement().getProject())
.stream()
.filter(lineMarkerProvider -> lineMarkerProvider instanceof CamelRouteLineMarkerProvider).findAny()
.get();
List<RelatedItemLineMarkerInfo> result = new ArrayList<>();
((CamelRouteLineMarkerProvider) lineMarkerProvider1).collectNavigationMarkers(gutter.getLineMarkerInfo().getElement(), result);
return (List<GotoRelatedItem>) result.get(0).createGotoRelatedItems();
}
示例8: addLineMarkers
import com.intellij.codeInsight.daemon.LineMarkerProvider; //导入依赖的package包/类
@Override
public void addLineMarkers(@NotNull List<PsiElement> elements,
@NotNull List<LineMarkerProvider> providers,
@NotNull List<LineMarkerInfo> result,
@NotNull ProgressIndicator progress) throws ProcessCanceledException {
for (LineMarkerProvider provider : providers) {
provider.collectSlowLineMarkers(elements, result);
}
}
示例9: getItems
import com.intellij.codeInsight.daemon.LineMarkerProvider; //导入依赖的package包/类
@NotNull
@Override
public List<? extends GotoRelatedItem> getItems(@NotNull 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;
}
示例10: getLineMarkerInfo
import com.intellij.codeInsight.daemon.LineMarkerProvider; //导入依赖的package包/类
@Override
public LineMarkerInfo getLineMarkerInfo(@NotNull final PsiElement element) {
if (element instanceof PsiWhiteSpace) return null;
final Language language = element.getLanguage();
if (!(language instanceof XMLLanguage)) {
final LineMarkerProvider markerProvider = getLineMarkerProviderFromLanguage(language, embeddedLanguagesLineMarkerProviders);
if (markerProvider != null) return markerProvider.getLineMarkerInfo(element);
}
return null;
}
示例11: getLineMarkerProviderFromLanguage
import com.intellij.codeInsight.daemon.LineMarkerProvider; //导入依赖的package包/类
private static LineMarkerProvider getLineMarkerProviderFromLanguage(final Language language,
final Map<Language, LineMarkerProvider> embeddedLanguagesLineMarkerProviders) {
final LineMarkerProvider markerProvider;
if (!embeddedLanguagesLineMarkerProviders.containsKey(language)) {
embeddedLanguagesLineMarkerProviders.put(language, markerProvider = LineMarkerProviders.INSTANCE.forLanguage(language));
} else {
markerProvider = embeddedLanguagesLineMarkerProviders.get(language);
}
return markerProvider;
}
示例12: collectSlowLineMarkers
import com.intellij.codeInsight.daemon.LineMarkerProvider; //导入依赖的package包/类
@Override
public void collectSlowLineMarkers(@NotNull final List<PsiElement> elements, @NotNull final Collection<LineMarkerInfo> result) {
Map<Language, LineMarkerProvider> localEmbeddedLanguagesLineMarkerProviders = null;
Map<LineMarkerProvider, List<PsiElement>> embeddedLineMarkersWorkItems = null;
for(PsiElement element:elements) {
if(element instanceof PsiWhiteSpace) continue;
final Language language = element.getLanguage();
if (!(language instanceof XMLLanguage)) {
if(localEmbeddedLanguagesLineMarkerProviders == null) {
localEmbeddedLanguagesLineMarkerProviders = new THashMap<Language, LineMarkerProvider>();
}
final LineMarkerProvider lineMarkerProvider = getLineMarkerProviderFromLanguage(language, localEmbeddedLanguagesLineMarkerProviders);
if (lineMarkerProvider != null) {
if (embeddedLineMarkersWorkItems == null) embeddedLineMarkersWorkItems = new THashMap<LineMarkerProvider, List<PsiElement>>();
List<PsiElement> elementList = embeddedLineMarkersWorkItems.get(lineMarkerProvider);
if (elementList == null) {
elementList = new ArrayList<PsiElement>(5);
embeddedLineMarkersWorkItems.put(lineMarkerProvider, elementList);
}
elementList.add(element);
}
}
}
if (embeddedLineMarkersWorkItems != null) {
for(Map.Entry<LineMarkerProvider, List<PsiElement>> entry:embeddedLineMarkersWorkItems.entrySet()) {
entry.getKey().collectSlowLineMarkers(entry.getValue(), result);
}
}
}
示例13: collectInformationWithProgress
import com.intellij.codeInsight.daemon.LineMarkerProvider; //导入依赖的package包/类
@Override
protected void collectInformationWithProgress(final ProgressIndicator progress) {
final List<LineMarkerInfo> lineMarkers = new ArrayList<LineMarkerInfo>();
final FileViewProvider viewProvider = myFile.getViewProvider();
final Set<Language> relevantLanguages = viewProvider.getLanguages();
for (Language language : relevantLanguages) {
PsiElement psiRoot = viewProvider.getPsi(language);
if (!HighlightLevelUtil.shouldHighlight(psiRoot)) continue;
//long time = System.currentTimeMillis();
int start = myStartOffset;
int end = myEndOffset;
//if (myEditor != null) {
// final int startLine = myEditor.offsetToLogicalPosition(start).line;
// final int endLine = myEditor.offsetToLogicalPosition(end).line;
// if (startLine != endLine) {
// start = myEditor.logicalPositionToOffset(myEditor.visualToLogicalPosition(new VisualPosition(startLine, 0)));
// end = myEditor.logicalPositionToOffset(myEditor.visualToLogicalPosition(new VisualPosition(endLine + 1, 0))) - 1;
// }
//}
List<PsiElement> elements = CollectHighlightsUtil.getElementsInRange(psiRoot, start, end);
if (elements.isEmpty()) {
elements = Collections.singletonList(psiRoot);
}
final List<LineMarkerProvider> providers = getMarkerProviders(language, myProject);
addLineMarkers(elements, providers, lineMarkers, progress);
collectLineMarkersForInjected(lineMarkers, elements, this, myFile, progress);
}
myMarkers = mergeLineMarkers(lineMarkers);
}
示例14: getLineMarkerInfo
import com.intellij.codeInsight.daemon.LineMarkerProvider; //导入依赖的package包/类
public LineMarkerInfo getLineMarkerInfo(@NotNull final PsiElement element) {
if (element instanceof PsiWhiteSpace) return null;
final Language language = element.getLanguage();
if (!(language instanceof XMLLanguage)) {
final LineMarkerProvider markerProvider = getLineMarkerProviderFromLanguage(language, embeddedLanguagesLineMarkerProviders);
if (markerProvider != null) return markerProvider.getLineMarkerInfo(element);
}
return null;
}
示例15: collectSlowLineMarkers
import com.intellij.codeInsight.daemon.LineMarkerProvider; //导入依赖的package包/类
public void collectSlowLineMarkers(@NotNull final List<PsiElement> elements, @NotNull final Collection<LineMarkerInfo> result) {
Map<Language, LineMarkerProvider> localEmbeddedLanguagesLineMarkerProviders = null;
Map<LineMarkerProvider, List<PsiElement>> embeddedLineMarkersWorkItems = null;
for(PsiElement element:elements) {
if(element instanceof PsiWhiteSpace) continue;
final Language language = element.getLanguage();
if (!(language instanceof XMLLanguage)) {
if(localEmbeddedLanguagesLineMarkerProviders == null) {
localEmbeddedLanguagesLineMarkerProviders = new THashMap<Language, LineMarkerProvider>();
}
final LineMarkerProvider lineMarkerProvider = getLineMarkerProviderFromLanguage(language, localEmbeddedLanguagesLineMarkerProviders);
if (lineMarkerProvider != null) {
if (embeddedLineMarkersWorkItems == null) embeddedLineMarkersWorkItems = new THashMap<LineMarkerProvider, List<PsiElement>>();
List<PsiElement> elementList = embeddedLineMarkersWorkItems.get(lineMarkerProvider);
if (elementList == null) {
elementList = new ArrayList<PsiElement>(5);
embeddedLineMarkersWorkItems.put(lineMarkerProvider, elementList);
}
elementList.add(element);
}
}
}
if (embeddedLineMarkersWorkItems != null) {
for(Map.Entry<LineMarkerProvider, List<PsiElement>> entry:embeddedLineMarkersWorkItems.entrySet()) {
entry.getKey().collectSlowLineMarkers(entry.getValue(), result);
}
}
}