Class AnnotationProvider

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class AnnotationProvider extends GObject

It is used to provide annotations and display them on View and also populate HoverDisplay when the user hovers over an annotation.

You can subclass this object and implement populateHoverAsync(Annotation, HoverDisplay, Cancellable, AsyncReadyCallback) and populateHoverFinish(AsyncResult) or connect to AnnotationProvider::populate and call AnnotationProvider.populate or do it asynchronously.

Since:
5.18
  • Constructor Details

    • AnnotationProvider

      public AnnotationProvider(MemorySegment address)
      Create a AnnotationProvider instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • AnnotationProvider

      public AnnotationProvider()
      Create a new AnnotationProvider.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the AnnotationProvider class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected AnnotationProvider asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class GObject
      Returns:
      the instance as if it were its parent type
    • addAnnotation

      public void addAnnotation(Annotation annotation)
      Add an annotation to the provider.
      Since:
      5.18
    • populateHoverAsync

      public void populateHoverAsync(Annotation annotation, HoverDisplay display, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback)
      Used to populate the HoverDisplay asynchronously, use AnnotationProvider.populateHover to do it synchronously.
      Parameters:
      annotation - a GtkSourceAnnotation
      display - a GtkSourceHoverDisplay to populate
      Since:
      5.18
    • populateHoverFinish

      public boolean populateHoverFinish(AsyncResult result) throws GErrorException
      Finishes populating the HoverDisplay asynchronously.
      Returns:
      true if successful; otherwise false and error is set.
      Throws:
      GErrorException - see GError
      Since:
      5.18
    • removeAll

      public void removeAll()
      Removes all annotations from the provider.
      Since:
      5.18
    • removeAnnotation

      public boolean removeAnnotation(Annotation annotation)
      Remove an annotation from the provider.
      Returns:
      true if the annotation was found and removed
      Since:
      5.18
    • onChanged

    • emitChanged

      public void emitChanged()
    • builder

      public static AnnotationProvider.Builder<? extends AnnotationProvider.Builder> builder()
      A AnnotationProvider.Builder object constructs a AnnotationProvider with the specified properties. Use the various set...() methods to set properties, and finish construction with AnnotationProvider.Builder.build().
      Returns:
      the builder object