Java Code Examples for com.intellij.openapi.fileTypes.SyntaxHighlighter#getTokenHighlights()
The following examples show how to use
com.intellij.openapi.fileTypes.SyntaxHighlighter#getTokenHighlights() .
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: SyntaxHighlighterOverEditorHighlighter.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull @Override public TextAttributesKey[] getTokenHighlights(IElementType tokenType) { final SyntaxHighlighter activeSyntaxHighlighter = layeredHighlighterIterator != null ? layeredHighlighterIterator.getActiveSyntaxHighlighter() : highlighter; return activeSyntaxHighlighter.getTokenHighlights(tokenType); }
Example 2
Source File: ConsoleViewUtil.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull public static ConsoleViewContentType getContentTypeForToken(@Nonnull IElementType tokenType, @Nonnull SyntaxHighlighter highlighter) { TextAttributesKey[] keys = highlighter.getTokenHighlights(tokenType); if (keys.length == 0) { return ConsoleViewContentType.NORMAL_OUTPUT; } return ConsoleViewContentType.getConsoleViewType(ColorCache.keys.get(Arrays.asList(keys))); }
Example 3
Source File: ClickNavigator.java From consulo with Apache License 2.0 | 5 votes |
public static String highlightingTypeFromTokenType(IElementType tokenType, SyntaxHighlighter highlighter) { TextAttributesKey[] highlights = highlighter.getTokenHighlights(tokenType); String s = null; for (int i = highlights.length - 1; i >= 0; i--) { if (highlights[i] != HighlighterColors.TEXT) { s = highlights[i].getExternalName(); break; } } return s == null ? HighlighterColors.TEXT.getExternalName() : s; }
Example 4
Source File: SimpleEditorPreview.java From consulo with Apache License 2.0 | 5 votes |
@Nullable private static String selectItem(HighlighterIterator itr, SyntaxHighlighter highlighter) { IElementType tokenType = itr.getTokenType(); if (tokenType == null) return null; TextAttributesKey[] highlights = highlighter.getTokenHighlights(tokenType); String s = null; for (int i = highlights.length - 1; i >= 0; i--) { if (highlights[i] != HighlighterColors.TEXT) { s = highlights[i].getExternalName(); break; } } return s == null ? HighlighterColors.TEXT.getExternalName() : s; }