Eclipse Platform
Release 3.1

org.eclipse.jface.text.hyperlink
Class HyperlinkManager

java.lang.Object
  extended byorg.eclipse.jface.text.hyperlink.HyperlinkManager
All Implemented Interfaces:
EventListener, FocusListener, KeyListener, MouseListener, MouseMoveListener, org.eclipse.swt.internal.SWTEventListener

public class HyperlinkManager
extends Object
implements KeyListener, MouseListener, MouseMoveListener, FocusListener

Default implementation of a hyperlink manager.

Since:
3.1

Field Summary
static org.eclipse.jface.text.hyperlink.HyperlinkManager.DETECTION_STRATEGY ALL
          All detected hyperlinks from all detectors are collected and passed to the hyperlink presenter.
static org.eclipse.jface.text.hyperlink.HyperlinkManager.DETECTION_STRATEGY FIRST
          The first detected hyperlink is passed to the hyperlink presenter and no further detector is consulted.
static org.eclipse.jface.text.hyperlink.HyperlinkManager.DETECTION_STRATEGY LONGEST_REGION_ALL
          All detected hyperlinks from all detectors are collected and all those with the longest region are passed to the hyperlink presenter.
static org.eclipse.jface.text.hyperlink.HyperlinkManager.DETECTION_STRATEGY LONGEST_REGION_FIRST
          All detected hyperlinks from all detectors are collected and form all those with the longest region only the first one is passed to the hyperlink presenter.
 
Constructor Summary
HyperlinkManager(org.eclipse.jface.text.hyperlink.HyperlinkManager.DETECTION_STRATEGY detectionStrategy)
          Creates a new hyperlink manager.
 
Method Summary
protected  int computeLongestHyperlinkLength(List hyperlinks)
           
protected  void deactivate()
           
protected  IHyperlink[] findHyperlinks()
           
 void focusGained(FocusEvent e)
          Sent when a control gets focus.
 void focusLost(FocusEvent event)
          Sent when a control loses focus.
protected  int getCurrentTextOffset()
           
 void install(ITextViewer textViewer, IHyperlinkPresenter hyperlinkPresenter, IHyperlinkDetector[] hyperlinkDetectors, int eventStateMask)
          Installs this hyperlink manager with the given arguments.
 void keyPressed(KeyEvent event)
          Sent when a key is pressed on the system keyboard.
 void keyReleased(KeyEvent event)
          Sent when a key is released on the system keyboard.
 void mouseDoubleClick(MouseEvent e)
          Sent when a mouse button is pressed twice within the (operating system specified) double click period.
 void mouseDown(MouseEvent event)
          Sent when a mouse button is pressed.
 void mouseMove(MouseEvent event)
          Sent when the mouse moves.
 void mouseUp(MouseEvent e)
          Sent when a mouse button is released.
 void setHyperlinkDetectors(IHyperlinkDetector[] hyperlinkDetectors)
          Sets the hyperlink detectors for this hyperlink manager.
 void setHyperlinkStateMask(int eventStateMask)
          Sets the SWT event state mask which in combination with the left mouse button triggers the hyperlink mode.
 void uninstall()
          Uninstalls this hyperlink manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FIRST

public static final org.eclipse.jface.text.hyperlink.HyperlinkManager.DETECTION_STRATEGY FIRST
The first detected hyperlink is passed to the hyperlink presenter and no further detector is consulted.


ALL

public static final org.eclipse.jface.text.hyperlink.HyperlinkManager.DETECTION_STRATEGY ALL
All detected hyperlinks from all detectors are collected and passed to the hyperlink presenter.

This strategy is only allowed if IHyperlinkPresenter.canShowMultipleHyperlinks() returns true.


LONGEST_REGION_ALL

public static final org.eclipse.jface.text.hyperlink.HyperlinkManager.DETECTION_STRATEGY LONGEST_REGION_ALL
All detected hyperlinks from all detectors are collected and all those with the longest region are passed to the hyperlink presenter.

This strategy is only allowed if IHyperlinkPresenter.canShowMultipleHyperlinks() returns true.


LONGEST_REGION_FIRST

