};
}
presentation.addStyleRange(range);
}
PythonConsoleLineTracker lineTracker = new PythonConsoleLineTracker();
lineTracker.init(new ILinkContainer() {
public void addLink(IHyperlink link, int offset, int length) {
StyleRangeWithCustomData range = new StyleRangeWithCustomData();
range.underline = true;
try {
range.underlineStyle = SWT.UNDERLINE_LINK;
} catch (Throwable e) {
//Ignore (not available on earlier versions of eclipse)
}
//Set the proper color if it's available -- we don't do that here because our background is
//the default (usually yellow), so, there's no point in changing it to the theme. An option
//could be setting the theme for the popup, but we're not doing that now.
// TextAttribute textAttribute = ColorManager.getDefault().getHyperlinkTextAttribute();
// if (textAttribute != null) {
// range.foreground = textAttribute.getForeground();
// }
range.start = offset;
range.length = length + 1;
range.customData = link;
presentation.addStyleRange(range);
}
public String getContents(int lineOffset, int lineLength) throws BadLocationException {
if (lineLength <= 0) {
return "";
}
return hoverInfo.substring(lineOffset, lineOffset + lineLength + 1);
}
});
lineTracker.splitInLinesAndAppendToLineTracker(hoverInfo);
}