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


Java VisibleHighlightingPassFactory类代码示例

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


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

示例1: showHint

import com.intellij.codeInsight.daemon.impl.VisibleHighlightingPassFactory; //导入依赖的package包/类
@Override
public boolean showHint(@NotNull final Editor editor) {
  XmlToken token = null;
  if (myToken != null) {
    token = (XmlToken)myToken.retrieve();
    if (token == null) return false;
  }
  if (!XmlSettings.getInstance().SHOW_XML_ADD_IMPORT_HINTS || myNamespacePrefix.isEmpty()) {
    return false;
  }
  final PsiElement element = myElement.retrieve();
  if (element == null) return false;
  final List<String> namespaces = getNamespaces(element, getFile());
  if (!namespaces.isEmpty()) {
    final String message = ShowAutoImportPass.getMessage(namespaces.size() > 1, namespaces.iterator().next());
    final String title = getTitle();
    final ImportNSAction action = new ImportNSAction(namespaces, getFile(), element, editor, title);
    if (element instanceof XmlTag && token != null) {
      if (VisibleHighlightingPassFactory.calculateVisibleRange(editor).contains(token.getTextRange())) {
        HintManager.getInstance().showQuestionHint(editor, message,
                                                   token.getTextOffset(),
                                                   token.getTextOffset() + myNamespacePrefix.length(), action);
        return true;
      }
    } else {
      HintManager.getInstance().showQuestionHint(editor, message,
                                                 element.getTextOffset(),
                                                 element.getTextRange().getEndOffset(), action);
      return true;
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:CreateNSDeclarationIntentionFix.java

示例2: showHint

import com.intellij.codeInsight.daemon.impl.VisibleHighlightingPassFactory; //导入依赖的package包/类
@Override
public boolean showHint(@NotNull final Editor editor) {
  if (myToken == null) return false;
  XmlToken token = (XmlToken)myToken.retrieve();
  if (token == null) return false;
  if (!XmlSettings.getInstance().SHOW_XML_ADD_IMPORT_HINTS || myNamespacePrefix.isEmpty()) {
    return false;
  }
  final PsiElement element = myElement.retrieve();
  if (element == null) return false;
  final Set<String> namespaces = getXmlExtension().guessUnboundNamespaces(element, getFile());
  if (!namespaces.isEmpty()) {
    final String message = ShowAutoImportPass.getMessage(namespaces.size() > 1, namespaces.iterator().next());
    final String title = getTitle();
    final ImportNSAction action = new ImportNSAction(namespaces, getFile(), element, editor, title);
    if (element instanceof XmlTag) {
      if (VisibleHighlightingPassFactory.calculateVisibleRange(editor).contains(token.getTextRange())) {
        HintManager.getInstance().showQuestionHint(editor, message,
                                                   token.getTextOffset(),
                                                   token.getTextOffset() + myNamespacePrefix.length(), action);
        return true;
      }
    } else {
      HintManager.getInstance().showQuestionHint(editor, message,
                                                 element.getTextOffset(),
                                                 element.getTextRange().getEndOffset(), action);
      return true;
    }
  }
  return false;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:32,代码来源:CreateNSDeclarationIntentionFix.java


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