Package org.eclipse.jface.text.hyperlink
Class DefaultHyperlinkPresenter
java.lang.Object
org.eclipse.jface.text.hyperlink.DefaultHyperlinkPresenter
- All Implemented Interfaces:
EventListener
,IHyperlinkPresenter
,IHyperlinkPresenterExtension
,IDocumentListener
,ITextInputListener
,ITextPresentationListener
,ITextViewerLifecycle
,IPropertyChangeListener
- Direct Known Subclasses:
MultipleHyperlinkPresenter
public class DefaultHyperlinkPresenter
extends Object
implements IHyperlinkPresenter, IHyperlinkPresenterExtension, ITextPresentationListener, ITextInputListener, IDocumentListener, IPropertyChangeListener
The default hyperlink presenter underlines the
link and colors the line and the text with
the given color.
It can only be used together with the HyperlinkManager.FIRST
or the HyperlinkManager.LONGEST_REGION_FIRST
hyperlink strategy.
- Since:
- 3.1
-
Field Summary
-
Constructor Summary
ConstructorDescriptionCreates a new default hyperlink presenter which usesHYPERLINK_COLOR
to read the color from the given preference store.DefaultHyperlinkPresenter
(Color color) Creates a new default hyperlink presenter.DefaultHyperlinkPresenter
(RGB color) Creates a new default hyperlink presenter. -
Method Summary
Modifier and TypeMethodDescriptionvoid
applyTextPresentation
(TextPresentation textPresentation) This method is called when a text presentation is about to be applied to the text viewer.boolean
Tells whether the currently shown hyperlinks can be hidden.boolean
Tells whether this presenter is able to handle more than one hyperlink.void
The manipulation described by the document event will be performed.void
documentChanged
(DocumentEvent event) The manipulation described by the document event has been performed.void
Tells this hyperlink presenter to hide the hyperlinks requested to be shown byIHyperlinkPresenter.showHyperlinks(IHyperlink[])
.void
inputDocumentAboutToBeChanged
(IDocument oldInput, IDocument newInput) Called before the input document is replaced.void
inputDocumentChanged
(IDocument oldInput, IDocument newInput) Called after the input document has been replaced.void
install
(ITextViewer textViewer) Installs this hyperlink presenter on the given text viewer.void
Notification that a property has changed.void
Sets the hyperlink foreground color.void
showHyperlinks
(IHyperlink[] hyperlinks) Tells this hyperlink presenter to show the given hyperlinks on the installed text viewer.void
Uninstalls this hyperlink presenter.
-
Field Details
-
HYPERLINK_COLOR
A named preference that holds the color used for hyperlinks.Value is of type
String
. A RGB color value encoded as a string using classPreferenceConverter
. -
HYPERLINK_COLOR_SYSTEM_DEFAULT
A named preference that holds the preference whether to use the native link color.The preference value is of type
Boolean
.- Since:
- 3.5
- See Also:
-
-
Constructor Details
-
DefaultHyperlinkPresenter
Creates a new default hyperlink presenter which usesHYPERLINK_COLOR
to read the color from the given preference store.- Parameters:
store
- the preference store
-
DefaultHyperlinkPresenter
Creates a new default hyperlink presenter.- Parameters:
color
- the hyperlink color ornull
if the existing text color should be preserved; to be disposed by the caller
-
DefaultHyperlinkPresenter
Creates a new default hyperlink presenter.- Parameters:
color
- the hyperlink color ornull
if the existing text color should be preserved
-
-
Method Details
-
canShowMultipleHyperlinks
public boolean canShowMultipleHyperlinks()Description copied from interface:IHyperlinkPresenter
Tells whether this presenter is able to handle more than one hyperlink.- Specified by:
canShowMultipleHyperlinks
in interfaceIHyperlinkPresenter
- Returns:
true
if this presenter can handle more than one hyperlink
-
showHyperlinks
Description copied from interface:IHyperlinkPresenter
Tells this hyperlink presenter to show the given hyperlinks on the installed text viewer.- Specified by:
showHyperlinks
in interfaceIHyperlinkPresenter
- Parameters:
hyperlinks
- the hyperlinks to show
-
canHideHyperlinks
public boolean canHideHyperlinks()Tells whether the currently shown hyperlinks can be hidden.- Specified by:
canHideHyperlinks
in interfaceIHyperlinkPresenterExtension
- Returns:
true
if the hyperlink manager can hide the current hyperlinks- Since:
- 3.4
-
hideHyperlinks
public void hideHyperlinks()Description copied from interface:IHyperlinkPresenter
Tells this hyperlink presenter to hide the hyperlinks requested to be shown byIHyperlinkPresenter.showHyperlinks(IHyperlink[])
.- Specified by:
hideHyperlinks
in interfaceIHyperlinkPresenter
-
install
Description copied from interface:IHyperlinkPresenter
Installs this hyperlink presenter on the given text viewer.- Specified by:
install
in interfaceIHyperlinkPresenter
- Specified by:
install
in interfaceITextViewerLifecycle
- Parameters:
textViewer
- the text viewer
-
uninstall
public void uninstall()Description copied from interface:IHyperlinkPresenter
Uninstalls this hyperlink presenter.- Specified by:
uninstall
in interfaceIHyperlinkPresenter
- Specified by:
uninstall
in interfaceITextViewerLifecycle
-
setColor
Sets the hyperlink foreground color.- Parameters:
color
- the hyperlink foreground color ornull
if the existing text color should be preserved
-
applyTextPresentation
Description copied from interface:ITextPresentationListener
This method is called when a text presentation is about to be applied to the text viewer. The receiver is allowed to change the text presentation during that call.- Specified by:
applyTextPresentation
in interfaceITextPresentationListener
- Parameters:
textPresentation
- the current text presentation
-
documentAboutToBeChanged
Description copied from interface:IDocumentListener
The manipulation described by the document event will be performed.- Specified by:
documentAboutToBeChanged
in interfaceIDocumentListener
- Parameters:
event
- the document event describing the document change
-
documentChanged
Description copied from interface:IDocumentListener
The manipulation described by the document event has been performed.- Specified by:
documentChanged
in interfaceIDocumentListener
- Parameters:
event
- the document event describing the document change
-
inputDocumentAboutToBeChanged
Description copied from interface:ITextInputListener
Called before the input document is replaced.- Specified by:
inputDocumentAboutToBeChanged
in interfaceITextInputListener
- Parameters:
oldInput
- the text viewer's previous input documentnewInput
- the text viewer's new input document
-
inputDocumentChanged
Description copied from interface:ITextInputListener
Called after the input document has been replaced.- Specified by:
inputDocumentChanged
in interfaceITextInputListener
- Parameters:
oldInput
- the text viewer's previous input documentnewInput
- the text viewer's new input document
-
propertyChange
Description copied from interface:IPropertyChangeListener
Notification that a property has changed.This method gets called when the observed object fires a property change event.
- Specified by:
propertyChange
in interfaceIPropertyChangeListener
- Parameters:
event
- the property change event object describing which property changed and how
-