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


Java SeverityProvider类代码示例

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


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

示例1: readExternal

import com.intellij.profile.codeInspection.SeverityProvider; //导入依赖的package包/类
@Override
public void readExternal(@NotNull Element element) {
  super.readExternal(element);

  final String version = element.getAttributeValue(VERSION_TAG);
  if (version == null || !version.equals(VALID_VERSION)) {
    element = InspectionProfileConvertor.convertToNewFormat(element, this);
  }

  final Element highlightElement = element.getChild(USED_LEVELS);
  if (highlightElement != null) {
    // from old profiles
    ((SeverityProvider)getProfileManager()).getOwnSeverityRegistrar().readExternal(highlightElement);
  }

  StringInterner interner = new StringInterner();
  for (Element toolElement : element.getChildren(INSPECTION_TOOL_TAG)) {
    // make clone to avoid retaining memory via o.parent pointers
    toolElement = toolElement.clone();
    JDOMUtil.internElement(toolElement, interner);
    myUninstalledInspectionsSettings.put(toolElement.getAttributeValue(CLASS_TAG), toolElement);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:InspectionProfileImpl.java

示例2: processElement

import com.intellij.profile.codeInspection.SeverityProvider; //导入依赖的package包/类
protected boolean processElement(final Element option, final String name) {
  if (name.equals(DISPLAY_LEVEL_MAP_OPTION)) {
    final Element levelMap = option.getChild(VALUE_ATT);
    for (final Object o : levelMap.getChildren()) {
      Element e = (Element)o;
      String key = e.getName();
      String levelName = e.getAttributeValue(LEVEL_ATT);
      HighlightSeverity severity = ((SeverityProvider)myManager).getSeverityRegistrar().getSeverity(levelName);
      HighlightDisplayLevel level = severity == null ? null : HighlightDisplayLevel.find(severity);
      if (level == null) continue;
      myDisplayLevelMap.put(key, level);
    }
    return true;
  }
  return false;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:InspectionProfileConvertor.java

示例3: getErrorLevel

import com.intellij.profile.codeInspection.SeverityProvider; //导入依赖的package包/类
@Override
public HighlightDisplayLevel getErrorLevel(@NotNull HighlightDisplayKey inspectionToolKey, PsiElement element) {
  Project project = element == null ? null : element.getProject();
  final ToolsImpl tools = getTools(inspectionToolKey.toString(), project);
  HighlightDisplayLevel level = tools != null ? tools.getLevel(element) : HighlightDisplayLevel.WARNING;
  if (!((SeverityProvider)getProfileManager()).getOwnSeverityRegistrar().isSeverityValid(level.getSeverity().getName())) {
    level = HighlightDisplayLevel.WARNING;
    setErrorLevel(inspectionToolKey, level, project);
  }
  return level;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:InspectionProfileImpl.java

示例4: compoundPopup

import com.intellij.profile.codeInspection.SeverityProvider; //导入依赖的package包/类
private JPopupMenu compoundPopup() {
  final DefaultActionGroup group = new DefaultActionGroup();
  final SeverityRegistrar severityRegistrar = ((SeverityProvider)mySelectedProfile.getProfileManager()).getOwnSeverityRegistrar();
  TreeSet<HighlightSeverity> severities = new TreeSet<HighlightSeverity>(severityRegistrar);
  severities.add(HighlightSeverity.ERROR);
  severities.add(HighlightSeverity.WARNING);
  severities.add(HighlightSeverity.WEAK_WARNING);
  final Collection<SeverityRegistrar.SeverityBasedTextAttributes> infoTypes =
    SeverityUtil.getRegisteredHighlightingInfoTypes(severityRegistrar);
  for (SeverityRegistrar.SeverityBasedTextAttributes info : infoTypes) {
    severities.add(info.getSeverity());
  }
  for (HighlightSeverity severity : severities) {
    final HighlightDisplayLevel level = HighlightDisplayLevel.find(severity);
    group.add(new AnAction(renderSeverity(severity), renderSeverity(severity), level.getIcon()) {
      @Override
      public void actionPerformed(@NotNull AnActionEvent e) {
        setNewHighlightingLevel(level);
      }

      @Override
      public boolean isDumbAware() {
        return true;
      }
    });
  }
  group.add(Separator.getInstance());
  ActionPopupMenu menu = ActionManager.getInstance().createActionPopupMenu(ActionPlaces.UNKNOWN, group);
  return menu.getComponent();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:SingleInspectionProfilePanel.java

示例5: create

import com.intellij.profile.codeInspection.SeverityProvider; //导入依赖的package包/类
public static SeverityRenderer create(final InspectionProfileImpl inspectionProfile, @Nullable final Runnable onClose) {
  final SortedSet<HighlightSeverity> severities =
    LevelChooserAction.getSeverities(((SeverityProvider)inspectionProfile.getProfileManager()).getOwnSeverityRegistrar());
  return new SeverityRenderer(ContainerUtil.map2Array(severities, new SeverityState[severities.size()], new Function<HighlightSeverity, SeverityState>() {
    @Override
    public SeverityState fun(HighlightSeverity severity) {
      return new SeverityState(severity, true, false);
    }
  }), onClose);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:SeverityRenderer.java

示例6: InspectionFilterAction

import com.intellij.profile.codeInspection.SeverityProvider; //导入依赖的package包/类
public InspectionFilterAction(final InspectionProfileImpl profile,
                              final InspectionsFilter inspectionsFilter,
                              final Project project) {
  super("Filter Inspections", true);
  myInspectionsFilter = inspectionsFilter;
  mySeverityRegistrar = ((SeverityProvider)profile.getProfileManager()).getOwnSeverityRegistrar();
  getTemplatePresentation().setIcon(AllIcons.General.Filter);
  tune(profile, project);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:InspectionFilterAction.java

示例7: getErrorLevel

import com.intellij.profile.codeInspection.SeverityProvider; //导入依赖的package包/类
@Override
public HighlightDisplayLevel getErrorLevel(@NotNull HighlightDisplayKey inspectionToolKey, PsiElement element) {
  Project project = element == null ? null : element.getProject();
  final ToolsImpl tools = getTools(inspectionToolKey.toString(), project);
  HighlightDisplayLevel level = tools != null ? tools.getLevel(element) : HighlightDisplayLevel.WARNING;
  if (!((SeverityProvider)getProfileManager()).getOwnSeverityRegistrar().isSeverityValid(level.getSeverity().toString())) {
    level = HighlightDisplayLevel.WARNING;
    setErrorLevel(inspectionToolKey, level, project);
  }
  return level;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:12,代码来源:InspectionProfileImpl.java

示例8: compoundPopup

import com.intellij.profile.codeInspection.SeverityProvider; //导入依赖的package包/类
private JPopupMenu compoundPopup() {
  final DefaultActionGroup group = new DefaultActionGroup();
  final SeverityRegistrar severityRegistrar = ((SeverityProvider)mySelectedProfile.getProfileManager()).getOwnSeverityRegistrar();
  TreeSet<HighlightSeverity> severities = new TreeSet<HighlightSeverity>(severityRegistrar);
  severities.add(HighlightSeverity.ERROR);
  severities.add(HighlightSeverity.WARNING);
  severities.add(HighlightSeverity.WEAK_WARNING);
  final Collection<SeverityRegistrar.SeverityBasedTextAttributes> infoTypes =
    SeverityUtil.getRegisteredHighlightingInfoTypes(severityRegistrar);
  for (SeverityRegistrar.SeverityBasedTextAttributes info : infoTypes) {
    severities.add(info.getSeverity());
  }
  for (HighlightSeverity severity : severities) {
    final HighlightDisplayLevel level = HighlightDisplayLevel.find(severity);
    group.add(new AnAction(renderSeverity(severity), renderSeverity(severity), level.getIcon()) {
      @Override
      public void actionPerformed(AnActionEvent e) {
        setNewHighlightingLevel(level);
      }
    });
  }
  group.add(Separator.getInstance());
  group.add(new MyAddScopeAction());
  group.add(new MyDeleteScopeAction());
  ActionPopupMenu menu = ActionManager.getInstance().createActionPopupMenu(ActionPlaces.UNKNOWN, group);
  return menu.getComponent();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:28,代码来源:SingleInspectionProfilePanel.java

示例9: getErrorLevel

import com.intellij.profile.codeInspection.SeverityProvider; //导入依赖的package包/类
@Override
public HighlightDisplayLevel getErrorLevel(@Nonnull HighlightDisplayKey inspectionToolKey, PsiElement element) {
  Project project = element == null ? null : element.getProject();
  final ToolsImpl tools = getTools(inspectionToolKey.toString(), project);
  HighlightDisplayLevel level = tools != null ? tools.getLevel(element) : HighlightDisplayLevel.WARNING;
  if (!((SeverityProvider)getProfileManager()).getOwnSeverityRegistrar().isSeverityValid(level.getSeverity().getName())) {
    level = HighlightDisplayLevel.WARNING;
    setErrorLevel(inspectionToolKey, level, project);
  }
  return level;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:12,代码来源:InspectionProfileImpl.java

示例10: readExternal

import com.intellij.profile.codeInspection.SeverityProvider; //导入依赖的package包/类
@Override
public void readExternal(@Nonnull Element element) throws InvalidDataException {
  super.readExternal(element);

  if (!ApplicationManager.getApplication().isUnitTestMode() || myBaseProfile == null) {
    // todo remove this strange side effect
    myBaseProfile = getDefaultProfile();
  }
  final String version = element.getAttributeValue(VERSION_TAG);
  if (version == null || !version.equals(VALID_VERSION)) {
    element = InspectionProfileConvertor.convertToNewFormat(element, this);
  }

  final Element highlightElement = element.getChild(USED_LEVELS);
  if (highlightElement != null) {
    // from old profiles
    ((SeverityProvider)getProfileManager()).getOwnSeverityRegistrar().readExternal(highlightElement);
  }

  StringInterner interner = new StringInterner();
  for (Element toolElement : element.getChildren(INSPECTION_TOOL_TAG)) {
    // make clone to avoid retaining memory via o.parent pointers
    toolElement = toolElement.clone();
    JDOMUtil.internStringsInElement(toolElement, interner);
    myUninstalledInspectionsSettings.put(toolElement.getAttributeValue(CLASS_TAG), toolElement);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:28,代码来源:InspectionProfileImpl.java

示例11: compoundPopup

import com.intellij.profile.codeInspection.SeverityProvider; //导入依赖的package包/类
private JPopupMenu compoundPopup() {
  final DefaultActionGroup group = new DefaultActionGroup();
  final SeverityRegistrar severityRegistrar = ((SeverityProvider)mySelectedProfile.getProfileManager()).getOwnSeverityRegistrar();
  TreeSet<HighlightSeverity> severities = new TreeSet<HighlightSeverity>(severityRegistrar);
  severities.add(HighlightSeverity.ERROR);
  severities.add(HighlightSeverity.WARNING);
  severities.add(HighlightSeverity.WEAK_WARNING);
  final Collection<SeverityRegistrar.SeverityBasedTextAttributes> infoTypes =
          SeverityUtil.getRegisteredHighlightingInfoTypes(severityRegistrar);
  for (SeverityRegistrar.SeverityBasedTextAttributes info : infoTypes) {
    severities.add(info.getSeverity());
  }
  for (HighlightSeverity severity : severities) {
    final HighlightDisplayLevel level = HighlightDisplayLevel.find(severity);
    group.add(new AnAction(renderSeverity(severity), renderSeverity(severity), level.getIcon()) {
      @Override
      public void actionPerformed(@Nonnull AnActionEvent e) {
        setNewHighlightingLevel(level);
      }

      @Override
      public boolean isDumbAware() {
        return true;
      }
    });
  }
  group.add(AnSeparator.getInstance());
  ActionPopupMenu menu = ActionManager.getInstance().createActionPopupMenu(ActionPlaces.UNKNOWN, group);
  return menu.getComponent();
}
 
开发者ID:consulo,项目名称:consulo,代码行数:31,代码来源:SingleInspectionProfilePanel.java

示例12: create

import com.intellij.profile.codeInspection.SeverityProvider; //导入依赖的package包/类
public static SeverityRenderer create(final InspectionProfileImpl inspectionProfile, @Nullable final Runnable onClose) {
  final SortedSet<HighlightSeverity> severities =
          LevelChooserAction.getSeverities(((SeverityProvider)inspectionProfile.getProfileManager()).getOwnSeverityRegistrar());
  return new SeverityRenderer(ContainerUtil.map2Array(severities, new SeverityState[severities.size()], new Function<HighlightSeverity, SeverityState>() {
    @Override
    public SeverityState fun(HighlightSeverity severity) {
      return new SeverityState(severity, true, false);
    }
  }), onClose);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:11,代码来源:SeverityRenderer.java

示例13: LevelChooserAction

import com.intellij.profile.codeInspection.SeverityProvider; //导入依赖的package包/类
public LevelChooserAction(final InspectionProfileImpl profile) {
  this(((SeverityProvider)profile.getProfileManager()).getOwnSeverityRegistrar());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:LevelChooserAction.java

示例14: readExternal

import com.intellij.profile.codeInspection.SeverityProvider; //导入依赖的package包/类
void readExternal(@NotNull Element toolElement, @NotNull InspectionProfile profile) throws InvalidDataException {
  final String levelName = toolElement.getAttributeValue(LEVEL_ATTRIBUTE);
  final ProfileManager profileManager = profile.getProfileManager();
  final SeverityRegistrar registrar = ((SeverityProvider)profileManager).getOwnSeverityRegistrar();
  HighlightDisplayLevel level = levelName != null ? HighlightDisplayLevel.find(registrar.getSeverity(levelName)) : null;
  if (level == null || level == HighlightDisplayLevel.DO_NOT_SHOW) {//from old profiles
    level = HighlightDisplayLevel.WARNING;
  }
  myDefaultState.setLevel(level);
  final String enabled = toolElement.getAttributeValue(ENABLED_ATTRIBUTE);
  final boolean isEnabled = enabled != null && Boolean.parseBoolean(enabled);
  myEnabled = isEnabled;

  final String enabledTool = toolElement.getAttributeValue(ENABLED_BY_DEFAULT_ATTRIBUTE);
  myDefaultState.setEnabled(enabledTool != null ? Boolean.parseBoolean(enabledTool) : isEnabled);
  final InspectionToolWrapper toolWrapper = myDefaultState.getTool();

  final List scopeElements = toolElement.getChildren(ProfileEx.SCOPE);
  for (Object sO : scopeElements) {
    final Element scopeElement = (Element)sO;
    final String scopeName = scopeElement.getAttributeValue(ProfileEx.NAME);
    if (scopeName == null) {
      continue;
    }
    final NamedScopesHolder scopesHolder = profileManager.getScopesManager();
    NamedScope namedScope = null;
    if (scopesHolder != null) {
      namedScope = scopesHolder.getScope(scopeName);
    }
    final String errorLevel = scopeElement.getAttributeValue(LEVEL_ATTRIBUTE);
    final String enabledInScope = scopeElement.getAttributeValue(ENABLED_ATTRIBUTE);
    final InspectionToolWrapper copyToolWrapper = toolWrapper.createCopy();
  // check if unknown children exists
    if (scopeElement.getAttributes().size() > 3 || !scopeElement.getChildren().isEmpty()) {
      copyToolWrapper.getTool().readSettings(scopeElement);
    }
    HighlightDisplayLevel scopeLevel = errorLevel != null ?
                                       HighlightDisplayLevel.find(registrar.getSeverity(errorLevel)) : null;
    if (scopeLevel == null) {
      scopeLevel = level;
    }
    if (namedScope != null) {
      addTool(namedScope, copyToolWrapper, enabledInScope != null && Boolean.parseBoolean(enabledInScope), scopeLevel);
    }
    else {
      addTool(scopeName, copyToolWrapper, enabledInScope != null && Boolean.parseBoolean(enabledInScope), scopeLevel);
    }
  }

  // check if unknown children exists
  if (toolElement.getAttributes().size() > 4 || toolElement.getChildren().size() > scopeElements.size()) {
    toolWrapper.getTool().readSettings(toolElement);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:55,代码来源:ToolsImpl.java


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