com.ibm.lpex.alef
Class LpexVerticalRuler

java.lang.Object
  |
  +--com.ibm.lpex.alef.LpexVerticalRuler
All Implemented Interfaces:
org.eclipse.jface.text.source.IVerticalRuler

public final class LpexVerticalRuler
extends java.lang.Object
implements org.eclipse.jface.text.source.IVerticalRuler

The class implements a vertical ruler which is connected to an LpexTextViewer.

See Also:
ITextViewer, IVerticalRuler

Constructor Summary
LpexVerticalRuler(int width)
          Constructs a vertical ruler with the given width.
 
Method Summary
 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.
 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()
           
 void setModel(org.eclipse.jface.text.source.IAnnotationModel model)
          Associate an annotation model with this vertical ruler.
 int toDocumentLineNumber(int y_coordinate)
          Translate 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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
Method Detail

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.IVerticalRuler
See Also:
IVerticalRuler.getControl()

getWidth

public int getWidth()
Specified by:
getWidth in interface org.eclipse.jface.text.source.IVerticalRuler
See Also:
IVerticalRuler.getWidth()

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
See Also:
IVerticalRuler.createControl(org.eclipse.swt.widgets.Composite, org.eclipse.jface.text.ITextViewer)

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()

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.IVerticalRuler
See Also:
IVerticalRuler.getLineOfLastMouseButtonActivity()

toDocumentLineNumber

public int toDocumentLineNumber(int y_coordinate)
Translate 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.
Specified by:
toDocumentLineNumber in interface org.eclipse.jface.text.source.IVerticalRuler
Returns:
ZERO-based document-section line number, or -1 if no corresponding document-section line
See Also:
IVerticalRuler.toDocumentLineNumber(int)