Class ProjectionSupport

java.lang.Object
org.eclipse.jface.text.source.projection.ProjectionSupport

public class ProjectionSupport extends Object
Supports the configuration of projection capabilities a ProjectionViewer.

This class is not intended to be subclassed. Clients are supposed to configure and use it as is.

Since:
3.0
Restriction:
This class is not intended to be subclassed by clients.
  • Field Details

    • PROJECTION

      public static final Object PROJECTION
      Key of the projection annotation model inside the visual annotation model. Also internally used as key for the projection drawing strategy.
  • Constructor Details

    • ProjectionSupport

      public ProjectionSupport(ProjectionViewer viewer, IAnnotationAccess annotationAccess, ISharedTextColors sharedTextColors)
      Creates new projection support for the given projection viewer. Initially, no annotation types are summarized. A default hover control creator and a default drawing strategy are used.
      Parameters:
      viewer - the projection viewer
      annotationAccess - the annotation access
      sharedTextColors - the shared text colors to use
  • Method Details

    • addSummarizableAnnotationType

      public void addSummarizableAnnotationType(String annotationType)
      Marks the given annotation type to be considered when creating summaries for collapsed regions of the projection viewer.

      A summary is an annotation that gets created out of all annotations with a type that has been registered through this method and that are inside the folded region.

      Parameters:
      annotationType - the annotation type to consider
    • removeSummarizableAnnotationType

      public void removeSummarizableAnnotationType(String annotationType)
      Marks the given annotation type to be ignored when creating summaries for collapsed regions of the projection viewer. This method has only an effect when addSummarizableAnnotationType has been called before for the give annotation type.

      A summary is an annotation that gets created out of all annotations with a type that has been registered through this method and that are inside the folded region.

      Parameters:
      annotationType - the annotation type to remove
    • setHoverControlCreator

      public void setHoverControlCreator(IInformationControlCreator creator)
      Sets the hover control creator that is used for the annotation hovers that are shown in the projection viewer's projection ruler column.
      Parameters:
      creator - the hover control creator
    • setInformationPresenterControlCreator

      public void setInformationPresenterControlCreator(IInformationControlCreator creator)
      Sets the information presenter control creator that is used for the annotation hovers that are shown in the projection viewer's projection ruler column.
      Parameters:
      creator - the information presenter control creator
      Since:
      3.3
    • setAnnotationPainterDrawingStrategy

      public void setAnnotationPainterDrawingStrategy(AnnotationPainter.IDrawingStrategy strategy)
      Sets the drawing strategy that the projection support's annotation painter uses to draw the indication of collapsed regions onto the projection viewer's text widget. When null is passed in, the drawing strategy is reset to the default. In order to avoid any representation use AnnotationPainter.NullStrategy.
      Parameters:
      strategy - the drawing strategy or null to reset the strategy to the default
      Since:
      3.1
    • install

      public void install()
      Installs this projection support on its viewer.
    • dispose

      public void dispose()
      Disposes this projection support.
    • doEnableProjection

      protected void doEnableProjection()
      Enables projection mode. If not yet done, installs the projection ruler column in the viewer's vertical ruler and installs a painter that indicate the locations of collapsed regions.
    • doDisableProjection

      protected void doDisableProjection()
      Removes the projection ruler column and the painter from the projection viewer.
    • getAdapter

      public <T> T getAdapter(ISourceViewer viewer, Class<T> required)
      Implements the contract of IAdaptable.getAdapter(java.lang.Class) by forwarding the adapter requests to the given viewer.
      Parameters:
      viewer - the viewer
      required - the required class of the adapter
      Returns:
      the adapter or null