本文整理了Java中com.intellij.lang.annotation.Annotation.setTooltip()
方法的一些代码示例,展示了Annotation.setTooltip()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Annotation.setTooltip()
方法的具体详情如下:
包路径:com.intellij.lang.annotation.Annotation
类名称:Annotation
方法名:setTooltip
暂无
代码示例来源:origin: KronicDeth/intellij-elixir
@Override
public void apply(@NotNull PsiFile file, @NotNull List<Issue> issueList, @NotNull AnnotationHolder holder) {
if (issueList.size() > 0) {
@Nullable Document document = file.getViewProvider().getDocument();
if (document != null) {
String workingDirectory = ensureWorkingDirectory(file.getProject());
for (Issue issue : issueList) {
int lineStartOffset = document.getLineStartOffset(issue.line);
int start;
int end;
if (issue.column != null) {
start = lineStartOffset + issue.column;
end = start + 1;
} else {
start = lineStartOffset;
end = document.getLineEndOffset(issue.line);
}
Annotation annotation = holder.createWarningAnnotation(new TextRange(start, end), issue.message);
annotation.setAfterEndOfLine(end == start);
issue.explanation.ifPresent(explanation -> {
String toolTip = explanationToToolTip(explanation, workingDirectory);
if (!toolTip.isEmpty()) {
annotation.setTooltip(toolTip);
}
});
}
}
}
}
代码示例来源:origin: sonar-intellij-plugin/sonar-intellij-plugin
private void createAnnotations(
@NotNull final PsiFile psiFile,
AnnotationResult annotationResult,
@NotNull AnnotationHolder holder
) {
final Set<SonarIssue> issues = annotationResult.sonarIssues;
for (SonarIssue issue : issues) {
Optional<Annotation> annotation = createAnnotation(holder,psiFile,issue);
if (annotation.isPresent()) {
String tooltip = createTooltip(issue);
annotation.get().setTooltip(tooltip);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!