Package org.eclipse.jface.text.source
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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.jface.text.revisions.IRevisionRulerColumnExtension
IRevisionRulerColumnExtension.RenderingMode
-
Field Summary
Fields inherited from interface org.eclipse.jface.text.source.IChangeRulerColumn
QUICK_DIFF_MODEL_ID
Fields inherited from interface org.eclipse.jface.text.revisions.IRevisionRulerColumnExtension
AGE, AUTHOR, AUTHOR_SHADED_BY_AGE
-
Constructor Summary
ConstructorDescriptionLineNumberChangeRulerColumn
(ISharedTextColors sharedColors) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addRevisionListener
(IRevisionListener listener) Adds a revision listener that will be notified when the displayed revision information changes.void
Registers a vertical ruler listener to be informed if an annotation gets selected on the vertical ruler.protected int
Does the real computation of the number of digits.createControl
(CompositeRuler parentRuler, Composite parentControl) Creates the column's SWT control.protected String
createDisplayString
(int line) Computes the string to be printed forline
.getHover()
Returns the hover for this vertical ruler (column).int
Returns the line number of the last mouse button activity.getModel()
Returns the model currently used by the receiver.Returns the revision selection provider.int
getWidth()
Returns the width of this column's control.protected void
Disposes the column's resources.boolean
Returnstrue
if the ruler is showing change information,false
otherwiseboolean
Returnstrue
if the ruler is showing line numbers,false
otherwiseboolean
Returnstrue
if the ruler is showing revision information,false
otherwisevoid
removeRevisionListener
(IRevisionListener listener) Removes a previously registered revision listener; nothing happens iflistener
was not registered with the receiver.void
Removes a previously registered listener.void
setAddedColor
(Color addedColor) Sets the background color for added lines.void
setBackground
(Color background) Sets the background color of this column.void
setChangedColor
(Color changedColor) Sets the background color for changed lines.void
setDeletedColor
(Color deletedColor) Sets the color for the deleted lines indicator.void
setDisplayMode
(boolean characterMode) Sets the display mode of the ruler.void
setHover
(IAnnotationHover hover) Sets the hover of this ruler column.void
setModel
(IAnnotationModel model) Associates an annotation model with this ruler column.void
Sets the revision information.void
Changes the rendering mode and triggers redrawing if needed.void
showLineNumbers
(boolean showNumbers) Sets the line number display mode.void
showRevisionAuthor
(boolean show) Enables showing the revision author.void
showRevisionId
(boolean show) Enables showing the revision id.int
toDocumentLineNumber
(int y_coordinate) Translates a y-coordinate of the ruler's SWT control into the according line number of the document of the connected text viewer.Methods inherited from class org.eclipse.jface.text.source.LineNumberRulerColumn
computeIndentations, getBackground, getControl, getForeground, getParentRuler, getVisibleLinesInViewport, isViewerCompletelyShown, layout, paintLine, postRedraw, redraw, setFont, setForeground, updateNumberOfDigits
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.eclipse.jface.text.source.IVerticalRulerColumn
getControl, redraw, setFont
Methods inherited from interface org.eclipse.jface.text.source.IVerticalRulerInfo
getControl
-
Constructor Details
-
Method Details
-
createControl
Description copied from interface:IVerticalRulerColumn
Creates the column's SWT control.- Specified by:
createControl
in interfaceIVerticalRulerColumn
- Overrides:
createControl
in classLineNumberRulerColumn
- Parameters:
parentRuler
- the parent ruler of this columnparentControl
- 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 interfaceIVerticalRulerInfo
- 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 interfaceIVerticalRulerInfo
- 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
Description copied from interface:IVerticalRulerColumn
Associates an annotation model with this ruler column. A valuenull
is acceptable and clears the ruler.- Specified by:
setModel
in interfaceIVerticalRulerColumn
- Overrides:
setModel
in classLineNumberRulerColumn
- Parameters:
model
- the new annotation model, may benull
-
setDisplayMode
public void setDisplayMode(boolean characterMode) Sets the display mode of the ruler. If character mode is set totrue
, diff information will be displayed textually on the line number ruler.- Parameters:
characterMode
-true
if diff information is to be displayed textually.
-
getModel
Description copied from interface:IVerticalRulerInfoExtension
Returns the model currently used by the receiver.- Specified by:
getModel
in interfaceIVerticalRulerInfoExtension
- Returns:
- the model of the receiver, or
null
if no model is installed.
-
createDisplayString
Description copied from class:LineNumberRulerColumn
Computes the string to be printed forline
. The default implementation returnsInteger.toString(line + 1)
.- Overrides:
createDisplayString
in classLineNumberRulerColumn
- 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 classLineNumberRulerColumn
- Returns:
- the number of digits to be displayed on the line number ruler.
-
addVerticalRulerListener
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 interfaceIVerticalRulerInfoExtension
- Parameters:
listener
- the listener to be informed
-
removeVerticalRulerListener
Description copied from interface:IVerticalRulerInfoExtension
Removes a previously registered listener. Iflistener
is not registered with the receiver, calling this method has no effect.- Specified by:
removeVerticalRulerListener
in interfaceIVerticalRulerInfoExtension
- Parameters:
listener
- the listener to be removed
-
getHover
Description copied from interface:IVerticalRulerInfoExtension
Returns the hover for this vertical ruler (column).- Specified by:
getHover
in interfaceIVerticalRulerInfoExtension
- Returns:
- the hover for this column
-
setHover
Description copied from interface:IChangeRulerColumn
Sets the hover of this ruler column.- Specified by:
setHover
in interfaceIChangeRulerColumn
- Parameters:
hover
- the hover that will produce hover information text for this ruler column
-
setBackground
Description copied from class:LineNumberRulerColumn
Sets the background color of this column.- Specified by:
setBackground
in interfaceIChangeRulerColumn
- Overrides:
setBackground
in classLineNumberRulerColumn
- Parameters:
background
- the background color
-
setAddedColor
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 interfaceIChangeRulerColumn
- Parameters:
addedColor
- the new color to be used for the added lines background
-
setChangedColor
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 interfaceIChangeRulerColumn
- Parameters:
changedColor
- the new color to be used for the changed lines background
-
setDeletedColor
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 interfaceIChangeRulerColumn
- Parameters:
deletedColor
- the new color to be used for the deleted lines indicator.
-
setRevisionInformation
Description copied from interface:IRevisionRulerColumn
Sets the revision information.- Specified by:
setRevisionInformation
in interfaceIRevisionRulerColumn
- Parameters:
info
- the new revision information, ornull
to reset the ruler
-
getRevisionSelectionProvider
Description copied from interface:IRevisionRulerColumnExtension
Returns the revision selection provider.- Specified by:
getRevisionSelectionProvider
in interfaceIRevisionRulerColumnExtension
- Returns:
- the revision selection provider
-
setRevisionRenderingMode
Description copied from interface:IRevisionRulerColumnExtension
Changes the rendering mode and triggers redrawing if needed.- Specified by:
setRevisionRenderingMode
in interfaceIRevisionRulerColumnExtension
- 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 interfaceIVerticalRulerColumn
- Specified by:
getWidth
in interfaceIVerticalRulerInfo
- Overrides:
getWidth
in classLineNumberRulerColumn
- Returns:
- the width of this column's control
-
isShowingLineNumbers
public boolean isShowingLineNumbers()Returnstrue
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()Returnstrue
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()Returnstrue
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 interfaceIRevisionRulerColumnExtension
- 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 interfaceIRevisionRulerColumnExtension
- Parameters:
show
-true
to show the revision,false
to hide it
-
addRevisionListener
Description copied from interface:IRevisionRulerColumnExtension
Adds a revision listener that will be notified when the displayed revision information changes.- Specified by:
addRevisionListener
in interfaceIRevisionRulerColumnExtension
- Parameters:
listener
- the listener to add
-
removeRevisionListener
Description copied from interface:IRevisionRulerColumnExtension
Removes a previously registered revision listener; nothing happens iflistener
was not registered with the receiver.- Specified by:
removeRevisionListener
in interfaceIRevisionRulerColumnExtension
- Parameters:
listener
- the listener to remove
-
handleDispose
protected void handleDispose()Description copied from class:LineNumberRulerColumn
Disposes the column's resources.- Overrides:
handleDispose
in classLineNumberRulerColumn
-