[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [cdt-dev] Custom Source Highlight
|
Hi Julien,
you can add a custom annotation model (see
org.eclipse.jface.text.source.AnnotationModel) to the annotation model
of your document (if it is an instance of IAnnotationModelExtension,
which it should be in the case of CEditor).
In your custom annotation model you can add annotations via
addAnnotation, e.g. by overriding the connect(IDocument) method. You
might also want to implement
org.eclipse.jface.text.reconciler.IReconcilingStrategy so your custom
annotation model is involved during reconciling.
CEditor is an AbstractDecoratedTextEditor which has a
SourceViewerDecorationSupport (created in
CEditor::getSourceViewerDecorationSupport) which has an AnnotationPainter.
You can add drawing strategies to the AnnotationPainter by calling
AnnotationPainter::addDrawingStrategy(Object id, IDrawingStrategy strategy).
This drawing strategies are called for the annotations on your custom
annotation model and can implement the drawing logic.
Best regards,
Dominic
On 5/13/22 08:04, Julien DEHAUDT via cdt-dev wrote:
Hi all,
I'm trying to implement a way to highlight custom section of code based on specific criteria, mainly C/C++ source inspection.
For example like the existing gray background surrounded by the ifdef/endif directive.
Do you have ideas about how to implement this?
I already quickly tried the org.eclipse.cdt.ui.semanticHighlighting EP but it seems to be too limited for this use-case. I wonder if org.eclipse.ui.genericeditor.highlightReconcilers could be to right entry point?
Thank in advance.
Julien
ST Restricted
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/cdt-dev
Attachment:
smime.p7s
Description: S/MIME cryptographic signature