public class CompositeRuler extends Object implements IVerticalRuler, IVerticalRulerExtension, IVerticalRulerInfoExtension
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.
IVerticalRulerColumn,
ITextViewer| Constructor and Description |
|---|
CompositeRuler()
Constructs a new composite vertical ruler.
|
CompositeRuler(int gap)
Constructs a new composite ruler with the given gap between its columns.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addDecorator(int index,
IVerticalRulerColumn rulerColumn)
Inserts the given column at the specified slot to this composite ruler.
|
void |
addVerticalRulerListener(IVerticalRulerListener listener)
Registers a vertical ruler listener to be informed if an annotation gets
selected on the vertical ruler.
|
Control |
createControl(Composite parent,
ITextViewer textViewer)
Creates the ruler's SWT control.
|
void |
fireAnnotationContextMenuAboutToShow(VerticalRulerEvent event,
Menu menu)
Informs all registered vertical ruler listeners that the content menu on a selected annotation\
is about to be shown.
|
void |
fireAnnotationDefaultSelected(VerticalRulerEvent event)
Fires the annotation default selected event to all registered vertical
ruler listeners.
|
void |
fireAnnotationSelected(VerticalRulerEvent event)
Fires the annotation selected event to all registered vertical ruler
listeners.
|
Control |
getControl()
Returns the ruler's SWT control.
|
Iterator |
getDecoratorIterator()
Returns an iterator over the
IVerticalRulerColumns that make up this
composite column. |
IAnnotationHover |
getHover()
Returns the hover for this vertical ruler (column).
|
int |
getLineOfLastMouseButtonActivity()
Returns the line number of the last mouse button activity.
|
IAnnotationModel |
getModel()
Returns the current annotation model of this ruler or
null
if the ruler has no model. |
ITextViewer |
getTextViewer()
Returns this ruler's text viewer.
|
int |
getWidth()
Returns the width of this ruler's control.
|
void |
immediateUpdate()
Immediately redraws the entire ruler (without asynchronous posting).
|
void |
removeDecorator(int index)
Removes the decorator in the specified slot from this composite ruler.
|
void |
removeDecorator(IVerticalRulerColumn rulerColumn)
Removes the given decorator from the composite ruler.
|
void |
removeVerticalRulerListener(IVerticalRulerListener listener)
Removes a previously registered listener.
|
void |
setFont(Font font)
Sets the font of this vertical ruler.
|
void |
setLocationOfLastMouseButtonActivity(int x,
int y)
Sets the location of the last mouse button activity.
|
void |
setModel(IAnnotationModel model)
Associates an annotation model with this ruler.
|
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.
|
void |
update()
Forces the vertical ruler to synchronize itself with its
annotation model and its viewer's view port.
|
protected static int |
widgetLine2ModelLine(ITextViewer viewer,
int widgetLine)
Returns the line in the given viewer's document that correspond to the given
line of the viewer's widget.
|
public CompositeRuler()
public CompositeRuler(int gap)
gap - public void addDecorator(int index,
IVerticalRulerColumn rulerColumn)
index - the indexrulerColumn - the decorator to be insertedpublic void removeDecorator(int index)
index - the indexpublic void removeDecorator(IVerticalRulerColumn rulerColumn)
rulerColumn - the ruler column to be removedpublic Control getControl()
IVerticalRulerInfogetControl in interface IVerticalRulerInfopublic Control createControl(Composite parent, ITextViewer textViewer)
IVerticalRulercreateControl in interface IVerticalRulerparent - the parent control of the ruler's controltextViewer - the text viewer to which this ruler belongspublic void setModel(IAnnotationModel model)
IVerticalRulernull is acceptable and clears the ruler.setModel in interface IVerticalRulermodel - the new annotation model, may be nullpublic IAnnotationModel getModel()
IVerticalRulernull
if the ruler has no model.getModel in interface IVerticalRulergetModel in interface IVerticalRulerInfoExtensionnull if there is no modelpublic void update()
IVerticalRulerupdate in interface IVerticalRulerpublic void immediateUpdate()
public void setFont(Font font)
IVerticalRulerExtensionsetFont in interface IVerticalRulerExtensionfont - the new font of the vertical rulerpublic int getWidth()
IVerticalRulerInfogetWidth in interface IVerticalRulerInfopublic int getLineOfLastMouseButtonActivity()
IVerticalRulerInfo0.getLineOfLastMouseButtonActivity in interface IVerticalRulerInfopublic int toDocumentLineNumber(int y_coordinate)
IVerticalRulerInfotoDocumentLineNumber in interface IVerticalRulerInfoy_coordinate - a y-coordinate of the ruler's SWT control-1 if that
coordinate does not correspond to a valid document lineprotected static final int widgetLine2ModelLine(ITextViewer viewer, int widgetLine)
viewer - the viewerwidgetLine - the widget linepublic ITextViewer getTextViewer()
public void setLocationOfLastMouseButtonActivity(int x,
int y)
IVerticalRulerExtensionsetLocationOfLastMouseButtonActivity in interface IVerticalRulerExtensionx - the x-coordinatey - the y-coordinatepublic Iterator getDecoratorIterator()
IVerticalRulerColumns that make up this
composite column.public IAnnotationHover getHover()
IVerticalRulerInfoExtensiongetHover in interface IVerticalRulerInfoExtensionpublic void addVerticalRulerListener(IVerticalRulerListener listener)
IVerticalRulerInfoExtensionaddVerticalRulerListener in interface IVerticalRulerInfoExtensionlistener - the listener to be informedpublic void removeVerticalRulerListener(IVerticalRulerListener listener)
IVerticalRulerInfoExtensionlistener is not registered
with the receiver, calling this method has no effect.removeVerticalRulerListener in interface IVerticalRulerInfoExtensionlistener - the listener to be removedpublic void fireAnnotationSelected(VerticalRulerEvent event)
event - the event to firepublic void fireAnnotationDefaultSelected(VerticalRulerEvent event)
event - the event to firepublic void fireAnnotationContextMenuAboutToShow(VerticalRulerEvent event, Menu menu)
event - the event to firemenu - the menu that is about to be shownGuidelines for using Eclipse APIs. Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.