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


Java SeverityRegistrar类代码示例

本文整理汇总了Java中com.intellij.codeInsight.daemon.impl.SeverityRegistrar的典型用法代码示例。如果您正苦于以下问题:Java SeverityRegistrar类的具体用法?Java SeverityRegistrar怎么用?Java SeverityRegistrar使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SeverityRegistrar类属于com.intellij.codeInsight.daemon.impl包,在下文中一共展示了SeverityRegistrar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fillDaemonCodeAnalyzerErrorsStatus

import com.intellij.codeInsight.daemon.impl.SeverityRegistrar; //导入依赖的package包/类
@Override
protected void fillDaemonCodeAnalyzerErrorsStatus(@NotNull DaemonCodeAnalyzerStatus status,
                                                  @NotNull SeverityRegistrar severityRegistrar) {
  for (int i = 0; i < status.errorCount.length; i++) {
    final HighlightSeverity minSeverity = severityRegistrar.getSeverityByIndex(i);
    if (minSeverity == null) {
      continue;
    }

    int sum = 0;
    for (DomElement element : myDomElements) {
      final DomElementsProblemsHolder holder = myAnnotationsManager.getCachedProblemHolder(element);
      sum += (SeverityRegistrar.getSeverityRegistrar(getProject()).compare(minSeverity, HighlightSeverity.WARNING) >= 0 ? holder
        .getProblems(element, true, true) : holder.getProblems(element, true, minSeverity)).size();
    }
    status.errorCount[i] = sum;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:DomElementsErrorPanel.java

示例2: getAttribute

import com.intellij.codeInsight.daemon.impl.SeverityRegistrar; //导入依赖的package包/类
private SimpleTextAttributes getAttribute(@NotNull final SimpleTextAttributes attrs,
                                          @Nullable HighlightDisplayLevel level) {
  if (level == null) {
    return attrs;
  }

  Map<SimpleTextAttributes, SimpleTextAttributes> highlightMap = myHighlightAttributes.get(level.getSeverity());
  if (highlightMap == null) {
    highlightMap = new HashMap<SimpleTextAttributes, SimpleTextAttributes>();
    myHighlightAttributes.put(level.getSeverity(), highlightMap);
  }

  SimpleTextAttributes result = highlightMap.get(attrs);
  if (result == null) {
    final TextAttributesKey attrKey = SeverityRegistrar.getSeverityRegistrar(myProject).getHighlightInfoTypeBySeverity(level.getSeverity()).getAttributesKey();
    TextAttributes textAttrs = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(attrKey);
    textAttrs = TextAttributes.merge(attrs.toTextAttributes(), textAttrs);
    result = SimpleTextAttributes.fromTextAttributes(textAttrs);
    highlightMap.put(attrs, result);
  }

  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:ComponentTree.java

示例3: fillDaemonCodeAnalyzerErrorsStatus

import com.intellij.codeInsight.daemon.impl.SeverityRegistrar; //导入依赖的package包/类
@Override
protected void fillDaemonCodeAnalyzerErrorsStatus(DaemonCodeAnalyzerStatus status,
                                                  boolean fillErrorsCount,
                                                  SeverityRegistrar severityRegistrar) {
  for (int i = 0; i < status.errorCount.length; i++) {
    final HighlightSeverity minSeverity = severityRegistrar.getSeverityByIndex(i);
    if (minSeverity == null) {
      continue;
    }

    int sum = 0;
    for (DomElement element : myDomElements) {
      final DomElementsProblemsHolder holder = myAnnotationsManager.getCachedProblemHolder(element);
      sum += (SeverityUtil.getSeverityRegistrar(getProject()).compare(minSeverity, HighlightSeverity.WARNING) >= 0 ? holder
        .getProblems(element, true, true) : holder.getProblems(element, true, minSeverity)).size();
    }
    status.errorCount[i] = sum;
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:DomElementsErrorPanel.java

示例4: getAttribute

import com.intellij.codeInsight.daemon.impl.SeverityRegistrar; //导入依赖的package包/类
private SimpleTextAttributes getAttribute(@NotNull final SimpleTextAttributes attrs, @Nullable HighlightDisplayLevel level)
{
	if(level == null)
	{
		return attrs;
	}

	Map<SimpleTextAttributes, SimpleTextAttributes> highlightMap = myHighlightAttributes.get(level.getSeverity());
	if(highlightMap == null)
	{
		highlightMap = new HashMap<SimpleTextAttributes, SimpleTextAttributes>();
		myHighlightAttributes.put(level.getSeverity(), highlightMap);
	}

	SimpleTextAttributes result = highlightMap.get(attrs);
	if(result == null)
	{
		final TextAttributesKey attrKey = SeverityRegistrar.getSeverityRegistrar(myProject).getHighlightInfoTypeBySeverity(level.getSeverity()).getAttributesKey();
		TextAttributes textAttrs = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(attrKey);
		textAttrs = TextAttributes.merge(attrs.toTextAttributes(), textAttrs);
		result = SimpleTextAttributes.fromTextAttributes(textAttrs);
		highlightMap.put(attrs, result);
	}

	return result;
}
 
开发者ID:consulo,项目名称:consulo-ui-designer,代码行数:27,代码来源:ComponentTree.java

示例5: fillDaemonCodeAnalyzerErrorsStatus

import com.intellij.codeInsight.daemon.impl.SeverityRegistrar; //导入依赖的package包/类
@Override
protected void fillDaemonCodeAnalyzerErrorsStatus(@NotNull DaemonCodeAnalyzerStatus status, @NotNull SeverityRegistrar severityRegistrar)
{
	for(int i = 0; i < status.errorCount.length; i++)
	{
		final HighlightSeverity minSeverity = severityRegistrar.getSeverityByIndex(i);
		if(minSeverity == null)
		{
			continue;
		}

		int sum = 0;
		for(DomElement element : myDomElements)
		{
			final DomElementsProblemsHolder holder = myAnnotationsManager.getCachedProblemHolder(element);
			sum += (SeverityRegistrar.getSeverityRegistrar(getProject()).compare(minSeverity, HighlightSeverity.WARNING) >= 0 ? holder
					.getProblems(element, true, true) : holder.getProblems(element, true, minSeverity)).size();
		}
		status.errorCount[i] = sum;
	}
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:22,代码来源:DomElementsErrorPanel.java

示例6: ColorPreviewPanel

import com.intellij.codeInsight.daemon.impl.SeverityRegistrar; //导入依赖的package包/类
public ColorPreviewPanel() {
    final EditorFactory editorFactory = EditorFactory.getInstance();
    myEditor = (EditorEx) editorFactory.createViewer(editorFactory.createDocument(""));

    final EditorSettings settings = myEditor.getSettings();
    settings.setLineNumbersShown(true);
    settings.setWhitespacesShown(true);
    settings.setLineMarkerAreaShown(false);
    settings.setIndentGuidesShown(false);
    settings.setFoldingOutlineShown(false);
    settings.setAdditionalColumnsCount(0);
    settings.setAdditionalLinesCount(0);
    settings.setRightMarginShown(true);
    settings.setRightMargin(60);

    /** {@link FontEditorPreview#installTrafficLights(EditorEx)} */
    TrafficLightRenderer renderer = new TrafficLightRenderer(null, null, null) {

        private final DaemonCodeAnalyzerStatus status = new DaemonCodeAnalyzerStatus();

        {
            status.errorAnalyzingFinished = true;
            status.errorCount = new int[]{ 0 };
        }

        @NotNull
        @Override
        protected DaemonCodeAnalyzerStatus getDaemonCodeAnalyzerStatus(
                @NotNull SeverityRegistrar severityRegistrar) {
            return status;
        }
    };

    Disposer.register((Disposable) myEditor.getCaretModel(), renderer);
    EditorMarkupModel markupModel = (EditorMarkupModel) myEditor.getMarkupModel();
    markupModel.setErrorStripeRenderer(renderer);
    markupModel.setErrorStripeVisible(true);
}
 
开发者ID:huoguangjin,项目名称:MultiHighlight,代码行数:39,代码来源:ColorPreviewPanel.java

示例7: apply

import com.intellij.codeInsight.daemon.impl.SeverityRegistrar; //导入依赖的package包/类
@Override
public void apply(@NotNull PsiFile file, StylintAnnotationResult annotationResult, @NotNull AnnotationHolder holder) {
    if (annotationResult == null) {
        return;
    }
    InspectionProjectProfileManager inspectionProjectProfileManager = InspectionProjectProfileManager.getInstance(file.getProject());
    SeverityRegistrar severityRegistrar = inspectionProjectProfileManager.getSeverityRegistrar();
    HighlightDisplayKey inspectionKey = getHighlightDisplayKeyByClass();
    EditorColorsScheme colorsScheme = annotationResult.input.colorsScheme;

    Document document = PsiDocumentManager.getInstance(file.getProject()).getDocument(file);
    if (document == null) {
        return;
    }

    if (annotationResult.fileLevel != null) {
        Annotation annotation = holder.createWarningAnnotation(file, annotationResult.fileLevel);
        annotation.registerFix(new EditSettingsAction(new StylintSettingsPage(file.getProject())));
        annotation.setFileLevelAnnotation(true);
        return;
    }

    // TODO consider adding a fix to edit configuration file
    if (annotationResult.result == null || annotationResult.result.lint == null || annotationResult.result.lint.isEmpty()) {
        return;
    }
    List<Lint.Issue> issues = annotationResult.result.lint;
    if (issues == null) {
        return;
    }
    StylintProjectComponent component = annotationResult.input.project.getComponent(StylintProjectComponent.class);
    int tabSize = 4;
    for (Lint.Issue issue : issues) {
        HighlightSeverity severity = getHighlightSeverity(issue, component.treatAsWarnings);
        TextAttributes forcedTextAttributes = AnnotatorUtils.getTextAttributes(colorsScheme, severityRegistrar, severity);
        createAnnotation(holder, file, document, issue, "Stylint: ", tabSize, severity, forcedTextAttributes, inspectionKey, component);
    }
}
 
开发者ID:sertae,项目名称:stylint-plugin,代码行数:39,代码来源:StylintExternalAnnotator.java

示例8: getTextAttributes

import com.intellij.codeInsight.daemon.impl.SeverityRegistrar; //导入依赖的package包/类
@NotNull
public static TextAttributes getTextAttributes(@Nullable EditorColorsScheme editorColorsScheme, @NotNull SeverityRegistrar severityRegistrar, @NotNull HighlightSeverity severity) {
    TextAttributes textAttributes = severityRegistrar.getTextAttributesBySeverity(severity);
    if (textAttributes != null) {
        return textAttributes;
    }
    EditorColorsScheme colorsScheme = getColorsScheme(editorColorsScheme);
    HighlightInfoType.HighlightInfoTypeImpl infoType = severityRegistrar.getHighlightInfoTypeBySeverity(severity);
    TextAttributesKey key = infoType.getAttributesKey();
    return colorsScheme.getAttributes(key);
}
 
开发者ID:sertae,项目名称:stylint-plugin,代码行数:12,代码来源:AnnotatorUtils.java

示例9: apply

import com.intellij.codeInsight.daemon.impl.SeverityRegistrar; //导入依赖的package包/类
@Override
    public void apply(@NotNull PsiFile file, ExternalLintAnnotationResult<LintResult> annotationResult, @NotNull AnnotationHolder holder) {
        if (annotationResult == null) {
            return;
        }
        InspectionProjectProfileManager inspectionProjectProfileManager = InspectionProjectProfileManager.getInstance(file.getProject());
        SeverityRegistrar severityRegistrar = inspectionProjectProfileManager.getSeverityRegistrar();
//        HighlightDisplayKey inspectionKey = getHighlightDisplayKeyByClass();
//        HighlightSeverity severity = InspectionUtil.getSeverity(inspectionProjectProfileManager, inspectionKey, file);
        EditorColorsScheme colorsScheme = annotationResult.input.colorsScheme;

        Document document = PsiDocumentManager.getInstance(file.getProject()).getDocument(file);
        if (document == null) {
            return;
        }
        SassLintProjectComponent component = annotationResult.input.project.getComponent(SassLintProjectComponent.class);
        for (SassLint.Issue warn : annotationResult.result.sassLint.file.errors) {
            HighlightSeverity severity = getHighlightSeverity(warn, component.treatAsWarnings);
            TextAttributes forcedTextAttributes = InspectionUtil.getTextAttributes(colorsScheme, severityRegistrar, severity);
            Annotation annotation = createAnnotation(holder, file, document, warn, severity, forcedTextAttributes, false);
//            if (annotation != null) {
//                int offset = StringUtil.lineColToOffset(document.getText(), warn.line - 1, warn.column);
//                PsiElement lit = PsiUtil.getElementAtOffset(file, offset);
//                BaseActionFix actionFix = Fixes.getFixForRule(warn.rule, lit);
//                if (actionFix != null) {
//                    annotation.registerFix(actionFix, null, inspectionKey);
//                }
//                annotation.registerFix(new SuppressActionFix(warn.rule, lit), null, inspectionKey);
//            }
        }
    }
 
开发者ID:idok,项目名称:sass-lint-plugin,代码行数:32,代码来源:SassLintExternalAnnotator.java

示例10: highlightTypeFromDescriptor

import com.intellij.codeInsight.daemon.impl.SeverityRegistrar; //导入依赖的package包/类
@NotNull
public static HighlightInfoType highlightTypeFromDescriptor(@NotNull ProblemDescriptor problemDescriptor,
                                                            @NotNull HighlightSeverity severity,
                                                            @NotNull SeverityRegistrar severityRegistrar) {
  final ProblemHighlightType highlightType = problemDescriptor.getHighlightType();
  switch (highlightType) {
    case GENERIC_ERROR_OR_WARNING:
      return severityRegistrar.getHighlightInfoTypeBySeverity(severity);
    case LIKE_DEPRECATED:
      return new HighlightInfoType.HighlightInfoTypeImpl(severity, HighlightInfoType.DEPRECATED.getAttributesKey());
    case LIKE_UNKNOWN_SYMBOL:
      if (severity == HighlightSeverity.ERROR) {
        return new HighlightInfoType.HighlightInfoTypeImpl(severity, HighlightInfoType.WRONG_REF.getAttributesKey());
      }
      if (severity == HighlightSeverity.WARNING) {
        return new HighlightInfoType.HighlightInfoTypeImpl(severity, CodeInsightColors.WEAK_WARNING_ATTRIBUTES);
      }
      return severityRegistrar.getHighlightInfoTypeBySeverity(severity);
    case LIKE_UNUSED_SYMBOL:
      return new HighlightInfoType.HighlightInfoTypeImpl(severity, HighlightInfoType.UNUSED_SYMBOL.getAttributesKey());
    case INFO:
      return HighlightInfoType.INFO;
    case WEAK_WARNING:
      return HighlightInfoType.WEAK_WARNING;
    case ERROR:
      return HighlightInfoType.WRONG_REF;
    case GENERIC_ERROR:
      return HighlightInfoType.ERROR;
    case INFORMATION:
      final TextAttributesKey attributes = ((ProblemDescriptorBase)problemDescriptor).getEnforcedTextAttributes();
      if (attributes != null) {
        return new HighlightInfoType.HighlightInfoTypeImpl(HighlightSeverity.INFORMATION, attributes);
      }
      return HighlightInfoType.INFORMATION;
  }
  throw new RuntimeException("Cannot map " + highlightType);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:38,代码来源:ProblemDescriptorUtil.java

示例11: InspectionProjectProfileManagerImpl

import com.intellij.codeInsight.daemon.impl.SeverityRegistrar; //导入依赖的package包/类
public InspectionProjectProfileManagerImpl(@NotNull Project project,
                                           @NotNull InspectionProfileManager inspectionProfileManager,
                                           @NotNull DependencyValidationManager holder,
                                           @NotNull NamedScopeManager localScopesHolder) {
  super(project, inspectionProfileManager, holder);
  myLocalScopesHolder = localScopesHolder;
  mySeverityRegistrar = new SeverityRegistrar(project.getMessageBus());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:InspectionProjectProfileManagerImpl.java

示例12: actionPerformed

import com.intellij.codeInsight.daemon.impl.SeverityRegistrar; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
  final Project project = e.getProject();
  final SeverityRegistrar severityRegistrar = SeverityRegistrar.getSeverityRegistrar(project);
  final Component component = PlatformDataKeys.CONTEXT_COMPONENT.getData(e.getDataContext());
  if (component instanceof JComponent) {
    final SeverityEditorDialog dialog =
      new SeverityEditorDialog((JComponent)component, null, severityRegistrar, false);
    dialog.show();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:SeverityEditorDialogAction.java

示例13: registerProvidedSeverities

import com.intellij.codeInsight.daemon.impl.SeverityRegistrar; //导入依赖的package包/类
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);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:InspectionProfileManagerImpl.java

示例14: getTextAttributeKey

import com.intellij.codeInsight.daemon.impl.SeverityRegistrar; //导入依赖的package包/类
protected static String getTextAttributeKey(@NotNull Project project,
                                            @NotNull HighlightSeverity severity,
                                            @NotNull ProblemHighlightType highlightType) {
  if (highlightType == ProblemHighlightType.LIKE_DEPRECATED) {
    return HighlightInfoType.DEPRECATED.getAttributesKey().getExternalName();
  }
  if (highlightType == ProblemHighlightType.LIKE_UNKNOWN_SYMBOL && severity == HighlightSeverity.ERROR) {
    return HighlightInfoType.WRONG_REF.getAttributesKey().getExternalName();
  }
  if (highlightType == ProblemHighlightType.LIKE_UNUSED_SYMBOL) {
    return HighlightInfoType.UNUSED_SYMBOL.getAttributesKey().getExternalName();
  }
  SeverityRegistrar registrar = InspectionProjectProfileManagerImpl.getInstanceImpl(project).getSeverityRegistrar();
  return registrar.getHighlightInfoTypeBySeverity(severity).getAttributesKey().getExternalName();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:DefaultInspectionToolPresentation.java

示例15: getColor

import com.intellij.codeInsight.daemon.impl.SeverityRegistrar; //导入依赖的package包/类
private  Color getColor(HighlightSeverity severity) {
  if (SeverityRegistrar.getSeverityRegistrar(myProject).compare(severity, HighlightSeverity.ERROR) >= 0) {
    return LightColors.RED;
  }

  if (SeverityRegistrar.getSeverityRegistrar(myProject).compare(severity, HighlightSeverity.WARNING) >= 0) {
    return LightColors.YELLOW;
  }

  return LightColors.GREEN;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:FileLevelIntentionComponent.java


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