Package org.eclipse.jface.text.source
Class CompositeRuler
java.lang.Object
org.eclipse.jface.text.source.CompositeRuler
- All Implemented Interfaces:
- IVerticalRuler,- IVerticalRulerExtension,- IVerticalRulerInfo,- IVerticalRulerInfoExtension
public class CompositeRuler
extends Object
implements IVerticalRuler, IVerticalRulerExtension, IVerticalRulerInfoExtension
Standard implementation of
 
IVerticalRuler.
 
 This ruler does not have a a visual representation of its own. The
 presentation comes from the configurable list of vertical ruler columns. Such
 columns must implement the
 IVerticalRulerColumn. interface.
Clients may instantiate and configure this class.
- Since:
- 2.0
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionConstructs a new composite vertical ruler.CompositeRuler(int gap) Constructs a new composite ruler with the given gap between its columns.
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddDecorator(int index, IVerticalRulerColumn rulerColumn) Inserts the given column at the specified slot to this composite ruler.voidRegisters a vertical ruler listener to be informed if an annotation gets selected on the vertical ruler.createControl(Composite parent, ITextViewer textViewer) Creates the ruler's SWT control.voidfireAnnotationContextMenuAboutToShow(VerticalRulerEvent event, Menu menu) Informs all registered vertical ruler listeners that the content menu on a selected annotation\ is about to be shown.voidFires the annotation default selected event to all registered vertical ruler listeners.voidFires the annotation selected event to all registered vertical ruler listeners.Returns the ruler's SWT control.Returns an iterator over theIVerticalRulerColumnsthat make up this composite column.getHover()Returns the hover for this vertical ruler (column).intReturns the line number of the last mouse button activity.getModel()Returns the current annotation model of this ruler ornullif the ruler has no model.Returns this ruler's text viewer.intgetWidth()Returns the width of this ruler's control.voidImmediately redraws the entire ruler (without asynchronous posting).voidrelayout()Relayouts the receiver.voidremoveDecorator(int index) Removes the decorator in the specified slot from this composite ruler.voidremoveDecorator(IVerticalRulerColumn rulerColumn) Removes the given decorator from the composite ruler.voidRemoves a previously registered listener.voidSets the font of this vertical ruler.voidsetLocationOfLastMouseButtonActivity(int x, int y) Sets the location of the last mouse button activity.voidsetModel(IAnnotationModel model) Associates an annotation model with this ruler.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.voidupdate()Forces the vertical ruler to synchronize itself with its annotation model and its viewer's view port.protected static final intwidgetLine2ModelLine(ITextViewer viewer, int widgetLine) Returns the line in the given viewer's document that correspond to the given line of the viewer's widget.
- 
Constructor Details- 
CompositeRulerpublic CompositeRuler()Constructs a new composite vertical ruler.
- 
CompositeRulerpublic CompositeRuler(int gap) Constructs a new composite ruler with the given gap between its columns.- Parameters:
- gap- the gap
 
 
- 
- 
Method Details- 
addDecoratorInserts the given column at the specified slot to this composite ruler. Columns are counted from left to right.- Parameters:
- index- the index
- rulerColumn- the decorator to be inserted
 
- 
removeDecoratorpublic void removeDecorator(int index) Removes the decorator in the specified slot from this composite ruler.- Parameters:
- index- the index
 
- 
removeDecoratorRemoves the given decorator from the composite ruler.- Parameters:
- rulerColumn- the ruler column to be removed
- Since:
- 3.0
 
- 
getControlDescription copied from interface:IVerticalRulerInfoReturns the ruler's SWT control.- Specified by:
- getControlin interface- IVerticalRulerInfo
- Returns:
- the ruler's SWT control
 
- 
createControlDescription copied from interface:IVerticalRulerCreates the ruler's SWT control.- Specified by:
- createControlin interface- IVerticalRuler
- Parameters:
- parent- the parent control of the ruler's control
- textViewer- the text viewer to which this ruler belongs
- Returns:
- the ruler's SWT control
 
- 
setModelDescription copied from interface:IVerticalRulerAssociates an annotation model with this ruler. A valuenullis acceptable and clears the ruler.- Specified by:
- setModelin interface- IVerticalRuler
- Parameters:
- model- the new annotation model, may be- null
 
