I have a custom editor with problem markers. The markers display correctly in the "problems" view with icon, location and text, and the problem icons display correctly in the left margin of the editor.
I would like to display the same error message text in a popup when hovering over the problem marker icon in the margin, just as it happens in the Java editor. Right now there in no popup.
Is there an easy way to achieve this?
Answer :
OK, it doesn't look like the functionality is built-in in the marker-system. It seems a patch have been submitted, so it will probably be added in a later version, but until then it is also pretty easy create by hand.
IAnnotationHover and implement getHoverInfo().getAnnotationHover() method in the SourceViewerConfiguration.getHoverInfo() method, call ISourceViewer.getAnnotationModel().getAnnotationIterator() to get all markers.In your class that extends org.eclipse.jface.text.source.SourceViewerConfiguration, just include the following:
@Override
public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) {
return new DefaultAnnotationHover();
}
this includes the text of all markers of a line in the hover text of the problem marker in the margins of the text editor.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With