Java Code Examples for com.intellij.codeInsight.daemon.impl.HighlightInfoType#getAttributesKey()

The following examples show how to use com.intellij.codeInsight.daemon.impl.HighlightInfoType#getAttributesKey() . 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: ColorSettingsUtil.java    From consulo with Apache License 2.0 6 votes vote down vote up
private static void addInspectionSeverityAttributes(List<AttributesDescriptor> descriptors) {
  descriptors.add(new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.unknown.symbol"), CodeInsightColors.WRONG_REFERENCES_ATTRIBUTES));
  descriptors.add(new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.deprecated.symbol"), CodeInsightColors.DEPRECATED_ATTRIBUTES));
  descriptors.add(new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.unused.symbol"), CodeInsightColors.NOT_USED_ELEMENT_ATTRIBUTES));
  descriptors.add(new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.error"), CodeInsightColors.ERRORS_ATTRIBUTES));
  descriptors.add(new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.warning"), CodeInsightColors.WARNINGS_ATTRIBUTES));
  descriptors.add(new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.weak.warning"), CodeInsightColors.WEAK_WARNING_ATTRIBUTES));
  descriptors.add(new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.server.problems"), CodeInsightColors.GENERIC_SERVER_ERROR_OR_WARNING));
  descriptors.add(new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.server.duplicate"), CodeInsightColors.DUPLICATE_FROM_SERVER));

  for (SeveritiesProvider provider : Extensions.getExtensions(SeveritiesProvider.EP_NAME)) {
    for (HighlightInfoType highlightInfoType : provider.getSeveritiesHighlightInfoTypes()) {
      final TextAttributesKey attributesKey = highlightInfoType.getAttributesKey();
      descriptors.add(new AttributesDescriptor(toDisplayName(attributesKey), attributesKey));
    }
  }
}
 
Example 2
Source File: SyntaxInfoBuilder.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void findNextSuitableRange() {
  myNextAttributes = null;
  while (myIterator.hasNext()) {
    RangeHighlighterEx highlighter = myIterator.next();
    if (highlighter == null || !highlighter.isValid() || !isInterestedInLayer(highlighter.getLayer())) {
      continue;
    }
    // LINES_IN_RANGE highlighters are not supported currently
    myNextStart = Math.max(highlighter.getStartOffset(), myStartOffset);
    myNextEnd = Math.min(highlighter.getEndOffset(), myEndOffset);
    if (myNextStart >= myEndOffset) {
      break;
    }
    if (myNextStart < myCurrentEnd) {
      continue; // overlapping ranges withing document markup model are not supported currently
    }
    TextAttributes attributes = null;
    HighlightInfo info = HighlightInfo.fromRangeHighlighter(highlighter);
    if (info != null) {
      TextAttributesKey key = info.forcedTextAttributesKey;
      if (key == null) {
        HighlightInfoType type = info.type;
        key = type.getAttributesKey();
      }
      if (key != null) {
        attributes = myColorsScheme.getAttributes(key);
      }
    }
    if (attributes == null) {
      continue;
    }
    Color foreground = attributes.getForegroundColor();
    Color background = attributes.getBackgroundColor();
    if ((foreground == null || myDefaultForeground.equals(foreground)) && (background == null || myDefaultBackground.equals(background)) && attributes.getFontType() == Font.PLAIN) {
      continue;
    }
    myNextAttributes = attributes;
    break;
  }
}
 
Example 3
Source File: InspectionProfileManagerImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static void registerProvidedSeverities() {
  for (SeveritiesProvider provider : Extensions.getExtensions(SeveritiesProvider.EP_NAME)) {
    for (HighlightInfoType t : provider.getSeveritiesHighlightInfoTypes()) {
      HighlightSeverity highlightSeverity = t.getSeverity(null);
      SeverityRegistrar.registerStandard(t, highlightSeverity);
      TextAttributesKey attributesKey = t.getAttributesKey();
      Icon icon = t instanceof HighlightInfoType.Iconable ? ((HighlightInfoType.Iconable)t).getIcon() : null;
      HighlightDisplayLevel.registerSeverity(highlightSeverity, attributesKey, icon);
    }
  }
}