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_IDFields inherited from interface org.eclipse.jface.text.revisions.IRevisionRulerColumnExtension
AGE, AUTHOR, AUTHOR_SHADED_BY_AGE -
Constructor Summary
ConstructorsConstructorDescriptionLineNumberChangeRulerColumn(ISharedTextColors sharedColors) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRevisionListener(IRevisionListener listener) Adds a revision listener that will be notified when the displayed revision information changes.voidRegisters a vertical ruler listener to be informed if an annotation gets selected on the vertical ruler.protected intDoes the real computation of the number of digits.createControl(CompositeRuler parentRuler, Composite parentControl) Creates the column's SWT control.protected StringcreateDisplayString(int line) Computes the string to be printed forline.getHover()Returns the hover for this vertical ruler (column).intReturns the line number of the last mouse button activity.getModel()Returns the model currently used by the receiver.Returns the revision selection provider.intgetWidth()Returns the width of this column's control.protected voidDisposes the column's resources.booleanReturnstrueif the ruler is showing change information,falseotherwisebooleanReturnstrueif the ruler is showing line numbers,falseotherwisebooleanReturnstrueif the ruler is showing revision information,falseotherwisevoidremoveRevisionListener(IRevisionListener listener) Removes a previously registered revision listener; nothing happens iflistenerwas not registered with the receiver.voidRemoves a previously registered listener.voidsetAddedColor(Color addedColor) Sets the background color for added lines.voidsetBackground(Color background) Sets the background color of this column.voidsetChangedColor(Color changedColor) Sets the background color for changed lines.voidsetDeletedColor(Color deletedColor) Sets the color for the deleted lines indicator.voidsetDisplayMode(boolean characterMode) Sets the display mode of the ruler.voidsetHover(IAnnotationHover hover) Sets the hover of this ruler column.voidsetModel(IAnnotationModel model) Associates an annotation model with this ruler column.voidSets the revision information.voidChanges the rendering mode and triggers redrawing if needed.voidshowLineNumbers(boolean showNumbers) Sets the line number display mode.voidshowRevisionAuthor(boolean show) Enables showing the revision author.voidshowRevisionId(boolean show) Enables showing the revision id.inttoDocumentLineNumber(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, updateNumberOfDigitsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.jface.text.source.IVerticalRulerColumn
getControl, redraw, setFontMethods inherited from interface org.eclipse.jface.text.source.IVerticalRulerInfo
getControl
-
Constructor Details
-
Method Details
-
createControl
Description copied from interface:IVerticalRulerColumnCreates the column's SWT control.- Specified by:
createControlin interfaceIVerticalRulerColumn- Overrides:
createControlin 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:IVerticalRulerInfoReturns the line number of the last mouse button activity. Based on the input document of the connected text viewer.- Specified by:
getLineOfLastMouseButtonActivityin interfaceIVerticalRulerInfo- Returns:
- the line number of the last mouse button activity or
-1if the last mouse activity does not correspond to a valid document line
-
toDocumentLineNumber
public int toDocumentLineNumber(int y_coordinate) Description copied from interface:IVerticalRulerInfoTranslates a y-coordinate of the ruler's SWT control into the according line number of the document of the connected text viewer.- Specified by:
toDocumentLineNumberin interfaceIVerticalRulerInfo- Parameters:
y_coordinate- a y-coordinate of the ruler's SWT control- Returns:
- the line number of that coordinate or
-1if that coordinate does not correspond to a valid document line
-
setModel
Description copied from interface:IVerticalRulerColumnAssociates an annotation model with this ruler column. A valuenullis acceptable and clears the ruler.- Specified by:
setModelin interfaceIVerticalRulerColumn- Overrides:
setModelin 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-trueif diff information is to be displayed textually.
-
getModel
Description copied from interface:IVerticalRulerInfoExtensionReturns the model currently used by the receiver.- Specified by:
getModelin interfaceIVerticalRulerInfoExtension- Returns:
- the model of the receiver, or
nullif no model is installed.
-
createDisplayString
Description copied from class:LineNumberRulerColumnComputes the string to be printed forline. The default implementation returnsInteger.toString(line + 1).- Overrides:
createDisplayStringin 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:LineNumberRulerColumnDoes the real computation of the number of digits. Subclasses may override this method if they need extra space on the line number ruler.- Overrides:
computeNumberOfDigitsin classLineNumberRulerColumn- Returns:
- the number of digits to be displayed on the line number ruler.
-
addVerticalRulerListener
Description copied from interface:IVerticalRulerInfoExtensionRegisters a vertical ruler listener to be informed if an annotation gets selected on the vertical ruler.- Specified by:
addVerticalRulerListenerin interfaceIVerticalRulerInfoExtension- Parameters:
listener- the listener to be informed
-
removeVerticalRulerListener
Description copied from interface:IVerticalRulerInfoExtensionRemoves a previously registered listener. Iflisteneris not registered with the receiver, calling this method has no effect.- Specified by:
removeVerticalRulerListenerin interfaceIVerticalRulerInfoExtension- Parameters:
listener- the listener to be removed
-
getHover
Description copied from interface:IVerticalRulerInfoExtensionReturns the hover for this vertical ruler (column).- Specified by:
getHoverin interfaceIVerticalRulerInfoExtension- Returns:
- the hover for this column
-
setHover
Description copied from interface:IChangeRulerColumnSets the hover of this ruler column.- Specified by:
setHoverin interfaceIChangeRulerColumn- Parameters:
hover- the hover that will produce hover information text for this ruler column
-
setBackground
Description copied from class:LineNumberRulerColumnSets the background color of this column.- Specified by:
setBackgroundin interfaceIChangeRulerColumn- Overrides:
setBackgroundin classLineNumberRulerColumn- Parameters:
background- the background color
-
setAddedColor
Description copied from interface:IChangeRulerColumnSets 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:
setAddedColorin interfaceIChangeRulerColumn- Parameters:
addedColor- the new color to be used for the added lines background
-
setChangedColor
Description copied from interface:IChangeRulerColumnSets 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:
setChangedColorin interfaceIChangeRulerColumn- Parameters:
changedColor- the new color to be used for the changed lines background
-
setDeletedColor
Description copied from interface:IChangeRulerColumnSets 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:
setDeletedColorin interfaceIChangeRulerColumn- Parameters:
deletedColor- the new color to be used for the deleted lines indicator.
-
setRevisionInformation
Description copied from interface:IRevisionRulerColumnSets the revision information.- Specified by:
setRevisionInformationin interfaceIRevisionRulerColumn- Parameters:
info- the new revision information, ornullto reset the ruler
-
getRevisionSelectionProvider
Description copied from interface:IRevisionRulerColumnExtensionReturns the revision selection provider.- Specified by:
getRevisionSelectionProviderin interfaceIRevisionRulerColumnExtension- Returns:
- the revision selection provider
-
setRevisionRenderingMode
Description copied from interface:IRevisionRulerColumnExtensionChanges the rendering mode and triggers redrawing if needed.- Specified by:
setRevisionRenderingModein interfaceIRevisionRulerColumnExtension- Parameters:
renderingMode- the rendering mode
-
showLineNumbers
public void showLineNumbers(boolean showNumbers) Sets the line number display mode.- Parameters:
showNumbers-trueto show numbers,falseto only show diff / revision info.- Since:
- 3.3
-
getWidth
public int getWidth()Description copied from interface:IVerticalRulerColumnReturns the width of this column's control.- Specified by:
getWidthin interfaceIVerticalRulerColumn- Specified by:
getWidthin interfaceIVerticalRulerInfo- Overrides:
getWidthin classLineNumberRulerColumn- Returns:
- the width of this column's control
-
isShowingLineNumbers
public boolean isShowingLineNumbers()Returnstrueif the ruler is showing line numbers,falseotherwise- Returns:
trueif line numbers are shown,falseotherwise- Since:
- 3.3
-
isShowingRevisionInformation
public boolean isShowingRevisionInformation()Returnstrueif the ruler is showing revision information,falseotherwise- Returns:
trueif revision information is shown,falseotherwise- Since:
- 3.3
-
isShowingChangeInformation
public boolean isShowingChangeInformation()Returnstrueif the ruler is showing change information,falseotherwise- Returns:
trueif change information is shown,falseotherwise- Since:
- 3.3
-
showRevisionAuthor
public void showRevisionAuthor(boolean show) Description copied from interface:IRevisionRulerColumnExtensionEnables showing the revision author.- Specified by:
showRevisionAuthorin interfaceIRevisionRulerColumnExtension- Parameters:
show-trueto show the author,falseto hide it
-
showRevisionId
public void showRevisionId(boolean show) Description copied from interface:IRevisionRulerColumnExtensionEnables showing the revision id.- Specified by:
showRevisionIdin interfaceIRevisionRulerColumnExtension- Parameters:
show-trueto show the revision,falseto hide it
-
addRevisionListener
Description copied from interface:IRevisionRulerColumnExtensionAdds a revision listener that will be notified when the displayed revision information changes.- Specified by:
addRevisionListenerin interfaceIRevisionRulerColumnExtension- Parameters:
listener- the listener to add
-
removeRevisionListener
Description copied from interface:IRevisionRulerColumnExtensionRemoves a previously registered revision listener; nothing happens iflistenerwas not registered with the receiver.- Specified by:
removeRevisionListenerin interfaceIRevisionRulerColumnExtension- Parameters:
listener- the listener to remove
-
handleDispose
protected void handleDispose()Description copied from class:LineNumberRulerColumnDisposes the column's resources.- Overrides:
handleDisposein classLineNumberRulerColumn
-