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


Java HintAction类代码示例

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


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

示例1: doRegister

import com.intellij.codeInspection.HintAction; //导入依赖的package包/类
private static void doRegister(@Nullable HighlightInfo info,
                               @Nullable IntentionAction action,
                               @Nullable List<IntentionAction> options,
                               @Nullable String displayName,
                               @Nullable TextRange fixRange,
                               @Nullable HighlightDisplayKey key) {
  if (info == null || action == null) return;
  if (fixRange == null) fixRange = new TextRange(info.startOffset, info.endOffset);
  if (info.quickFixActionRanges == null) {
    info.quickFixActionRanges = ContainerUtil.createLockFreeCopyOnWriteList();
  }
  HighlightInfo.IntentionActionDescriptor desc = new HighlightInfo.IntentionActionDescriptor(action, options, displayName, null, key, info.getProblemGroup());
  info.quickFixActionRanges.add(Pair.create(desc, fixRange));
  info.fixStartOffset = Math.min (info.fixStartOffset, fixRange.getStartOffset());
  info.fixEndOffset = Math.max (info.fixEndOffset, fixRange.getEndOffset());
  if (action instanceof HintAction) {
    info.setHint(true);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:QuickFixAction.java

示例2: ProblemDescriptorImpl

import com.intellij.codeInspection.HintAction; //导入依赖的package包/类
public ProblemDescriptorImpl(@NotNull PsiElement startElement,
                             @NotNull PsiElement endElement,
                             @NotNull String descriptionTemplate,
                             LocalQuickFix[] fixes,
                             @NotNull ProblemHighlightType highlightType,
                             boolean isAfterEndOfLine,
                             @Nullable TextRange rangeInElement,
                             @Nullable HintAction hintAction,
                             boolean onTheFly) {
  this(startElement, endElement, descriptionTemplate, fixes, highlightType, isAfterEndOfLine, rangeInElement, true, hintAction, onTheFly);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:ProblemDescriptorImpl.java

示例3: showAddImportHint

import com.intellij.codeInspection.HintAction; //导入依赖的package包/类
private boolean showAddImportHint(HighlightInfo info) {
  if (!DaemonCodeAnalyzerSettings.getInstance().isImportHintEnabled()) return false;
  if (!DaemonCodeAnalyzer.getInstance(myProject).isImportHintsEnabled(myFile)) return false;
  PsiElement element = myFile.findElementAt(info.startOffset);
  if (element == null || !element.isValid()) return false;

  final List<Pair<HighlightInfo.IntentionActionDescriptor, TextRange>> list = info.quickFixActionRanges;
  for (Pair<HighlightInfo.IntentionActionDescriptor, TextRange> pair : list) {
    final IntentionAction action = pair.getFirst().getAction();
    if (action instanceof HintAction && action.isAvailable(myProject, myEditor, myFile)) {
      return ((HintAction)action).showHint(myEditor);
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:ShowAutoImportPass.java

示例4: getHintAction

import com.intellij.codeInspection.HintAction; //导入依赖的package包/类
public HintAction getHintAction() {
  return myHintAction;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:ProblemDescriptorImpl.java


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