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
Answertopia.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 LineChangeHover


java.lang.Object
  extended by 
org.eclipse.jface.text.source.LineChangeHover
All Implemented Interfaces:
IInformationProviderExtension2, IAnnotationHover, IAnnotationHoverExtension

public class LineChangeHover
extends Object
implements IAnnotationHover, IAnnotationHoverExtension, IInformationProviderExtension2

A hover for line oriented diffs. It determines the text to show as hover for a certain line in the document.

Since:
3.0

Constructor Summary
LineChangeHover ()
           
 
Method Summary
 boolean canHandleMouseCursor ()
          Returns whether the provided information control can interact with the mouse cursor.
protected   Point computeLineRange ( ISourceViewer viewer, int line, int min, int max)
          Computes the block of lines which form a contiguous block of changes covering line.
protected   String decorateText ( List diffInfos, int maxLines)
          Takes a list of ILineDiffInfos and computes a hover of at most maxLines.
protected   String formatSource ( String content)
          Formats the source w/ syntax coloring etc.
  IInformationControlCreator getHoverControlCreator ()
          Returns the hover control creator of this annotation hover.
  Object getHoverInfo ( ISourceViewer sourceViewer, ILineRange lineRange, int visibleLines)
          Returns the object which should be presented in the a hover popup window.
  String getHoverInfo ( ISourceViewer sourceViewer, int lineNumber)
          Returns the text which should be presented in the a hover popup window.
  ILineRange getHoverLineRange ( ISourceViewer viewer, int lineNumber)
          Returns the range of lines that include the given line number for which the same hover information is valid.
  IInformationControlCreator getInformationPresenterControlCreator ()
          Returns the information control creator of this information provider.
protected   String getTabReplacement ()
          Returns a replacement for the tab character.
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LineChangeHover

public LineChangeHover()
Method Detail

getHoverInfo

public 
String getHoverInfo(
ISourceViewer sourceViewer,
                           int lineNumber)
Description copied from interface: IAnnotationHover
Returns the text which should be presented in the a hover popup window. This information is requested based on the specified line number.

Specified by:
getHoverInfo in interface IAnnotationHover
Parameters:
sourceViewer - the source viewer this hover is registered with
lineNumber - the line number for which information is requested
Returns:
the requested information or null if no such information exists

formatSource

protected 
String formatSource(
String content)
Formats the source w/ syntax coloring etc. This implementation replaces tabs with spaces. May be overridden by subclasses.

Parameters:
content - the hover content
Returns:
content reformatted

getTabReplacement

protected 
String getTabReplacement()
Returns a replacement for the tab character. The default implementation returns a tabulator character, but subclasses may override to specify a number of spaces.

Returns:
a whitespace String that will be substituted for the tabulator character

decorateText

protected 
String decorateText(
List diffInfos,
                              int maxLines)
Takes a list of ILineDiffInfos and computes a hover of at most maxLines. Added lines are prefixed with a '+', changed lines with '>' and deleted lines with '-'.

Deleted and added lines can even each other out, so that a number of deleted lines get displayed where - in the current document - the added lines are.

Parameters:
diffInfos - a List of ILineDiffInfo
maxLines - the maximum number of lines. Note that adding up all annotations might give more than that due to deleted lines.
Returns:
a String suitable for hover display

computeLineRange

protected 
Point computeLineRange(
ISourceViewer viewer,
                                 int line,
                                 int min,
                                 int max)
Computes the block of lines which form a contiguous block of changes covering line.

Parameters:
viewer - the source viewer showing
line - the line which a hover is displayed for
min - the first line in viewer's document to consider
max - the last line in viewer's document to consider
Returns:
the selection in the document displayed in viewer containing line that is covered by the hover information returned by the receiver.

getHoverInfo

public 
Object getHoverInfo(
ISourceViewer sourceViewer,
                           
ILineRange lineRange,
                           int visibleLines)
Description copied from interface: IAnnotationHoverExtension
Returns the object which should be presented in the a hover popup window. The information is requested based on the specified line range.

Specified by:
getHoverInfo in interface IAnnotationHoverExtension
Parameters:
sourceViewer - the source viewer this hover is registered with
lineRange - the line range for which information is requested
visibleLines - the number of visible lines
Returns:
the requested information or null if no such information exists

getHoverLineRange

public 
ILineRange getHoverLineRange(
ISourceViewer viewer,
                                    int lineNumber)
Description copied from interface: IAnnotationHoverExtension
Returns the range of lines that include the given line number for which the same hover information is valid.

Specified by:
getHoverLineRange in interface IAnnotationHoverExtension
Parameters:
viewer - the viewer which the hover is queried for
lineNumber - the line number of the line for which a hover is displayed for
Returns:
the computed line range or null for no range

canHandleMouseCursor

public boolean canHandleMouseCursor()
Description copied from interface: IAnnotationHoverExtension
Returns whether the provided information control can interact with the mouse cursor. I.e. the hover must implement custom information control management.

Specified by:
canHandleMouseCursor in interface IAnnotationHoverExtension
Returns:
true if the mouse cursor can be handled

getHoverControlCreator

public 
IInformationControlCreator getHoverControlCreator()
Description copied from interface: IAnnotationHoverExtension
Returns the hover control creator of this annotation hover.

Specified by:
getHoverControlCreator in interface IAnnotationHoverExtension
Returns:
the hover control creator

getInformationPresenterControlCreator

public 
IInformationControlCreator getInformationPresenterControlCreator()
Description copied from interface: IInformationProviderExtension2
Returns the information control creator of this information provider.

Specified by:
getInformationPresenterControlCreator in interface IInformationProviderExtension2
Returns:
the information control creator or null if none is available

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