Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.jface.text.source
Class VerticalRuler

java.lang.Object
  extended by 
org.eclipse.jface.text.source.VerticalRuler
All Implemented Interfaces:
IVerticalRuler, IVerticalRulerExtension, IVerticalRulerInfo

public final class VerticalRuler
extends Object
implements IVerticalRuler, IVerticalRulerExtension

A vertical ruler which is connected to a text viewer. Single column standard implementation of IVerticalRuler.

The same can be achieved by using CompositeRuler configured with an AnnotationRulerColumn. Clients may use this class as is.

See Also:
ITextViewer

Constructor Summary
VerticalRuler (int width)
          Constructs a vertical ruler with the given width.
VerticalRuler (int width, IAnnotationAccess annotationAcccess)
          Constructs a vertical ruler with the given width and the given annotation access.
 
Method Summary
 void addMouseListener ( MouseListener listener)
          Deprecated. will be removed
  Control createControl ( Composite parent, ITextViewer textViewer)
          Creates the ruler's SWT control.
protected  void doPaint ( GC gc)
          Draws the vertical ruler w/o drawing the Canvas background.
protected  void doPaint1 ( GC gc)
          Draws the vertical ruler w/o drawing the Canvas background.
  Control getControl ()
          Returns the ruler's SWT control.
 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.
 int getWidth ()
          Returns the width of this ruler's control.
 void removeMouseListener ( MouseListener listener)
          Deprecated. will be removed
 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 ()
          Thread-safe implementation.
protected static int widgetLine2ModelLine ( ITextViewer viewer, int widgetLine)
          Returns the line of the viewer's document that corresponds to the given widget line.
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VerticalRuler

public VerticalRuler(int width)
Constructs a vertical ruler with the given width.

Parameters:
width - the width of the vertical ruler

VerticalRuler

public VerticalRuler(int width,
                     
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
Since:
3.0
Method Detail

getControl

public 
Control getControl()
Description copied from interface: IVerticalRulerInfo
Returns the ruler's SWT control.

Specified by:
getControl in interface IVerticalRulerInfo
Returns:
the ruler's SWT control

createControl

public 
Control createControl(
Composite parent,
                             
ITextViewer textViewer)
Description copied from interface: IVerticalRuler
Creates the ruler's SWT control.

Specified by:
createControl in 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

doPaint

protected void doPaint(
GC gc)
Draws the vertical ruler w/o drawing the Canvas background.

Parameters:
gc - the GC to draw into

doPaint1

protected void doPaint1(
GC gc)
Draws the vertical ruler w/o drawing the Canvas background. Uses ITextViewerExtension5 for its implementation. Will replace doPaint(GC).

Parameters:
gc - the GC to draw into

update

public void update()
Thread-safe implementation. Can be called from any thread.

Specified by:
update in interface IVerticalRuler

setModel

public void setModel(
IAnnotationModel model)
Description copied from interface: IVerticalRuler
Associates an annotation model with this ruler. A value null is acceptable and clears the ruler.

Specified by:
setModel in interface IVerticalRuler
Parameters:
model - the new annotation model, may be null

getModel

public 
IAnnotationModel getModel()
Description copied from interface: IVerticalRuler
Returns the current annotation model of this ruler or null if the ruler has no model.

Specified by:
getModel in interface IVerticalRuler
Returns:
this ruler's annotation model or null if there is no model

getWidth

public int getWidth()
Description copied from interface: IVerticalRulerInfo
Returns the width of this ruler's control.

Specified by:
getWidth in interface IVerticalRulerInfo
Returns:
the width of this ruler's control

getLineOfLastMouseButtonActivity

public int getLineOfLastMouseButtonActivity()
Description copied from interface: IVerticalRulerInfo
Returns the line number of the last mouse button activity. Based on the input document of the connected text viewer.

Specified by:
getLineOfLastMouseButtonActivity in interface IVerticalRulerInfo
Returns:
the line number of the last mouse button activity or -1 if the last mouse activity does not correspond to a valid document line

toDocumentLineNumber

public int toDocumentLineNumber(int y_coordinate)
Description copied from interface: IVerticalRulerInfo
Translates a y-coordinate of the ruler's SWT control into the according line number of the document of the connected text viewer.

Specified by:
toDocumentLineNumber in interface IVerticalRulerInfo
Parameters:
y_coordinate - a y-coordinate of the ruler's SWT control
Returns:
the line number of that coordinate or -1 if that coordinate does not correspond to a valid document line

widgetLine2ModelLine

protected static final int widgetLine2ModelLine(
ITextViewer viewer,
                                                int widgetLine)
Returns the line of the viewer's document that corresponds to the given widget line.

Parameters:
viewer - the viewer
widgetLine - the widget line
Returns:
the corresponding line of the viewer's document
Since:
2.1

setFont

public void setFont(
Font font)
Description copied from interface: IVerticalRulerExtension
Sets the font of this vertical ruler.

Specified by:
setFont in interface IVerticalRulerExtension
Parameters:
font - the new font of the vertical ruler

setLocationOfLastMouseButtonActivity

public void setLocationOfLastMouseButtonActivity(int x,
                                                 int y)
Description copied from interface: IVerticalRulerExtension
Sets the location of the last mouse button activity. This method is used for example by external mouse listeners.

Specified by:
setLocationOfLastMouseButtonActivity in interface IVerticalRulerExtension
Parameters:
x - the x-coordinate
y - the y-coordinate

addMouseListener

public void addMouseListener(
MouseListener listener)
Deprecated. will be removed

Adds the given mouse listener.

Parameters:
listener - the listener to be added
Since:
2.0

removeMouseListener

public void removeMouseListener(
MouseListener listener)
Deprecated. will be removed

Removes the given mouse listener.

Parameters:
listener - the listener to be removed
Since:
2.0

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire