Class LineNumberChangeRulerColumn

java.lang.Object
org.eclipse.jface.text.source.LineNumberRulerColumn
org.eclipse.jface.text.source.LineNumberChangeRulerColumn
All Implemented Interfaces:
IRevisionRulerColumn, IRevisionRulerColumnExtension, IChangeRulerColumn, IVerticalRulerColumn, IVerticalRulerInfo, IVerticalRulerInfoExtension

public class LineNumberChangeRulerColumn extends LineNumberRulerColumn implements IChangeRulerColumn, IRevisionRulerColumn, IRevisionRulerColumnExtension
A vertical ruler column displaying line numbers and serving as a UI for quick diff. Clients usually instantiate and configure object of this class.
Since:
3.0
Restriction:
This class is not intended to be subclassed by clients.
  • Constructor Details

    • LineNumberChangeRulerColumn

      public LineNumberChangeRulerColumn(ISharedTextColors sharedColors)
      Creates a new instance.
      Parameters:
      sharedColors - the shared colors provider to use
  • Method Details

    • createControl

      public Control createControl(CompositeRuler parentRuler, Composite parentControl)
      Description copied from interface: IVerticalRulerColumn
      Creates the column's SWT control.
      Specified by:
      createControl in interface IVerticalRulerColumn
      Overrides:
      createControl in class LineNumberRulerColumn
      Parameters:
      parentRuler - the parent ruler of this column
      parentControl - the control of the parent ruler
      Returns:
      the column's SWT control
    • getLineOfLastMouseButtonActivity

      public int getLineOfLastMouseButtonActivity()
      Description copied from interface: IVerticalRulerInfo
      Returns the line number of the last mouse button activity. Based on the input document of the connected text viewer.
      Specified by:
      getLineOfLastMouseButtonActivity in interface IVerticalRulerInfo
      Returns:
      the line number of the last mouse button activity or -1 if the last mouse activity does not correspond to a valid document line
    • toDocumentLineNumber

      public int toDocumentLineNumber(int y_coordinate)
      Description copied from interface: IVerticalRulerInfo
      Translates a y-coordinate of the ruler's SWT control into the according line number of the document of the connected text viewer.
      Specified by:
      toDocumentLineNumber in interface IVerticalRulerInfo
      Parameters:
      y_coordinate - a y-coordinate of the ruler's SWT control
      Returns:
      the line number of that coordinate or -1 if that coordinate does not correspond to a valid document line
    • setModel

      public void setModel(IAnnotationModel model)
      Description copied from interface: IVerticalRulerColumn
      Associates an annotation model with this ruler column. A value null is acceptable and clears the ruler.
      Specified by:
      setModel in interface IVerticalRulerColumn
      Overrides:
      setModel in class LineNumberRulerColumn
      Parameters:
      model - the new annotation model, may be null
    • setDisplayMode

      public void setDisplayMode(boolean characterMode)
      Sets the display mode of the ruler. If character mode is set to true, diff information will be displayed textually on the line number ruler.
      Parameters:
      characterMode - true if diff information is to be displayed textually.
    • getModel

      public IAnnotationModel getModel()
      Description copied from interface: IVerticalRulerInfoExtension
      Returns the model currently used by the receiver.
      Specified by:
      getModel in interface IVerticalRulerInfoExtension
      Returns:
      the model of the receiver, or null if no model is installed.
    • createDisplayString

      protected String createDisplayString(int line)
      Description copied from class: LineNumberRulerColumn
      Computes the string to be printed for line. The default implementation returns Integer.toString(line + 1).
      Overrides:
      createDisplayString in class LineNumberRulerColumn
      Parameters:
      line - the line number for which the line number string is generated
      Returns:
      the string to be printed on the line number bar for line
    • computeNumberOfDigits

      protected int computeNumberOfDigits()
      Description copied from class: LineNumberRulerColumn
      Does the real computation of the number of digits. Subclasses may override this method if they need extra space on the line number ruler.
      Overrides:
      computeNumberOfDigits in class LineNumberRulerColumn
      Returns:
      the number of digits to be displayed on the line number ruler.
    • addVerticalRulerListener

      public void addVerticalRulerListener(IVerticalRulerListener listener)
      Description copied from interface: IVerticalRulerInfoExtension
      Registers a vertical ruler listener to be informed if an annotation gets selected on the vertical ruler.
      Specified by:
      addVerticalRulerListener in interface IVerticalRulerInfoExtension
      Parameters:
      listener - the listener to be informed
    • removeVerticalRulerListener

      public void removeVerticalRulerListener(IVerticalRulerListener listener)
      Description copied from interface: IVerticalRulerInfoExtension
      Removes a previously registered listener. If listener is not registered with the receiver, calling this method has no effect.
      Specified by:
      removeVerticalRulerListener in interface IVerticalRulerInfoExtension
      Parameters:
      listener - the listener to be removed
    • getHover

      public IAnnotationHover getHover()
      Description copied from interface: IVerticalRulerInfoExtension
      Returns the hover for this vertical ruler (column).
      Specified by:
      getHover in interface IVerticalRulerInfoExtension
      Returns:
      the hover for this column
    • setHover

      public void setHover(IAnnotationHover hover)
      Description copied from interface: IChangeRulerColumn
      Sets the hover of this ruler column.
      Specified by:
      setHover in interface IChangeRulerColumn
      Parameters:
      hover - the hover that will produce hover information text for this ruler column
    • setBackground

      public void setBackground(Color background)
      Description copied from class: LineNumberRulerColumn
      Sets the background color of this column.
      Specified by:
      setBackground in interface IChangeRulerColumn
      Overrides:
      setBackground in class LineNumberRulerColumn
      Parameters:
      background - the background color
    • setAddedColor

      public void setAddedColor(Color addedColor)
      Description copied from interface: IChangeRulerColumn
      Sets the background color for added lines. The color has to be disposed of by the caller when the receiver is no longer used.
      Specified by:
      setAddedColor in interface IChangeRulerColumn
      Parameters:
      addedColor - the new color to be used for the added lines background
    • setChangedColor

      public void setChangedColor(Color changedColor)
      Description copied from interface: IChangeRulerColumn
      Sets the background color for changed lines. The color has to be disposed of by the caller when the receiver is no longer used.
      Specified by:
      setChangedColor in interface IChangeRulerColumn
      Parameters:
      changedColor - the new color to be used for the changed lines background
    • setDeletedColor

      public void setDeletedColor(Color deletedColor)
      Description copied from interface: IChangeRulerColumn
      Sets the color for the deleted lines indicator. The color has to be disposed of by the caller when the receiver is no longer used.
      Specified by:
      setDeletedColor in interface IChangeRulerColumn
      Parameters:
      deletedColor - the new color to be used for the deleted lines indicator.
    • setRevisionInformation

      public void setRevisionInformation(RevisionInformation info)
      Description copied from interface: IRevisionRulerColumn
      Sets the revision information.
      Specified by:
      setRevisionInformation in interface IRevisionRulerColumn
      Parameters:
      info - the new revision information, or null to reset the ruler
    • getRevisionSelectionProvider

      public ISelectionProvider getRevisionSelectionProvider()
      Description copied from interface: IRevisionRulerColumnExtension
      Returns the revision selection provider.
      Specified by:
      getRevisionSelectionProvider in interface IRevisionRulerColumnExtension
      Returns:
      the revision selection provider
    • setRevisionRenderingMode

      public void setRevisionRenderingMode(IRevisionRulerColumnExtension.RenderingMode renderingMode)
      Description copied from interface: IRevisionRulerColumnExtension
      Changes the rendering mode and triggers redrawing if needed.
      Specified by:
      setRevisionRenderingMode in interface IRevisionRulerColumnExtension
      Parameters:
      renderingMode - the rendering mode
    • showLineNumbers

      public void showLineNumbers(boolean showNumbers)
      Sets the line number display mode.
      Parameters:
      showNumbers - true to show numbers, false to only show diff / revision info.
      Since:
      3.3
    • getWidth

      public int getWidth()
      Description copied from interface: IVerticalRulerColumn
      Returns the width of this column's control.
      Specified by:
      getWidth in interface IVerticalRulerColumn
      Specified by:
      getWidth in interface IVerticalRulerInfo
      Overrides:
      getWidth in class LineNumberRulerColumn
      Returns:
      the width of this column's control
    • isShowingLineNumbers

      public boolean isShowingLineNumbers()
      Returns true if the ruler is showing line numbers, false otherwise
      Returns:
      true if line numbers are shown, false otherwise
      Since:
      3.3
    • isShowingRevisionInformation

      public boolean isShowingRevisionInformation()
      Returns true if the ruler is showing revision information, false otherwise
      Returns:
      true if revision information is shown, false otherwise
      Since:
      3.3
    • isShowingChangeInformation

      public boolean isShowingChangeInformation()
      Returns true if the ruler is showing change information, false otherwise
      Returns:
      true if change information is shown, false otherwise
      Since:
      3.3
    • showRevisionAuthor

      public void showRevisionAuthor(boolean show)
      Description copied from interface: IRevisionRulerColumnExtension
      Enables showing the revision author.
      Specified by:
      showRevisionAuthor in interface IRevisionRulerColumnExtension
      Parameters:
      show - true to show the author, false to hide it
    • showRevisionId

      public void showRevisionId(boolean show)
      Description copied from interface: IRevisionRulerColumnExtension
      Enables showing the revision id.
      Specified by:
      showRevisionId in interface IRevisionRulerColumnExtension
      Parameters:
      show - true to show the revision, false to hide it
    • addRevisionListener

      public void addRevisionListener(IRevisionListener listener)
      Description copied from interface: IRevisionRulerColumnExtension
      Adds a revision listener that will be notified when the displayed revision information changes.
      Specified by:
      addRevisionListener in interface IRevisionRulerColumnExtension
      Parameters:
      listener - the listener to add
    • removeRevisionListener

      public void removeRevisionListener(IRevisionListener listener)
      Description copied from interface: IRevisionRulerColumnExtension
      Removes a previously registered revision listener; nothing happens if listener was not registered with the receiver.
      Specified by:
      removeRevisionListener in interface IRevisionRulerColumnExtension
      Parameters:
      listener - the listener to remove
    • handleDispose

      protected void handleDispose()
      Description copied from class: LineNumberRulerColumn
      Disposes the column's resources.
      Overrides:
      handleDispose in class LineNumberRulerColumn