• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java HighlightDisplayKey类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: addError

import com.intellij.codeInsight.daemon.HighlightDisplayKey; //导入依赖的package包/类
public void addError(@NotNull final String inspectionId, final IComponent component, @Nullable IProperty prop,
                     @NotNull String errorMessage,
                     EditorQuickFixProvider... editorQuickFixProviders) {
  if (myResults == null) {
    myResults = new ArrayList<ErrorInfo>();
  }
  List<QuickFix> quickFixes = new ArrayList<QuickFix>();
  for (EditorQuickFixProvider provider : editorQuickFixProviders) {
    if (provider != null) {
      quickFixes.add(provider.createQuickFix(myEditor, myComponent));
    }
  }

  final ErrorInfo errorInfo = new ErrorInfo(myComponent, prop == null ? null : prop.getName(), errorMessage,
                                            myProfile.getErrorLevel(HighlightDisplayKey.find(inspectionId), myFormPsiFile),
                                            quickFixes.toArray(new QuickFix[quickFixes.size()]));
  errorInfo.setInspectionId(inspectionId);
  myResults.add(errorInfo);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:FormEditorErrorCollector.java


示例2: testDoNotInstantiateOnSave

import com.intellij.codeInsight.daemon.HighlightDisplayKey; //导入依赖的package包/类
public void testDoNotInstantiateOnSave() throws Exception {
  InspectionProfileImpl profile = new InspectionProfileImpl("profile", InspectionToolRegistrar.getInstance(), InspectionProfileManager.getInstance(), InspectionProfileImpl.getDefaultProfile());
  assertEquals(0, countInitializedTools(profile));
  InspectionToolWrapper[] toolWrappers = profile.getInspectionTools(null);
  assertTrue(toolWrappers.length > 0);
  InspectionToolWrapper toolWrapper = profile.getInspectionTool(new DataFlowInspection().getShortName(), getProject());
  assertNotNull(toolWrapper);
  String id = toolWrapper.getShortName();
  System.out.println(id);
  if (profile.isToolEnabled(HighlightDisplayKey.findById(id))) {
    profile.disableTool(id, getProject());
  }
  else {
    profile.enableTool(id, getProject());
  }
  assertEquals(0, countInitializedTools(profile));
  profile.writeExternal(new Element("profile"));
  List<InspectionToolWrapper> initializedTools = getInitializedTools(profile);
  if (initializedTools.size() > 0) {
    for (InspectionToolWrapper initializedTool : initializedTools) {
      System.out.println(initializedTool.getShortName());
    }
    fail();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:InspectionProfileTest.java


示例3: registerFix

import com.intellij.codeInsight.daemon.HighlightDisplayKey; //导入依赖的package包/类
public void registerFix(@Nullable IntentionAction action,
                        @Nullable List<IntentionAction> options,
                        @Nullable String displayName,
                        @Nullable TextRange fixRange,
                        @Nullable HighlightDisplayKey key) {
  if (action == null) return;
  if (fixRange == null) fixRange = new TextRange(startOffset, endOffset);
  if (quickFixActionRanges == null) {
    quickFixActionRanges = ContainerUtil.createLockFreeCopyOnWriteList();
  }
  IntentionActionDescriptor desc = new IntentionActionDescriptor(action, options, displayName, null, key, getProblemGroup(), getSeverity());
  quickFixActionRanges.add(Pair.create(desc, fixRange));
  fixStartOffset = Math.min (fixStartOffset, fixRange.getStartOffset());
  fixEndOffset = Math.max (fixEndOffset, fixRange.getEndOffset());
  if (action instanceof HintAction) {
    setHint(true);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:HighlightInfo.java


示例4: enableInspectionTool

import com.intellij.codeInsight.daemon.HighlightDisplayKey; //导入依赖的package包/类
public static void enableInspectionTool(@NotNull final Project project, @NotNull final InspectionToolWrapper toolWrapper) {
  final InspectionProfile profile = InspectionProjectProfileManager.getInstance(project).getInspectionProfile();
  final String shortName = toolWrapper.getShortName();
  final HighlightDisplayKey key = HighlightDisplayKey.find(shortName);
  if (key == null) {
    HighlightDisplayKey.register(shortName, toolWrapper.getDisplayName(), toolWrapper.getID());
  }
  InspectionProfileImpl.initAndDo(new Computable() {
    @Override
    public Object compute() {
      InspectionProfileImpl impl = (InspectionProfileImpl)profile;
      InspectionToolWrapper existingWrapper = impl.getInspectionTool(shortName, project);
      if (existingWrapper == null || existingWrapper.isInitialized() != toolWrapper.isInitialized() || toolWrapper.isInitialized() && toolWrapper.getTool() != existingWrapper.getTool()) {
        impl.addTool(project, toolWrapper, new THashMap<String, List<String>>());
      }
      impl.enableTool(shortName, project);
      return null;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:LightPlatformTestCase.java


示例5: getSeverity

import com.intellij.codeInsight.daemon.HighlightDisplayKey; //导入依赖的package包/类
protected HighlightSeverity getSeverity(@NotNull RefElement element) {
  final PsiElement psiElement = element.getPointer().getContainingFile();
  if (psiElement != null) {
    final GlobalInspectionContextImpl context = getContext();
    final String shortName = getSeverityDelegateName();
    final Tools tools = context.getTools().get(shortName);
    if (tools != null) {
      for (ScopeToolState state : tools.getTools()) {
        InspectionToolWrapper toolWrapper = state.getTool();
        if (toolWrapper == getToolWrapper()) {
          return context.getCurrentProfile().getErrorLevel(HighlightDisplayKey.find(shortName), psiElement).getSeverity();
        }
      }
    }

    final InspectionProfile profile = InspectionProjectProfileManager.getInstance(context.getProject()).getInspectionProfile();
    final HighlightDisplayLevel level = profile.getErrorLevel(HighlightDisplayKey.find(shortName), psiElement);
    return level.getSeverity();
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:DefaultInspectionToolPresentation.java


示例6: buildTree

import com.intellij.codeInsight.daemon.HighlightDisplayKey; //导入依赖的package包/类
private boolean buildTree() {
  InspectionProfile profile = myInspectionProfile;
  boolean isGroupedBySeverity = myGlobalInspectionContext.getUIOptions().GROUP_BY_SEVERITY;
  myGroups.clear();
  final Map<String, Tools> tools = myGlobalInspectionContext.getTools();
  boolean resultsFound = false;
  for (Tools currentTools : tools.values()) {
    InspectionToolWrapper defaultToolWrapper = currentTools.getDefaultState().getTool();
    final HighlightDisplayKey key = HighlightDisplayKey.find(defaultToolWrapper.getShortName());
    for (ScopeToolState state : myProvider.getTools(currentTools)) {
      InspectionToolWrapper toolWrapper = state.getTool();
      if (myProvider.checkReportedProblems(myGlobalInspectionContext, toolWrapper)) {
        addTool(toolWrapper, ((InspectionProfileImpl)profile).getErrorLevel(key, state.getScope(myProject), myProject), isGroupedBySeverity);
        resultsFound = true;
      }
    }
  }
  return resultsFound;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:InspectionResultsView.java


示例7: actionPerformed

import com.intellij.codeInsight.daemon.HighlightDisplayKey; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
  final InspectionProjectProfileManager profileManager = InspectionProjectProfileManager.getInstance(myProject);
  final InspectionToolWrapper toolWrapper = myTree.getSelectedToolWrapper();
  InspectionProfile inspectionProfile = myInspectionProfile;
  final boolean profileIsDefined = isProfileDefined();
  if (!profileIsDefined) {
    inspectionProfile = guessProfileToSelect(profileManager);
  }

  if (toolWrapper != null) {
    final HighlightDisplayKey key = HighlightDisplayKey.find(toolWrapper.getShortName()); //do not search for dead code entry point tool
    if (key != null){
      if (new EditInspectionToolsSettingsAction(key).editToolSettings(myProject, (InspectionProfileImpl)inspectionProfile, profileIsDefined)
          && profileIsDefined){
        updateCurrentProfile();
      }
      return;
    }
  }
  if (EditInspectionToolsSettingsAction.editToolSettings(myProject, inspectionProfile, profileIsDefined, null) && profileIsDefined) {
    updateCurrentProfile();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:InspectionResultsView.java


示例8: process

import com.intellij.codeInsight.daemon.HighlightDisplayKey; //导入依赖的package包/类
@Override
public boolean process(Trinity<ProblemDescriptor, LocalInspectionToolWrapper,ProgressIndicator> trinity) {
  ProgressIndicator indicator = trinity.getThird();
  if (indicator.isCanceled()) {
    return false;
  }

  ProblemDescriptor descriptor = trinity.first;
  LocalInspectionToolWrapper tool = trinity.second;
  PsiElement psiElement = descriptor.getPsiElement();
  if (psiElement == null) return true;
  PsiFile file = psiElement.getContainingFile();
  Document thisDocument = documentManager.getDocument(file);

  HighlightSeverity severity = inspectionProfile.getErrorLevel(HighlightDisplayKey.find(tool.getShortName()), file).getSeverity();

  infos.clear();
  createHighlightsForDescriptor(infos, emptyActionRegistered, ilManager, file, thisDocument, tool, severity, descriptor, psiElement);
  for (HighlightInfo info : infos) {
    final EditorColorsScheme colorsScheme = getColorsScheme();
    UpdateHighlightersUtil.addHighlighterToEditorIncrementally(myProject, myDocument, getFile(), myRestrictRange.getStartOffset(), myRestrictRange.getEndOffset(),
                                                               info, colorsScheme, getId(), ranges2markersCache);
  }

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


示例9: getValueAt

import com.intellij.codeInsight.daemon.HighlightDisplayKey; //导入依赖的package包/类
@Nullable
@Override
public Object getValueAt(final Object node, final int column) {
  if (column == TREE_COLUMN) {
    return null;
  }
  final InspectionConfigTreeNode treeNode = (InspectionConfigTreeNode)node;
  final List<HighlightDisplayKey> inspectionsKeys = InspectionsAggregationUtil.getInspectionsKeys(treeNode);
  if (column == SEVERITIES_COLUMN) {
    final MultiColoredHighlightSeverityIconSink sink = new MultiColoredHighlightSeverityIconSink();
    for (final HighlightDisplayKey selectedInspectionsNode : inspectionsKeys) {
      final String toolId = selectedInspectionsNode.toString();
      if (mySettings.getInspectionProfile().getTools(toolId, mySettings.getProject()).isEnabled()) {
        sink.put(mySettings.getInspectionProfile().getToolDefaultState(toolId, mySettings.getProject()),
                 mySettings.getInspectionProfile().getNonDefaultTools(toolId, mySettings.getProject()));
      }
    }
    return sink.constructIcon(mySettings.getInspectionProfile());
  } else if (column == IS_ENABLED_COLUMN) {
    return isEnabled(inspectionsKeys);
  }
  throw new IllegalArgumentException();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:InspectionsConfigTreeTable.java


示例10: addDynamicAnnotation

import com.intellij.codeInsight.daemon.HighlightDisplayKey; //导入依赖的package包/类
private static void addDynamicAnnotation(HighlightInfo info, GrReferenceExpression referenceExpression, HighlightDisplayKey key) {
  final PsiFile containingFile = referenceExpression.getContainingFile();
  if (containingFile != null) {
    VirtualFile file = containingFile.getVirtualFile();
    if (file == null) return;
  }
  else {
    return;
  }

  if (PsiUtil.isCall(referenceExpression)) {
    PsiType[] argumentTypes = PsiUtil.getArgumentTypes(referenceExpression, false);
    if (argumentTypes != null) {
      QuickFixAction.registerQuickFixAction(info, referenceExpression.getTextRange(),
                                            GroovyQuickFixFactory.getInstance().createDynamicMethodFix(referenceExpression,
                                                                                                       argumentTypes), key);
    }
  }
  else {
    QuickFixAction.registerQuickFixAction(info, referenceExpression.getTextRange(), GroovyQuickFixFactory.getInstance().createDynamicPropertyFix(referenceExpression), key);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:GrUnresolvedAccessChecker.java


示例11: collectInspectionFromNodes

import com.intellij.codeInsight.daemon.HighlightDisplayKey; //导入依赖的package包/类
private static void collectInspectionFromNodes(final InspectionConfigTreeNode node,
                                               final Set<HighlightDisplayKey> tools,
                                               final List<InspectionConfigTreeNode> nodes) {
  if (node == null) {
    return;
  }
  nodes.add(node);

  final ToolDescriptors descriptors = node.getDescriptors();
  if (descriptors == null) {
    for (int i = 0; i < node.getChildCount(); i++) {
      collectInspectionFromNodes((InspectionConfigTreeNode)node.getChildAt(i), tools, nodes);
    }
  } else {
    final HighlightDisplayKey key = descriptors.getDefaultDescriptor().getKey();
    tools.add(key);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:InspectionsConfigTreeTable.java


示例12: addRemoveTestsScope

import com.intellij.codeInsight.daemon.HighlightDisplayKey; //导入依赖的package包/类
private void addRemoveTestsScope(Project project, boolean add) {
  final InspectionProjectProfileManager profileManager = InspectionProjectProfileManager.getInstance(project);
  final InspectionProfileImpl profile = (InspectionProfileImpl)profileManager.getInspectionProfile();
  final String shortName = myInspection.getShortName();
  final InspectionToolWrapper tool = profile.getInspectionTool(shortName, project);
  if (tool == null) {
    return;
  }
  final NamedScope namedScope = NamedScopesHolder.getScope(project, "Tests");
  final HighlightDisplayKey key = HighlightDisplayKey.find(shortName);
  final HighlightDisplayLevel level = profile.getErrorLevel(key, namedScope, project);
  if (add) {
    profile.addScope(tool, namedScope, level, false, project);
  }
  else {
    profile.removeScope(shortName, 0, project);
  }
  profile.scopesChanged();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:SuppressForTestsScopeFix.java


示例13: testHighlightStatus_OtherInspections2

import com.intellij.codeInsight.daemon.HighlightDisplayKey; //导入依赖的package包/类
public void testHighlightStatus_OtherInspections2() throws Throwable {
  myElement.setFileDescription(new DomFileDescription<DomElement>(DomElement.class, "a"));
  final MyDomElementsInspection inspection = new MyDomElementsInspection() {

    @Override
    public ProblemDescriptor[] checkFile(@NotNull final PsiFile file, @NotNull final InspectionManager manager,
                                         final boolean isOnTheFly) {
      myAnnotationsManager.appendProblems(myElement, createHolder(), this.getClass());
      return new ProblemDescriptor[0];
    }

    @Override
    public void checkFileElement(final DomFileElement fileElement, final DomElementAnnotationHolder holder) {
    }
  };
  HighlightDisplayKey.register(inspection.getShortName());
  LocalInspectionToolWrapper toolWrapper = new LocalInspectionToolWrapper(inspection);
  myInspectionProfile.setInspectionTools(toolWrapper);
  myInspectionProfile.setEnabled(toolWrapper, false);

  myAnnotationsManager.appendProblems(myElement, createHolder(), MockAnnotatingDomInspection.class);
  assertEquals(DomHighlightStatus.INSPECTIONS_FINISHED, myAnnotationsManager.getHighlightStatus(myElement));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:DomHighlightingLiteTest.java


示例14: getHighlighLevelAndInspection

import com.intellij.codeInsight.daemon.HighlightDisplayKey; //导入依赖的package包/类
@Nullable
public static Pair<AndroidLintInspectionBase, HighlightDisplayLevel> getHighlighLevelAndInspection(@NotNull Project project,
                                                                                                   @NotNull Issue issue,
                                                                                                   @NotNull PsiElement context) {
  final String inspectionShortName = AndroidLintInspectionBase.getInspectionShortNameByIssue(project, issue);
  if (inspectionShortName == null) {
    return null;
  }

  final HighlightDisplayKey key = HighlightDisplayKey.find(inspectionShortName);
  if (key == null) {
    return null;
  }

  final InspectionProfile profile = InspectionProjectProfileManager.getInstance(context.getProject()).getInspectionProfile();
  if (!profile.isToolEnabled(key, context)) {
    return null;
  }

  final AndroidLintInspectionBase inspection = (AndroidLintInspectionBase)profile.getUnwrappedTool(inspectionShortName, context);
  if (inspection == null) return null;
  final HighlightDisplayLevel errorLevel = profile.getErrorLevel(key, context);
  return Pair.create(inspection,
                     errorLevel != null ? errorLevel : HighlightDisplayLevel.WARNING);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:AndroidLintUtil.java


示例15: getIssuesFromInspections

import com.intellij.codeInsight.daemon.HighlightDisplayKey; //导入依赖的package包/类
@NotNull
static List<Issue> getIssuesFromInspections(@NotNull Project project, @Nullable PsiElement context) {
  final List<Issue> result = new ArrayList<Issue>();
  final IssueRegistry fullRegistry = new IntellijLintIssueRegistry();

  for (Issue issue : fullRegistry.getIssues()) {
    final String inspectionShortName = AndroidLintInspectionBase.getInspectionShortNameByIssue(project, issue);
    if (inspectionShortName == null) {
      continue;
    }

    final HighlightDisplayKey key = HighlightDisplayKey.find(inspectionShortName);
    if (key == null) {
      continue;
    }

    final InspectionProfile profile = InspectionProjectProfileManager.getInstance(project).getInspectionProfile();
    final boolean enabled = context != null ? profile.isToolEnabled(key, context) : profile.isToolEnabled(key);

    if (!enabled) {
      continue;
    }
    result.add(issue);
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:AndroidLintExternalAnnotator.java


示例16: apply

import com.intellij.codeInsight.daemon.HighlightDisplayKey; //导入依赖的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


示例17: registerReferenceFixes

import com.intellij.codeInsight.daemon.HighlightDisplayKey; //导入依赖的package包/类
private static void registerReferenceFixes(GrReferenceExpression refExpr,
                                           HighlightInfo info,
                                           boolean compileStatic,
                                           final HighlightDisplayKey key) {
  PsiClass targetClass = QuickfixUtil.findTargetClass(refExpr, compileStatic);
  if (targetClass == null) return;

  if (!compileStatic) {
    addDynamicAnnotation(info, refExpr, key);
  }

  if (!(targetClass instanceof SyntheticElement) || (targetClass instanceof GroovyScriptClass)) {

    QuickFixAction.registerQuickFixAction(info, GroovyQuickFixFactory.getInstance().createCreateFieldFromUsageFix(refExpr), key);

    if (PsiUtil.isAccessedForReading(refExpr)) {
      QuickFixAction.registerQuickFixAction(info, GroovyQuickFixFactory.getInstance().createCreateGetterFromUsageFix(refExpr, targetClass), key);
    }
    if (PsiUtil.isLValue(refExpr)) {
      QuickFixAction.registerQuickFixAction(info, GroovyQuickFixFactory.getInstance().createCreateSetterFromUsageFix(refExpr), key);
    }

    if (refExpr.getParent() instanceof GrCall && refExpr.getParent() instanceof GrExpression) {
      QuickFixAction.registerQuickFixAction(info, GroovyQuickFixFactory.getInstance().createCreateMethodFromUsageFix(refExpr), key);
    }
  }

  if (!refExpr.isQualified()) {
    GrVariableDeclarationOwner owner = PsiTreeUtil.getParentOfType(refExpr, GrVariableDeclarationOwner.class);
    if (!(owner instanceof GroovyFileBase) || ((GroovyFileBase)owner).isScript()) {
      QuickFixAction.registerQuickFixAction(info, GroovyQuickFixFactory.getInstance().createCreateLocalVariableFromUsageFix(refExpr, owner), key);
    }
    if (PsiTreeUtil.getParentOfType(refExpr, GrMethod.class) != null) {
      QuickFixAction.registerQuickFixAction(info, GroovyQuickFixFactory.getInstance().createCreateParameterFromUsageFix(refExpr), key);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:38,代码来源:GrUnresolvedAccessChecker.java


示例18: getSuppressActions

import com.intellij.codeInsight.daemon.HighlightDisplayKey; //导入依赖的package包/类
@NotNull
@Override
public SuppressQuickFix[] getSuppressActions(@Nullable PsiElement element, @NotNull String toolId) {
  final HighlightDisplayKey displayKey = HighlightDisplayKey.findById(toolId);
  LOG.assertTrue(displayKey != null, "Display key is null for `" + toolId + "` tool");
  return createBatchSuppressActions(displayKey);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:SuppressManagerImpl.java


示例19: PostHighlightingVisitor

import com.intellij.codeInsight.daemon.HighlightDisplayKey; //导入依赖的package包/类
PostHighlightingVisitor(@NotNull PsiFile file,
                        @NotNull Document document,
                        @NotNull RefCountHolder refCountHolder) throws ProcessCanceledException {
  myProject = file.getProject();
  myFile = file;
  myDocument = document;

  myCurrentEntryIndex = -1;
  myLanguageLevel = PsiUtil.getLanguageLevel(file);

  final FileViewProvider viewProvider = myFile.getViewProvider();

  ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
  VirtualFile virtualFile = viewProvider.getVirtualFile();
  myInLibrary = fileIndex.isInLibraryClasses(virtualFile) || fileIndex.isInLibrarySource(virtualFile);

  myRefCountHolder = refCountHolder;


  ApplicationManager.getApplication().assertReadAccessAllowed();

  InspectionProfile profile = InspectionProjectProfileManager.getInstance(myProject).getInspectionProfile();

  myDeadCodeKey = HighlightDisplayKey.find(UnusedDeclarationInspectionBase.SHORT_NAME);

  myDeadCodeInspection = (UnusedDeclarationInspectionBase)profile.getUnwrappedTool(UnusedDeclarationInspectionBase.SHORT_NAME, myFile);
  LOG.assertTrue(ApplicationManager.getApplication().isUnitTestMode() || myDeadCodeInspection != null);

  myUnusedSymbolInspection = myDeadCodeInspection != null ? myDeadCodeInspection.getSharedLocalInspectionTool() : null;

  myDeadCodeInfoType = myDeadCodeKey == null
                       ? HighlightInfoType.UNUSED_SYMBOL
                       : new HighlightInfoType.HighlightInfoTypeImpl(profile.getErrorLevel(myDeadCodeKey, myFile).getSeverity(),
                                                                     HighlightInfoType.UNUSED_SYMBOL.getAttributesKey());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:36,代码来源:PostHighlightingVisitor.java


示例20: isUnusedImportEnabled

import com.intellij.codeInsight.daemon.HighlightDisplayKey; //导入依赖的package包/类
private boolean isUnusedImportEnabled(HighlightDisplayKey unusedImportKey) {
  InspectionProfile profile = InspectionProjectProfileManager.getInstance(myProject).getInspectionProfile();
  if (profile.isToolEnabled(unusedImportKey, myFile) &&
      myFile instanceof PsiJavaFile &&
      HighlightingLevelManager.getInstance(myProject).shouldHighlight(myFile)) {
    return true;
  }
  final ImplicitUsageProvider[] implicitUsageProviders = Extensions.getExtensions(ImplicitUsageProvider.EP_NAME);
  for (ImplicitUsageProvider provider : implicitUsageProviders) {
    if (provider instanceof UnusedImportProvider && ((UnusedImportProvider)provider).isUnusedImportEnabled(myFile)) return true;
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:PostHighlightingVisitor.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java InvalidMediaTypeException类代码示例发布时间:2022-05-21
下一篇:
Java MethodInfo类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap