本文整理汇总了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;
}
示例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;
}