Java Code Examples for com.intellij.util.ui.UIUtil#getLabelBackground()

The following examples show how to use com.intellij.util.ui.UIUtil#getLabelBackground() . 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: BreadcrumbsWrapper.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void itemHovered(Crumb crumb, @SuppressWarnings("unused") InputEvent event) {
  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 (crumb instanceof NavigatableCrumb) {
    final TextRange range = ((NavigatableCrumb)crumb).getHighlightRange();
    if (range == null) return;
    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);
  }
}
 
Example 2
Source File: HyperlinkLabel.java    From consulo with Apache License 2.0 4 votes vote down vote up
public HyperlinkLabel(String text) {
  this(text,
       JBColor.BLUE,
       UIUtil.getLabelBackground(),
       JBColor.BLUE);
}