com.ibm.lpex.alef
Class LpexVerticalRuler
java.lang.Object
com.ibm.lpex.alef.LpexVerticalRuler
- All Implemented Interfaces:
- org.eclipse.jface.text.source.IVerticalRuler, org.eclipse.jface.text.source.IVerticalRulerExtension, org.eclipse.jface.text.source.IVerticalRulerInfo
- public final class LpexVerticalRuler
- extends Object
- implements org.eclipse.jface.text.source.IVerticalRuler, org.eclipse.jface.text.source.IVerticalRulerExtension
A vertical ruler which is connected to an LpexTextViewer.
This is a single-column standard implementation of IVerticalRuler
for LPEX. The same can be achieved by using a CompositeRuler
configured with an AnnotationRulerColumn.
Eclipse's org.eclipse.jface.text.source.VerticalRuler assumes StyledText as
the viewer's text widget. LPEX currently uses its own text widget.
- See Also:
- ITextViewer
Constructor Summary |
LpexVerticalRuler(int width)
Constructs a vertical ruler with the given width.
|
LpexVerticalRuler(int width,
org.eclipse.jface.text.source.IAnnotationAccess annotationAcccess)
Constructs a vertical ruler with the given width and the given annotation
access.
|
Method Summary |
void
| addMouseListener(org.eclipse.swt.events.MouseListener listener)
Deprecated. will be removed (as per Eclipse's VerticalRuler).
|
org.eclipse.swt.widgets.Control
| createControl(org.eclipse.swt.widgets.Composite parent,
org.eclipse.jface.text.ITextViewer textViewer)
Create the vertical ruler's SWT control, a Canvas,
for the LpexTextViewer specified.
|
protected void
| doPaint(org.eclipse.swt.graphics.GC gc)
Draws the vertical ruler annotations (without drawing the Canvas
background).
|
org.eclipse.swt.widgets.Control
| getControl()
Return the vertical ruler's SWT control, if any was created yet.
|
int
| getLineOfLastMouseButtonActivity()
Return the document line number in LpexTextViewer corresponding to the
last mouse-button activity inside the ruler.
|
org.eclipse.jface.text.source.IAnnotationModel
| getModel()
Return the current annotation model of this ruler, or null
if the ruler has no model.
|
int
| getWidth()
Returns the width of this ruler's control.
|
void
| removeMouseListener(org.eclipse.swt.events.MouseListener listener)
Deprecated. will be removed (as per Eclipse's VerticalRuler).
|
void
| setFont(org.eclipse.swt.graphics.Font font)
Set the font of this vertical ruler.
|
void
| setLocationOfLastMouseButtonActivity(int x,
int y)
Set the location of the last mouse button activity.
|
void
| setModel(org.eclipse.jface.text.source.IAnnotationModel model)
Associate an annotation model with this vertical ruler.
|
int
| toDocumentLineNumber(int y_coordinate)
Translates a y-coordinate of the vertical ruler's SWT Control into
the corresponding ZERO-based line number of the input document section
of the connected LpexTextViewer.
|
void
| update()
Force the vertical ruler to update.
|
protected static int
| widgetLine2ModelLine(LpexTextViewer viewer,
int widgetRow)
Returns the line of the viewer's document that corresponds to the given
row number in the LPEX text widget edit area.
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
|
LpexVerticalRuler
public LpexVerticalRuler(int width)
- Constructs a vertical ruler with the given width.
The actual vertical-ruler SWT control is only created when createControl()
is invoked.
- Parameters:
- width - the width of the vertical ruler
LpexVerticalRuler
public LpexVerticalRuler(int width,
org.eclipse.jface.text.source.IAnnotationAccess annotationAcccess)
- Constructs a vertical ruler with the given width and the given annotation
access.
- Parameters:
- width - the width of the vertical ruler
- annotationAcccess - the annotation access
getControl
public org.eclipse.swt.widgets.Control getControl()
- Return the vertical ruler's SWT control, if any was created yet.
- Specified by:
- getControl in interface org.eclipse.jface.text.source.IVerticalRulerInfo
- See Also:
- IVerticalRulerInfo.getControl()
createControl
public org.eclipse.swt.widgets.Control createControl(org.eclipse.swt.widgets.Composite parent,
org.eclipse.jface.text.ITextViewer textViewer)
- Create the vertical ruler's SWT control, a Canvas,
for the LpexTextViewer specified.
- Specified by:
- createControl in interface org.eclipse.jface.text.source.IVerticalRuler
- Parameters:
- textViewer - the LpexTextViewer associated with this ruler
- See Also:
- IVerticalRuler.createControl(org.eclipse.swt.widgets.Composite, org.eclipse.jface.text.ITextViewer)
doPaint
protected void doPaint(org.eclipse.swt.graphics.GC gc)
- Draws the vertical ruler annotations (without drawing the Canvas
background).
- Parameters:
- gc - the GC to draw on
update
public void update()
- Force the vertical ruler to update.
This method can be called from any thread.
- Specified by:
- update in interface org.eclipse.jface.text.source.IVerticalRuler
- See Also:
- IVerticalRuler.update()
setModel
public void setModel(org.eclipse.jface.text.source.IAnnotationModel model)
- Associate an annotation model with this vertical ruler.
If the ruler is visible, it must display those annotations of the
annotation model whose visual representation overlaps with the viewport
of the text viewer. A null value clears the ruler.
- Specified by:
- setModel in interface org.eclipse.jface.text.source.IVerticalRuler
- See Also:
- IVerticalRuler.setModel(org.eclipse.jface.text.source.IAnnotationModel)
getModel
public org.eclipse.jface.text.source.IAnnotationModel getModel()
- Return the current annotation model of this ruler, or null
if the ruler has no model.
- Specified by:
- getModel in interface org.eclipse.jface.text.source.IVerticalRuler
- See Also:
- IVerticalRuler.getModel()
getWidth
public int getWidth()
- Returns the width of this ruler's control.
- Specified by:
- getWidth in interface org.eclipse.jface.text.source.IVerticalRulerInfo
- See Also:
- IVerticalRulerInfo.getWidth()
getLineOfLastMouseButtonActivity
public int getLineOfLastMouseButtonActivity()
- Return the document line number in LpexTextViewer corresponding to the
last mouse-button activity inside the ruler.
- Specified by:
- getLineOfLastMouseButtonActivity in interface org.eclipse.jface.text.source.IVerticalRulerInfo
- See Also:
- IVerticalRulerInfo.getLineOfLastMouseButtonActivity()
toDocumentLineNumber
public int toDocumentLineNumber(int y_coordinate)
- Translates a y-coordinate of the vertical ruler's SWT Control into
the corresponding ZERO-based line number of the input document section
of the connected LpexTextViewer.
The vertical ruler works with the text viewer's primary LpexWindow and its
LpexView.
- Specified by:
- toDocumentLineNumber in interface org.eclipse.jface.text.source.IVerticalRulerInfo
- Returns:
- ZERO-based document-section line number, or
-1 if no corresponding document-section line - See Also:
- IVerticalRulerInfo.toDocumentLineNumber(int)
widgetLine2ModelLine
protected static final int widgetLine2ModelLine(LpexTextViewer viewer,
int widgetRow)
- Returns the line of the viewer's document that corresponds to the given
row number in the LPEX text widget edit area.
- Parameters:
- viewer - the LpexTextViewer
- widgetRow - the row in the LPEX text widget edit area
- Returns:
- the corresponding line of the viewer's document, or
-1 if the given row is beyond the number of rows in the edit area,
or doesn't correspond to a document line (it's a show line, an expand /
hide header, or is beyond the elements actually displayed in the edit area)
setFont
public void setFont(org.eclipse.swt.graphics.Font font)
- Set the font of this vertical ruler.
- Specified by:
- setFont in interface org.eclipse.jface.text.source.IVerticalRulerExtension
- See Also:
- IVerticalRulerExtension.setFont(org.eclipse.swt.graphics.Font)
setLocationOfLastMouseButtonActivity
public void setLocationOfLastMouseButtonActivity(int x,
int y)
- Set the location of the last mouse button activity.
- Specified by:
- setLocationOfLastMouseButtonActivity in interface org.eclipse.jface.text.source.IVerticalRulerExtension
- See Also:
- IVerticalRulerExtension.setLocationOfLastMouseButtonActivity(int, int)
addMouseListener
public void addMouseListener(org.eclipse.swt.events.MouseListener listener)
- Deprecated. will be removed (as per Eclipse's VerticalRuler).
- Adds the given mouse listener to this vertical ruler.
- Parameters:
- listener - the listener to be added
removeMouseListener
public void removeMouseListener(org.eclipse.swt.events.MouseListener listener)
- Deprecated. will be removed (as per Eclipse's VerticalRuler).
- Removes the given mouse listener from this vertical ruler.
- Parameters:
- listener - the listener to be removed