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


Java HighlightDisplayKey.find方法代码示例

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


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

示例1: registerFixesForUnusedParameter

import com.intellij.codeInsight.daemon.HighlightDisplayKey; //导入方法依赖的package包/类
@Override
public void registerFixesForUnusedParameter(@NotNull PsiParameter parameter, @NotNull Object highlightInfo) {
  Project myProject = parameter.getProject();
  InspectionProfile profile = InspectionProjectProfileManager.getInstance(myProject).getInspectionProfile();
  UnusedParametersInspection unusedParametersInspection =
    (UnusedParametersInspection)profile.getUnwrappedTool(UnusedSymbolLocalInspectionBase.UNUSED_PARAMETERS_SHORT_NAME, parameter);
  LOG.assertTrue(ApplicationManager.getApplication().isUnitTestMode() || unusedParametersInspection != null);
  List<IntentionAction> options = new ArrayList<IntentionAction>();
  HighlightDisplayKey myUnusedSymbolKey = HighlightDisplayKey.find(UnusedSymbolLocalInspectionBase.SHORT_NAME);
  options.addAll(IntentionManager.getInstance().getStandardIntentionOptions(myUnusedSymbolKey, parameter));
  if (unusedParametersInspection != null) {
    SuppressQuickFix[] batchSuppressActions = unusedParametersInspection.getBatchSuppressActions(parameter);
    Collections.addAll(options, SuppressIntentionActionFromFix.convertBatchToSuppressIntentionActions(batchSuppressActions));
  }
  //need suppress from Unused Parameters but settings from Unused Symbol
  QuickFixAction.registerQuickFixAction((HighlightInfo)highlightInfo, new SafeDeleteFix(parameter),
                                        options, HighlightDisplayKey.getDisplayNameByKey(myUnusedSymbolKey));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:QuickFixFactoryImpl.java

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: getSuppressActions

import com.intellij.codeInsight.daemon.HighlightDisplayKey; //导入方法依赖的package包/类
@NotNull
@Override
public SuppressIntentionAction[] getSuppressActions(final PsiElement element) {
  String shortName = getShortName();
  HighlightDisplayKey key = HighlightDisplayKey.find(shortName);
  if (key == null) {
    throw new AssertionError("HighlightDisplayKey.find(" + shortName + ") is null. Inspection: "+getClass());
  }
  return SuppressManager.getInstance().createSuppressActions(key);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:BaseJavaLocalInspectionTool.java

示例10: appendFixes

import com.intellij.codeInsight.daemon.HighlightDisplayKey; //导入方法依赖的package包/类
private static void appendFixes(@Nullable TextRange fixedRange, @NotNull HighlightInfo info, @Nullable List<Annotation.QuickFixInfo> fixes) {
  if (fixes != null) {
    for (final Annotation.QuickFixInfo quickFixInfo : fixes) {
      TextRange range = fixedRange != null ? fixedRange : quickFixInfo.textRange;
      HighlightDisplayKey key = quickFixInfo.key != null
                                ? quickFixInfo.key
                                : HighlightDisplayKey.find(ANNOTATOR_INSPECTION_SHORT_NAME);
      info.registerFix(quickFixInfo.quickFix, null, HighlightDisplayKey.getDisplayNameByKey(key), range, key);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:HighlightInfo.java

示例11: runTool

import com.intellij.codeInsight.daemon.HighlightDisplayKey; //导入方法依赖的package包/类
public static void runTool(@NotNull InspectionToolWrapper toolWrapper,
                           @NotNull final AnalysisScope scope,
                           @NotNull final GlobalInspectionContextForTests globalContext) {
  final String shortName = toolWrapper.getShortName();
  final HighlightDisplayKey key = HighlightDisplayKey.find(shortName);
  if (key == null){
    HighlightDisplayKey.register(shortName);
  }

  globalContext.doInspections(scope);
  do {
    UIUtil.dispatchAllInvocationEvents();
  }
  while (!globalContext.isFinished());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:InspectionTestUtil.java

示例12: Descriptor

import com.intellij.codeInsight.daemon.HighlightDisplayKey; //导入方法依赖的package包/类
public Descriptor(@NotNull ScopeToolState state, @NotNull InspectionProfileImpl inspectionProfile, @NotNull Project project) {
  myState = state;
  myInspectionProfile = inspectionProfile;
  InspectionToolWrapper tool = state.getTool();
  myText = tool.getDisplayName();
  final String[] groupPath = tool.getGroupPath();
  myGroup = groupPath.length == 0 ? new String[]{InspectionProfileEntry.GENERAL_GROUP_NAME} : groupPath;
  myKey = HighlightDisplayKey.find(tool.getShortName());
  myScopeName = state.getScopeName();
  myScope = state.getScope(project);
  myLevel = inspectionProfile.getErrorLevel(myKey, myScope, project);
  myEnabled = inspectionProfile.isToolEnabled(myKey, myScope, project);
  myToolWrapper = tool;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:Descriptor.java

示例13: createHighlightInfo

import com.intellij.codeInsight.daemon.HighlightDisplayKey; //导入方法依赖的package包/类
@Nullable
private HighlightInfo createHighlightInfo(@NotNull ProblemDescriptor descriptor,
                                          @NotNull LocalInspectionToolWrapper tool,
                                          @NotNull HighlightInfoType level,
                                          @NotNull Set<Pair<TextRange, String>> emptyActionRegistered,
                                          @NotNull PsiElement element) {
  @NonNls String message = ProblemDescriptorUtil.renderDescriptionMessage(descriptor, element);

  final HighlightDisplayKey key = HighlightDisplayKey.find(tool.getShortName());
  final InspectionProfile inspectionProfile = myProfileWrapper.getInspectionProfile();
  if (!inspectionProfile.isToolEnabled(key, getFile())) return null;

  HighlightInfoType type = new HighlightInfoType.HighlightInfoTypeImpl(level.getSeverity(element), level.getAttributesKey());
  final String plainMessage = message.startsWith("<html>") ? StringUtil.unescapeXml(XmlStringUtil.stripHtml(message).replaceAll("<[^>]*>", "")) : message;
  @NonNls final String link = " <a "
                              +"href=\"#inspection/" + tool.getShortName() + "\""
                              + (UIUtil.isUnderDarcula() ? " color=\"7AB4C9\" " : "")
                              +">" + DaemonBundle.message("inspection.extended.description")
                              +"</a> " + myShortcutText;

  @NonNls String tooltip = null;
  if (descriptor.showTooltip()) {
    tooltip = XmlStringUtil.wrapInHtml((message.startsWith("<html>") ? XmlStringUtil.stripHtml(message): XmlStringUtil.escapeString(message)) + link);
  }
  HighlightInfo highlightInfo = highlightInfoFromDescriptor(descriptor, type, plainMessage, tooltip,element);
  if (highlightInfo != null) {
    registerQuickFixes(tool, descriptor, highlightInfo, emptyActionRegistered);
  }
  return highlightInfo;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:LocalInspectionsPass.java

示例14: registerQuickFixes

import com.intellij.codeInsight.daemon.HighlightDisplayKey; //导入方法依赖的package包/类
private static void registerQuickFixes(@NotNull LocalInspectionToolWrapper tool,
                                       @NotNull ProblemDescriptor descriptor,
                                       @NotNull HighlightInfo highlightInfo,
                                       @NotNull Set<Pair<TextRange,String>> emptyActionRegistered) {
  final HighlightDisplayKey key = HighlightDisplayKey.find(tool.getShortName());
  boolean needEmptyAction = true;
  final QuickFix[] fixes = descriptor.getFixes();
  if (fixes != null && fixes.length > 0) {
    for (int k = 0; k < fixes.length; k++) {
      if (fixes[k] != null) { // prevent null fixes from var args
        QuickFixAction.registerQuickFixAction(highlightInfo, QuickFixWrapper.wrap(descriptor, k), key);
        needEmptyAction = false;
      }
    }
  }
  HintAction hintAction = descriptor instanceof ProblemDescriptorImpl ? ((ProblemDescriptorImpl)descriptor).getHintAction() : null;
  if (hintAction != null) {
    QuickFixAction.registerQuickFixAction(highlightInfo, hintAction, key);
    needEmptyAction = false;
  }
  if (((ProblemDescriptorBase)descriptor).getEnforcedTextAttributes() != null) {
    needEmptyAction = false;
  }
  if (needEmptyAction && emptyActionRegistered.add(Pair.<TextRange, String>create(highlightInfo.getFixTextRange(), tool.getShortName()))) {
    IntentionAction emptyIntentionAction = new EmptyIntentionAction(tool.getDisplayName());
    QuickFixAction.registerQuickFixAction(highlightInfo, emptyIntentionAction, key);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:LocalInspectionsPass.java

示例15: isInspectionEnabled

import com.intellij.codeInsight.daemon.HighlightDisplayKey; //导入方法依赖的package包/类
public static boolean isInspectionEnabled(@NonNls String shortName, PsiElement context) {
  final InspectionProjectProfileManager profileManager = InspectionProjectProfileManager.getInstance(context.getProject());
  final InspectionProfileImpl profile = (InspectionProfileImpl)profileManager.getInspectionProfile();
  final HighlightDisplayKey key = HighlightDisplayKey.find(shortName);
  return profile.isToolEnabled(key, context);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:BaseInspection.java


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