public class DefaultHyperlinkPresenter extends Object implements IHyperlinkPresenter, IHyperlinkPresenterExtension, ITextPresentationListener, ITextInputListener, IDocumentListener, IPropertyChangeListener
It can only be used together with the HyperlinkManager.FIRST
or the HyperlinkManager.LONGEST_REGION_FIRST
hyperlink strategy.
Modifier and Type | Field and Description |
---|---|
static String |
HYPERLINK_COLOR
A named preference that holds the color used for hyperlinks.
|
static String |
HYPERLINK_COLOR_SYSTEM_DEFAULT
A named preference that holds the preference whether to use the native link color.
|
Constructor and Description |
---|
DefaultHyperlinkPresenter(Color color)
Creates a new default hyperlink presenter.
|
DefaultHyperlinkPresenter(IPreferenceStore store)
Creates a new default hyperlink presenter which uses
HYPERLINK_COLOR to read the color from the given preference store. |
DefaultHyperlinkPresenter(RGB color)
Creates a new default hyperlink presenter.
|
Modifier and Type | Method and Description |
---|---|
void |
applyTextPresentation(TextPresentation textPresentation)
This method is called when a text presentation is about to be applied to
the text viewer.
|
boolean |
canHideHyperlinks()
Tells whether the currently shown hyperlinks
can be hidden.
|
boolean |
canShowMultipleHyperlinks()
Tells whether this presenter is able to handle
more than one hyperlink.
|
void |
documentAboutToBeChanged(DocumentEvent event)
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 |
hideHyperlinks()
Tells this hyperlink presenter to hide the hyperlinks
requested to be shown by
IHyperlinkPresenter.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 |
propertyChange(PropertyChangeEvent event)
Notification that a property has changed.
|
void |
setColor(Color color)
Sets the hyperlink foreground color.
|
void |
showHyperlinks(IHyperlink[] hyperlinks)
Tells this hyperlink presenter to show the given
hyperlinks on the installed text viewer.
|
void |
uninstall()
Uninstalls this hyperlink presenter.
|
public static final String HYPERLINK_COLOR
Value is of type String
. A RGB color value encoded as a string using class
PreferenceConverter
.
StringConverter
,
PreferenceConverter
,
Constant Field Valuespublic static final String HYPERLINK_COLOR_SYSTEM_DEFAULT
The preference value is of type Boolean
.
public DefaultHyperlinkPresenter(IPreferenceStore store)
HYPERLINK_COLOR
to read the color from the given preference store.store
- the preference storepublic DefaultHyperlinkPresenter(Color color)
color
- the hyperlink color or null
if the existing text color should be
preserved; to be disposed by the callerpublic DefaultHyperlinkPresenter(RGB color)
color
- the hyperlink color or null
if the existing text color should be
preservedpublic boolean canShowMultipleHyperlinks()
IHyperlinkPresenter
canShowMultipleHyperlinks
in interface IHyperlinkPresenter
true
if this presenter can handle more than one hyperlinkpublic void showHyperlinks(IHyperlink[] hyperlinks)
IHyperlinkPresenter
showHyperlinks
in interface IHyperlinkPresenter
hyperlinks
- the hyperlinks to showpublic boolean canHideHyperlinks()
canHideHyperlinks
in interface IHyperlinkPresenterExtension
true
if the hyperlink manager can hide the current hyperlinkspublic void hideHyperlinks()
IHyperlinkPresenter
IHyperlinkPresenter.showHyperlinks(IHyperlink[])
.hideHyperlinks
in interface IHyperlinkPresenter
public void install(ITextViewer textViewer)
IHyperlinkPresenter
install
in interface IHyperlinkPresenter
textViewer
- the text viewerpublic void uninstall()
IHyperlinkPresenter
uninstall
in interface IHyperlinkPresenter
public void setColor(Color color)
color
- the hyperlink foreground color or null
if the existing text color
should be preservedpublic void applyTextPresentation(TextPresentation textPresentation)
ITextPresentationListener
applyTextPresentation
in interface ITextPresentationListener
textPresentation
- the current text presentationpublic void documentAboutToBeChanged(DocumentEvent event)
IDocumentListener
documentAboutToBeChanged
in interface IDocumentListener
event
- the document event describing the document changepublic void documentChanged(DocumentEvent event)
IDocumentListener
documentChanged
in interface IDocumentListener
event
- the document event describing the document changepublic void inputDocumentAboutToBeChanged(IDocument oldInput, IDocument newInput)
ITextInputListener
inputDocumentAboutToBeChanged
in interface ITextInputListener
oldInput
- the text viewer's previous input documentnewInput
- the text viewer's new input documentpublic void inputDocumentChanged(IDocument oldInput, IDocument newInput)
ITextInputListener
inputDocumentChanged
in interface ITextInputListener
oldInput
- the text viewer's previous input documentnewInput
- the text viewer's new input documentpublic void propertyChange(PropertyChangeEvent event)
IPropertyChangeListener
This method gets called when the observed object fires a property change event.
propertyChange
in interface IPropertyChangeListener
event
- the property change event object describing which property
changed and how
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.