- 
getModelDescription copied from interface:IVerticalRulerReturns the current annotation model of this ruler ornullif the ruler has no model.- Specified by:
- getModelin interface- IVerticalRuler
- Specified by:
- getModelin interface- IVerticalRulerInfoExtension
- Returns:
- this ruler's annotation model or nullif there is no model
 
- 
updatepublic void update()Description copied from interface:IVerticalRulerForces the vertical ruler to synchronize itself with its annotation model and its viewer's view port.- Specified by:
- updatein interface- IVerticalRuler
 
- 
immediateUpdatepublic void immediateUpdate()Immediately redraws the entire ruler (without asynchronous posting).- Since:
- 3.2
 
- 
setFontDescription copied from interface:IVerticalRulerExtensionSets the font of this vertical ruler.- Specified by:
- setFontin interface- IVerticalRulerExtension
- Parameters:
- font- the new font of the vertical ruler
 
- 
getWidthpublic int getWidth()Description copied from interface:IVerticalRulerInfoReturns the width of this ruler's control.- Specified by:
- getWidthin interface- IVerticalRulerInfo
- Returns:
- the width of this ruler's control
 
- 
getLineOfLastMouseButtonActivitypublic 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 interface- IVerticalRulerInfo
- Returns:
- the line number of the last mouse button activity or -1if the last mouse activity does not correspond to a valid document line
 
- 
toDocumentLineNumberpublic 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 interface- IVerticalRulerInfo
- 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
 
- 
widgetLine2ModelLineReturns the line in the given viewer's document that correspond to the given line of the viewer's widget.- Parameters:
- viewer- the viewer
- widgetLine- the widget line
- Returns:
- the corresponding line the viewer's document
- Since:
- 2.1
 
- 
getTextViewerReturns this ruler's text viewer.- Returns:
- this ruler's text viewer
 
- 
setLocationOfLastMouseButtonActivitypublic void setLocationOfLastMouseButtonActivity(int x, int y) Description copied from interface:IVerticalRulerExtensionSets the location of the last mouse button activity. This method is used for example by external mouse listeners.- Specified by:
- setLocationOfLastMouseButtonActivityin interface- IVerticalRulerExtension
- Parameters:
- x- the x-coordinate
- y- the y-coordinate
 
- 
getDecoratorIteratorReturns an iterator over theIVerticalRulerColumnsthat make up this composite column.- Returns:
- an iterator over the contained columns.
- Since:
- 3.0
 
- 
getHoverDescription copied from interface:IVerticalRulerInfoExtensionReturns the hover for this vertical ruler (column).- Specified by:
- getHoverin interface- IVerticalRulerInfoExtension
- Returns:
- the hover for this column
 
- 
addVerticalRulerListenerDescription copied from interface:IVerticalRulerInfoExtensionRegisters a vertical ruler listener to be informed if an annotation gets selected on the vertical ruler.- Specified by:
- addVerticalRulerListenerin interface- IVerticalRulerInfoExtension
- Parameters:
- listener- the listener to be informed
 
- 
removeVerticalRulerListenerDescription copied from interface:IVerticalRulerInfoExtensionRemoves a previously registered listener. Iflisteneris not registered with the receiver, calling this method has no effect.- Specified by:
- removeVerticalRulerListenerin interface- IVerticalRulerInfoExtension
- Parameters:
- listener- the listener to be removed
 
- 
fireAnnotationSelectedFires the annotation selected event to all registered vertical ruler listeners. TODO use robust iterators- Parameters:
- event- the event to fire
- Since:
- 3.0
 
- 
fireAnnotationDefaultSelectedFires the annotation default selected event to all registered vertical ruler listeners. TODO use robust iterators- Parameters:
- event- the event to fire
- Since:
- 3.0
 
- 
fireAnnotationContextMenuAboutToShowInforms all registered vertical ruler listeners that the content menu on a selected annotation\ is about to be shown. TODO use robust iterators- Parameters:
- event- the event to fire
- menu- the menu that is about to be shown
- Since:
- 3.0
 
- 
relayoutpublic void relayout()Relayouts the receiver.- Since:
- 3.3
 
 
-