本文整理了Java中com.intellij.lang.annotation.Annotation.setEnforcedTextAttributes()
方法的一些代码示例,展示了Annotation.setEnforcedTextAttributes()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Annotation.setEnforcedTextAttributes()
方法的具体详情如下:
包路径:com.intellij.lang.annotation.Annotation
类名称:Annotation
方法名:setEnforcedTextAttributes
暂无
代码示例来源:origin: KronicDeth/intellij-elixir
/**
* Highlights `textRange` with the given `textAttributesKey`.
*
* @param textRange textRange in the document to highlight
* @param annotationHolder the container which receives annotations created by the plugin.
* @param textAttributesKey text attributes to apply to the `node`.
*/
private void highlight(@NotNull final TextRange textRange, @NotNull AnnotationHolder annotationHolder, @NotNull final TextAttributesKey textAttributesKey) {
annotationHolder.createInfoAnnotation(textRange, null).setEnforcedTextAttributes(TextAttributes.ERASE_MARKER);
annotationHolder.createInfoAnnotation(textRange, null).setEnforcedTextAttributes(EditorColorsManager.getInstance().getGlobalScheme().getAttributes(textAttributesKey));
}
代码示例来源:origin: go-lang-plugin-org/go-lang-idea-plugin
private static void setHighlighting(@NotNull PsiElement element, @NotNull AnnotationHolder holder, @NotNull TextAttributesKey key) {
holder.createInfoAnnotation(element, null).setEnforcedTextAttributes(TextAttributes.ERASE_MARKER);
String description = ApplicationManager.getApplication().isUnitTestMode() ? key.getExternalName() : null;
holder.createInfoAnnotation(element, description).setTextAttributes(key);
}
代码示例来源:origin: KronicDeth/intellij-elixir
/**
* Highlights `textRange` with the given `textAttributesKey`.
*
* @param textRange textRange in the document to highlight
* @param annotationHolder the container which receives annotations created by the plugin.
* @param textAttributesKey text attributes to apply to the `node`.
*/
private void highlight(@NotNull final TextRange textRange,
@NotNull AnnotationHolder annotationHolder,
@NotNull final TextAttributesKey textAttributesKey) {
annotationHolder.createInfoAnnotation(textRange, null)
.setEnforcedTextAttributes(TextAttributes.ERASE_MARKER);
annotationHolder.createInfoAnnotation(textRange, null)
.setEnforcedTextAttributes(
EditorColorsManager.getInstance().getGlobalScheme().getAttributes(textAttributesKey)
);
}
}
代码示例来源:origin: KronicDeth/intellij-elixir
/**
* Highlights `textRange` with the given `textAttributesKey`.
*
* @param textRange textRange in the document to highlight
* @param annotationHolder the container which receives annotations created by the plugin.
* @param textAttributesKey text attributes to apply to the `node`.
*/
private void highlight(@NotNull final TextRange textRange,
@NotNull AnnotationHolder annotationHolder,
@NotNull final TextAttributesKey textAttributesKey) {
annotationHolder.createInfoAnnotation(textRange, null)
.setEnforcedTextAttributes(TextAttributes.ERASE_MARKER);
annotationHolder.createInfoAnnotation(textRange, null)
.setEnforcedTextAttributes(
EditorColorsManager.getInstance().getGlobalScheme().getAttributes(textAttributesKey)
);
}
}
代码示例来源:origin: KronicDeth/intellij-elixir
/**
* Highlights `textRange` with the given `textAttributesKey`.
*
* @param textRange textRange in the document to highlight
* @param annotationHolder the container which receives annotations created by the plugin.
* @param textAttributesKey text attributes to apply to the `node`.
*/
private void highlight(@NotNull final TextRange textRange,
@NotNull AnnotationHolder annotationHolder,
@NotNull final TextAttributesKey textAttributesKey) {
annotationHolder.createInfoAnnotation(textRange, null)
.setEnforcedTextAttributes(TextAttributes.ERASE_MARKER);
annotationHolder.createInfoAnnotation(textRange, null)
.setEnforcedTextAttributes(
EditorColorsManager.getInstance().getGlobalScheme().getAttributes(textAttributesKey)
);
}
}
代码示例来源:origin: KronicDeth/intellij-elixir
/**
* Highlights `textRange` with the given `textAttributesKey`.
*
* @param textRange textRange in the document to highlight
* @param annotationHolder the container which receives annotations created by the plugin.
* @param textAttributesKey text attributes to apply to the `node`.
*/
private void highlight(@NotNull final TextRange textRange,
@NotNull AnnotationHolder annotationHolder,
@NotNull final TextAttributesKey textAttributesKey) {
annotationHolder.createInfoAnnotation(textRange, null)
.setEnforcedTextAttributes(TextAttributes.ERASE_MARKER);
annotationHolder.createInfoAnnotation(textRange, null)
.setEnforcedTextAttributes(
EditorColorsManager.getInstance().getGlobalScheme().getAttributes(textAttributesKey)
);
}
}
代码示例来源:origin: BashSupport/BashSupport
private void annotateWord(PsiElement bashWord, AnnotationHolder annotationHolder) {
//we have to mark the remapped tokens (which are words now) to have the default word formatting.
PsiElement child = bashWord.getFirstChild();
while (child != null && false) {
if (!noWordHighlightErase.contains(child.getNode().getElementType())) {
Annotation annotation = annotationHolder.createInfoAnnotation(child, null);
annotation.setEnforcedTextAttributes(TextAttributes.ERASE_MARKER);
annotation = annotationHolder.createInfoAnnotation(child, null);
annotation.setEnforcedTextAttributes(EditorColorsManager.getInstance().getGlobalScheme().getAttributes(HighlighterColors.TEXT));
}
child = child.getNextSibling();
}
}
代码示例来源:origin: protostuff/protobuf-jetbrains-plugin
private static void setHighlighting(@NotNull PsiElement element, @NotNull AnnotationHolder holder,
@NotNull TextAttributesKey key) {
holder.createInfoAnnotation(element, null).setEnforcedTextAttributes(TextAttributes.ERASE_MARKER);
holder.createInfoAnnotation(element, null).setEnforcedTextAttributes(
EditorColorsManager.getInstance().getGlobalScheme().getAttributes(key));
}
代码示例来源:origin: intellij-dlanguage/intellij-dlanguage
private static void setHighlighting(@NotNull final PsiElement element,
@NotNull final AnnotationHolder holder,
@NotNull final TextAttributesKey key) {
holder.createInfoAnnotation(element, null).setEnforcedTextAttributes(
EditorColorsManager.getInstance().getGlobalScheme().getAttributes(key));
}
代码示例来源:origin: Camelcade/Perl5-IDEA
public void decorateElement(Annotation annotation, TextAttributesKey key, boolean deprecated) {
annotation.setEnforcedTextAttributes(adjustTextAttributes(currentScheme.getAttributes(key), deprecated));
}
代码示例来源:origin: Camelcade/Perl5-IDEA
public void decorateElement(PsiElement element, @NotNull AnnotationHolder holder, TextAttributesKey key, boolean deprecated) {
if (element == null) {
return;
}
holder.createInfoAnnotation(element, null)
.setEnforcedTextAttributes(adjustTextAttributes(currentScheme.getAttributes(key), deprecated));
}
代码示例来源:origin: liias/monkey
private static void highlightPsiElement(PsiElement element, @NotNull AnnotationHolder holder, @NotNull TextAttributesKey colorKey) {
TextAttributes enforcedTextAttributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(colorKey);
holder.createInfoAnnotation(element, null)
.setEnforcedTextAttributes(enforcedTextAttributes);
}
代码示例来源:origin: neueda/jetbrains-plugin-graph-database-support
private static void setHighlighting(@NotNull PsiElement element, @NotNull AnnotationHolder holder, @NotNull TextAttributesKey key) {
holder.createInfoAnnotation(element, null).setEnforcedTextAttributes(TextAttributes.ERASE_MARKER);
String description = ApplicationManager.getApplication().isUnitTestMode() ? key.getExternalName() : null;
holder.createInfoAnnotation(element, description).setTextAttributes(key);
}
}
代码示例来源:origin: BashSupport/BashSupport
private void annotateBinaryData(BashBinaryDataElement element, AnnotationHolder annotationHolder) {
Annotation annotation = annotationHolder.createInfoAnnotation(element, null);
annotation.setEnforcedTextAttributes(TextAttributes.ERASE_MARKER);
annotation = annotationHolder.createInfoAnnotation(element, null);
annotation.setTextAttributes(BashSyntaxHighlighter.BINARY_DATA);
annotation.setNeedsUpdateOnTyping(false);
}
代码示例来源:origin: SeeSharpSoft/intellij-csv-validator
protected boolean handleSeparatorElement(@NotNull PsiElement element, @NotNull AnnotationHolder holder, IElementType elementType, CsvFile csvFile) {
if (elementType == CsvTypes.COMMA) {
TextAttributes textAttributes = holder.getCurrentAnnotationSession().getUserData(TAB_SEPARATOR_HIGHLIGHT_COLOR_KEY);
if (!Boolean.TRUE.equals(holder.getCurrentAnnotationSession().getUserData(TAB_SEPARATOR_HIGHLIGHT_COLOR_DETERMINED_KEY))) {
String separator = CsvCodeStyleSettings.getCurrentSeparator(csvFile.getProject(), csvFile.getLanguage());
if (CsvEditorSettingsExternalizable.getInstance().isHighlightTabSeparator() && separator.equals(CsvCodeStyleSettings.TAB_SEPARATOR)) {
textAttributes = new TextAttributes(null,
CsvEditorSettingsExternalizable.getInstance().getTabHighlightColor(),
null, null, 0);
holder.getCurrentAnnotationSession().putUserData(TAB_SEPARATOR_HIGHLIGHT_COLOR_KEY, textAttributes);
holder.getCurrentAnnotationSession().putUserData(TAB_SEPARATOR_HIGHLIGHT_COLOR_DETERMINED_KEY, Boolean.TRUE);
}
}
if (textAttributes != null) {
Annotation annotation = holder.createAnnotation(
CSV_COLUMN_INFO_SEVERITY,
element.getTextRange(),
showInfoBalloon(holder.getCurrentAnnotationSession()) ? "↹" : null
);
annotation.setEnforcedTextAttributes(textAttributes);
annotation.setNeedsUpdateOnTyping(false);
}
return true;
}
return false;
}
代码示例来源:origin: JetBrains/Grammar-Kit
annotationHolder.createInfoAnnotation(psiElement, null).setEnforcedTextAttributes(TextAttributes.ERASE_MARKER);
annotationHolder.createInfoAnnotation(psiElement, null).setTextAttributes(BnfSyntaxHighlighter.PATTERN);
if (!RuleGraphHelper.getTokenTextToNameMap((BnfFile)psiElement.getContainingFile()).containsKey(text)) {
String message = "Tokens matched by text are slower than tokens matched by types";
annotationHolder.createInfoAnnotation(psiElement, null).setEnforcedTextAttributes(TextAttributes.ERASE_MARKER);
annotationHolder.createInfoAnnotation(psiElement, message).setTextAttributes(BnfSyntaxHighlighter.PATTERN);
代码示例来源:origin: SeeSharpSoft/intellij-csv-validator
annotation.setEnforcedTextAttributes(
CsvEditorSettingsExternalizable.getInstance().isColumnHighlightingEnabled() ?
CsvColorSettings.getTextAttributesOfColumn(columnInfo.getColumnIndex(), holder.getCurrentAnnotationSession()) :
代码示例来源:origin: Camelcade/Perl5-IDEA
holder.createInfoAnnotation(ElementManipulators.getValueTextRange(navigationElement).shiftRight(lightNamedElement.getTextOffset()),
null)
.setEnforcedTextAttributes(adjustTextAttributes(currentScheme.getAttributes(currentKey), false));
内容来源于网络,如有侵权,请联系作者删除!