当前位置: 首页>>代码示例>>Java>>正文


Java HighlightManager.addOccurrenceHighlight方法代码示例

本文整理汇总了Java中com.intellij.codeInsight.highlighting.HighlightManager.addOccurrenceHighlight方法的典型用法代码示例。如果您正苦于以下问题:Java HighlightManager.addOccurrenceHighlight方法的具体用法?Java HighlightManager.addOccurrenceHighlight怎么用?Java HighlightManager.addOccurrenceHighlight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.codeInsight.highlighting.HighlightManager的用法示例。


在下文中一共展示了HighlightManager.addOccurrenceHighlight方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: highlightOccurrences

import com.intellij.codeInsight.highlighting.HighlightManager; //导入方法依赖的package包/类
private static void highlightOccurrences(String filter, Project project, Editor editor) {
  final HighlightManager highlightManager = HighlightManager.getInstance(project);
  EditorColorsManager colorManager = EditorColorsManager.getInstance();
  final TextAttributes attributes = colorManager.getGlobalScheme().getAttributes(EditorColors.TEXT_SEARCH_RESULT_ATTRIBUTES);
  String documentText = editor.getDocument().getText();
  int i = -1;
  while (true) {
    int nextOccurrence = StringUtil.indexOfIgnoreCase(documentText, filter, i + 1);
    if (nextOccurrence < 0) {
      break;
    }
    i = nextOccurrence;
    highlightManager.addOccurrenceHighlight(editor, i, i + filter.length(), attributes,
                                             HighlightManager.HIDE_BY_TEXT_CHANGE, null, null);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ThreadDumpPanel.java

示例2: itemHovered

import com.intellij.codeInsight.highlighting.HighlightManager; //导入方法依赖的package包/类
@Override
public void itemHovered(@Nullable BreadcrumbsPsiItem item) {
  if (!Registry.is("editor.breadcrumbs.highlight.on.hover")) {
    return;
  }

  HighlightManager hm = HighlightManager.getInstance(myProject);
  if (myHighlighed != null) {
    for (RangeHighlighter highlighter : myHighlighed) {
      hm.removeSegmentHighlighter(myEditor, highlighter);
    }
    myHighlighed = null;
  }
  if (item != null) {
    final TextRange range = item.getPsiElement().getTextRange();
    final TextAttributes attributes = new TextAttributes();
    final CrumbPresentation p = item.getPresentation();
    final Color color = p != null ? p.getBackgroundColor(false, false, false) : BreadcrumbsComponent.ButtonSettings.DEFAULT_BG_COLOR;
    final Color background = EditorColorsManager.getInstance().getGlobalScheme().getColor(EditorColors.CARET_ROW_COLOR);
    attributes.setBackgroundColor(XmlTagTreeHighlightingUtil.makeTransparent(color, background != null ? background : Gray._200, 0.3));
    myHighlighed = new ArrayList<RangeHighlighter>(1);
    int flags = HighlightManager.HIDE_BY_ESCAPE | HighlightManager.HIDE_BY_TEXT_CHANGE | HighlightManager.HIDE_BY_ANY_KEY;
    hm.addOccurrenceHighlight(myEditor, range.getStartOffset(), range.getEndOffset(), attributes, flags, myHighlighed, null);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:BreadcrumbsXmlWrapper.java

示例3: highlight

import com.intellij.codeInsight.highlighting.HighlightManager; //导入方法依赖的package包/类
private static void highlight(@NotNull HighlightManager highlightManager,
        @NotNull Collection<TextRange> textRanges, @NotNull Editor editor,
        @NotNull TextAttributes ta, @Nullable Collection<RangeHighlighter> holder,
        @Nullable Color scrollMarkColor) {
    for (TextRange range : textRanges) {
        highlightManager.addOccurrenceHighlight(editor, range.getStartOffset(),
                range.getEndOffset(), ta, 0, holder, scrollMarkColor);
    }
}
 
开发者ID:huoguangjin,项目名称:MultiHighlight,代码行数:10,代码来源:MultiHighlightHandler.java

示例4: highlightWord

import com.intellij.codeInsight.highlighting.HighlightManager; //导入方法依赖的package包/类
private static void highlightWord(final CompletionVariant variant, final Project project) {
  HighlightManager highlightManager = HighlightManager.getInstance(project);
  EditorColorsManager colorManager = EditorColorsManager.getInstance();
  TextAttributes attributes = colorManager.getGlobalScheme().getAttributes(EditorColors.TEXT_SEARCH_RESULT_ATTRIBUTES);
  highlightManager.addOccurrenceHighlight(variant.editor, variant.offset, variant.offset + variant.variant.length(), attributes,
                                          HighlightManager.HIDE_BY_ANY_KEY, null, null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:HippieWordCompletionHandler.java

示例5: addHighlights

import com.intellij.codeInsight.highlighting.HighlightManager; //导入方法依赖的package包/类
protected void addHighlights(@NotNull Map<TextRange, TextAttributes> ranges,
                             @NotNull Editor editor,
                             @NotNull Collection<RangeHighlighter> highlighters,
                             @NotNull HighlightManager highlightManager) {
  for (Map.Entry<TextRange, TextAttributes> entry : ranges.entrySet()) {
    TextRange range = entry.getKey();
    TextAttributes attributes = entry.getValue();
    highlightManager.addOccurrenceHighlight(editor, range.getStartOffset(), range.getEndOffset(), attributes, 0, highlighters, null);
  }

  for (RangeHighlighter highlighter : highlighters) {
    highlighter.setGreedyToLeft(true);
    highlighter.setGreedyToRight(true);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:InplaceRefactoring.java

示例6: addHighlights

import com.intellij.codeInsight.highlighting.HighlightManager; //导入方法依赖的package包/类
private static void addHighlights(List<TextRange> ranges, Editor editor, ArrayList<RangeHighlighter> highlighters) {
  EditorColorsManager colorsManager = EditorColorsManager.getInstance();
  final TextAttributes attributes = colorsManager.getGlobalScheme().getAttributes(EditorColors.WRITE_SEARCH_RESULT_ATTRIBUTES);

  final HighlightManager highlightManager = HighlightManager.getInstance(editor.getProject());
  for (final TextRange range : ranges) {
    highlightManager.addOccurrenceHighlight(editor, range.getStartOffset(), range.getEndOffset(), attributes, 0, highlighters, null);
  }

  for (RangeHighlighter highlighter : highlighters) {
    highlighter.setGreedyToLeft(true);
    highlighter.setGreedyToRight(true);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:XmlTagInplaceRenamer.java

示例7: highlightWord

import com.intellij.codeInsight.highlighting.HighlightManager; //导入方法依赖的package包/类
private static void highlightWord(final Editor editor, final CompletionVariant variant, final Project project, CompletionData data) {
  int delta = data.startOffset < variant.offset ? variant.variant.length() - data.myWordUnderCursor.length() : 0;

  HighlightManager highlightManager = HighlightManager.getInstance(project);
  EditorColorsManager colorManager = EditorColorsManager.getInstance();
  TextAttributes attributes = colorManager.getGlobalScheme().getAttributes(EditorColors.TEXT_SEARCH_RESULT_ATTRIBUTES);
  highlightManager.addOccurrenceHighlight(editor, variant.offset + delta, variant.offset + variant.variant.length() + delta, attributes,
                                          HighlightManager.HIDE_BY_ANY_KEY, null, null);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:10,代码来源:HippieWordCompletionHandler.java

示例8: highlightWord

import com.intellij.codeInsight.highlighting.HighlightManager; //导入方法依赖的package包/类
private static void highlightWord(final CompletionVariant variant, final Project project, CompletionData data) {
  int delta = data.startOffset < variant.offset ? variant.variant.length() - data.myWordUnderCursor.length() : 0;

  HighlightManager highlightManager = HighlightManager.getInstance(project);
  EditorColorsManager colorManager = EditorColorsManager.getInstance();
  TextAttributes attributes = colorManager.getGlobalScheme().getAttributes(EditorColors.TEXT_SEARCH_RESULT_ATTRIBUTES);
  highlightManager.addOccurrenceHighlight(variant.editor, variant.offset + delta, variant.offset + variant.variant.length() + delta, attributes,
                                          HighlightManager.HIDE_BY_ANY_KEY, null, null);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:10,代码来源:HippieWordCompletionHandler.java

示例9: itemHovered

import com.intellij.codeInsight.highlighting.HighlightManager; //导入方法依赖的package包/类
private void itemHovered(Crumb crumb, InputEvent event) {
  if (Boolean.TRUE) {
    return;
  }

  HighlightManager hm = HighlightManager.getInstance(myProject);
  if (myHighlighed != null) {
    for (RangeHighlighter highlighter : myHighlighed) {
      hm.removeSegmentHighlighter(myEditor, highlighter);
    }
    myHighlighed = null;
  }
  PsiElement psiElement = PsiCrumb.getElement(crumb);
  if (psiElement != null) {
    final TextRange range = psiElement.getTextRange();
    final TextAttributes attributes = new TextAttributes();
    final CrumbPresentation p = PsiCrumb.getPresentation(crumb);
    Color color = p == null ? null : p.getBackgroundColor(false, false, false);
    if (color == null) color = BreadcrumbsComponent.ButtonSettings.getBackgroundColor(false, false, false, false);
    if (color == null) color = UIUtil.getLabelBackground();
    final Color background = EditorColorsManager.getInstance().getGlobalScheme().getColor(EditorColors.CARET_ROW_COLOR);
    attributes.setBackgroundColor(makeTransparent(color, background != null ? background : Gray._200, 0.3));
    myHighlighed = new ArrayList<>(1);
    int flags = HighlightManager.HIDE_BY_ESCAPE | HighlightManager.HIDE_BY_TEXT_CHANGE | HighlightManager.HIDE_BY_ANY_KEY;
    hm.addOccurrenceHighlight(myEditor, range.getStartOffset(), range.getEndOffset(), attributes, flags, myHighlighed, null);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:28,代码来源:BreadcrumbsWrapper.java

示例10: addHighlights

import com.intellij.codeInsight.highlighting.HighlightManager; //导入方法依赖的package包/类
protected void addHighlights(@Nonnull Map<TextRange, TextAttributes> ranges,
                             @Nonnull Editor editor,
                             @Nonnull Collection<RangeHighlighter> highlighters,
                             @Nonnull HighlightManager highlightManager) {
  for (Map.Entry<TextRange, TextAttributes> entry : ranges.entrySet()) {
    TextRange range = entry.getKey();
    TextAttributes attributes = entry.getValue();
    highlightManager.addOccurrenceHighlight(editor, range.getStartOffset(), range.getEndOffset(), attributes, 0, highlighters, null);
  }

  for (RangeHighlighter highlighter : highlighters) {
    highlighter.setGreedyToLeft(true);
    highlighter.setGreedyToRight(true);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:16,代码来源:InplaceRefactoring.java


注:本文中的com.intellij.codeInsight.highlighting.HighlightManager.addOccurrenceHighlight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。