本文整理汇总了Java中com.intellij.openapi.editor.markup.RangeHighlighter.getErrorStripeTooltip方法的典型用法代码示例。如果您正苦于以下问题:Java RangeHighlighter.getErrorStripeTooltip方法的具体用法?Java RangeHighlighter.getErrorStripeTooltip怎么用?Java RangeHighlighter.getErrorStripeTooltip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.editor.markup.RangeHighlighter
的用法示例。
在下文中一共展示了RangeHighlighter.getErrorStripeTooltip方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: calcTooltipRenderer
import com.intellij.openapi.editor.markup.RangeHighlighter; //导入方法依赖的package包/类
@Override
public TooltipRenderer calcTooltipRenderer(@NotNull final Collection<RangeHighlighter> highlighters) {
LineTooltipRenderer bigRenderer = null;
//do not show same tooltip twice
Set<String> tooltips = null;
for (RangeHighlighter highlighter : highlighters) {
final Object tooltipObject = highlighter.getErrorStripeTooltip();
if (tooltipObject == null) continue;
final String text = tooltipObject.toString();
if (tooltips == null) {
tooltips = new THashSet<String>();
}
if (tooltips.add(text)) {
if (bigRenderer == null) {
bigRenderer = new LineTooltipRenderer(text, new Object[]{highlighters});
}
else {
bigRenderer.addBelow(text);
}
}
}
return bigRenderer;
}
示例2: clearMyHighlights
import com.intellij.openapi.editor.markup.RangeHighlighter; //导入方法依赖的package包/类
public static void clearMyHighlights(Document document, Project project) {
MarkupModel markupModel = DocumentMarkupModel.forDocument(document, project, true);
for (RangeHighlighter highlighter : markupModel.getAllHighlighters()) {
Object tooltip = highlighter.getErrorStripeTooltip();
if (!(tooltip instanceof HighlightInfo)) {
continue;
}
HighlightInfo info = (HighlightInfo)tooltip;
if (info.type == HighlightInfoType.ELEMENT_UNDER_CARET_READ || info.type == HighlightInfoType.ELEMENT_UNDER_CARET_WRITE) {
highlighter.dispose();
}
}
}
示例3: incErrorCount
import com.intellij.openapi.editor.markup.RangeHighlighter; //导入方法依赖的package包/类
private void incErrorCount(RangeHighlighter highlighter, int delta) {
Object o = highlighter.getErrorStripeTooltip();
if (!(o instanceof HighlightInfo)) return;
HighlightInfo info = (HighlightInfo)o;
HighlightSeverity infoSeverity = info.getSeverity();
final int severityIdx = mySeverityRegistrar.getSeverityIdx(infoSeverity);
if (severityIdx != -1) {
errorCount[severityIdx] += delta;
}
}
示例4: findInfo
import com.intellij.openapi.editor.markup.RangeHighlighter; //导入方法依赖的package包/类
private static HighlightInfo findInfo(final RangeHighlighter highlighter) {
Object o = highlighter.getErrorStripeTooltip();
if (o instanceof HighlightInfo) return (HighlightInfo)o;
return null;
}
示例5: calcTooltipRenderer
import com.intellij.openapi.editor.markup.RangeHighlighter; //导入方法依赖的package包/类
@Override
public TooltipRenderer calcTooltipRenderer(@NotNull final Collection<RangeHighlighter> highlighters) {
LineTooltipRenderer bigRenderer = null;
List<HighlightInfo> infos = new SmartList<HighlightInfo>();
Collection<String> tooltips = new THashSet<String>(); //do not show same tooltip twice
for (RangeHighlighter marker : highlighters) {
final Object tooltipObject = marker.getErrorStripeTooltip();
if (tooltipObject == null) continue;
if (tooltipObject instanceof HighlightInfo) {
HighlightInfo info = (HighlightInfo)tooltipObject;
if (info.getToolTip() != null && tooltips.add(info.getToolTip())) {
infos.add(info);
}
}
else {
final String text = tooltipObject.toString();
if (tooltips.add(text)) {
if (bigRenderer == null) {
bigRenderer = new MyRenderer(text, new Object[] {highlighters});
}
else {
bigRenderer.addBelow(text);
}
}
}
}
if (!infos.isEmpty()) {
// show errors first
ContainerUtil.quickSort(infos, new Comparator<HighlightInfo>() {
@Override
public int compare(final HighlightInfo o1, final HighlightInfo o2) {
int i = SeverityRegistrar.getSeverityRegistrar(myProject).compare(o2.getSeverity(), o1.getSeverity());
if (i != 0) return i;
return o1.getToolTip().compareTo(o2.getToolTip());
}
});
final HighlightInfoComposite composite = new HighlightInfoComposite(infos);
if (bigRenderer == null) {
bigRenderer = new MyRenderer(UIUtil.convertSpace2Nbsp(composite.getToolTip()), new Object[] {highlighters});
}
else {
final LineTooltipRenderer renderer = new MyRenderer(UIUtil.convertSpace2Nbsp(composite.getToolTip()), new Object[] {highlighters});
renderer.addBelow(bigRenderer.getText());
bigRenderer = renderer;
}
}
return bigRenderer;
}