public static final org.eclipse.jface.text.hyperlink.HyperlinkManager.DETECTION_STRATEGY LONGEST_REGION_FIRST
All detected hyperlinks from all detectors are collected and form all those with the longest region only the first one is passed to the hyperlink presenter.

Constructor Detail

HyperlinkManager

public HyperlinkManager(org.eclipse.jface.text.hyperlink.HyperlinkManager.DETECTION_STRATEGY detectionStrategy)
Creates a new hyperlink manager.

Parameters:
detectionStrategy - the detection strategy one of {ALL, FIRST, LONGEST_REGION_ALL, LONGEST_REGION_FIRST}
Method Detail

install

public void install(ITextViewer textViewer,
                    IHyperlinkPresenter hyperlinkPresenter,
                    IHyperlinkDetector[] hyperlinkDetectors,
                    int eventStateMask)
Installs this hyperlink manager with the given arguments.

Parameters:
textViewer - the text viewer
hyperlinkPresenter - the hyperlink presenter
hyperlinkDetectors - the array of hyperlink detectors, must not be empty
eventStateMask - the SWT event state mask to activate hyperlink mode

setHyperlinkDetectors

public void setHyperlinkDetectors(IHyperlinkDetector[] hyperlinkDetectors)
Sets the hyperlink detectors for this hyperlink manager.

It is allowed to call this method after this hyperlink manger has been installed.

Parameters:
hyperlinkDetectors - and array of hyperlink detectors, must not be empty

setHyperlinkStateMask

public void setHyperlinkStateMask(int eventStateMask)
Sets the SWT event state mask which in combination with the left mouse button triggers the hyperlink mode.

It is allowed to call this method after this hyperlink manger has been installed.

Parameters:
eventStateMask - the SWT event state mask to activate hyperlink mode

uninstall

public void uninstall()
Uninstalls this hyperlink manager.


deactivate

protected void deactivate()

findHyperlinks

protected IHyperlink[] findHyperlinks()

computeLongestHyperlinkLength

protected int computeLongestHyperlinkLength(List hyperlinks)

getCurrentTextOffset

protected int getCurrentTextOffset()

keyPressed

public void keyPressed(KeyEvent event)
Description copied from interface: KeyListener
Sent when a key is pressed on the system keyboard.

Specified by:
keyPressed in interface KeyListener
Parameters:
event - an event containing information about the key press

keyReleased

public void keyReleased(KeyEvent event)
Description copied from interface: KeyListener
Sent when a key is released on the system keyboard.

Specified by:
keyReleased in interface KeyListener
Parameters:
event - an event containing information about the key release

mouseDoubleClick

public void mouseDoubleClick(MouseEvent e)
Description copied from interface: MouseListener
Sent when a mouse button is pressed twice within the (operating system specified) double click period.

Specified by:
mouseDoubleClick in interface MouseListener
Parameters:
e - an event containing information about the mouse double click
See Also:
Display.getDoubleClickTime()

mouseDown

public void mouseDown(MouseEvent event)
Description copied from interface: MouseListener
Sent when a mouse button is pressed.

Specified by:
mouseDown in interface MouseListener
Parameters:
event - an event containing information about the mouse button press

mouseUp

public void mouseUp(MouseEvent e)
Description copied from interface: MouseListener
Sent when a mouse button is released.

Specified by:
mouseUp in interface MouseListener
Parameters:
e - an event containing information about the mouse button release

mouseMove

public void mouseMove(MouseEvent event)
Description copied from interface: MouseMoveListener
Sent when the mouse moves.

Specified by:
mouseMove in interface MouseMoveListener
Parameters:
event - an event containing information about the mouse move

focusGained

public void focusGained(FocusEvent e)
Description copied from interface: FocusListener
Sent when a control gets focus.

Specified by:
focusGained in interface FocusListener
Parameters:
e - an event containing information about the focus change

focusLost

public void focusLost(FocusEvent event)
Description copied from interface: FocusListener
Sent when a control loses focus.

Specified by:
focusLost in interface FocusListener
Parameters:
event - an event containing information about the focus change

Eclipse Platform
Release 3.1

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2005. All rights reserved.