Class InformationPresenter
- java.lang.Object
-
- org.eclipse.jface.text.AbstractInformationControlManager
-
- org.eclipse.jface.text.information.InformationPresenter
-
- All Implemented Interfaces:
IInformationPresenter,IInformationPresenterExtension,IWidgetTokenKeeper,IWidgetTokenKeeperExtension
public class InformationPresenter extends AbstractInformationControlManager implements IInformationPresenter, IInformationPresenterExtension, IWidgetTokenKeeper, IWidgetTokenKeeperExtension
Standard implementation ofIInformationPresenter. This implementation extendsAbstractInformationControlManager. The information control is made visible on request by callingshowInformationControl(Rectangle).Usually, clients instantiate this class and configure it before using it. The configuration must be consistent: This means the used
IInformationControlCreatormust create an information control expecting information in the same format the configuredIInformationProviders use to encode the information they provide.- Since:
- 2.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.jface.text.AbstractInformationControlManager
AbstractInformationControlManager.Anchor, AbstractInformationControlManager.IInformationControlCloser
-
-
Field Summary
Fields Modifier and Type Field Description static intWIDGET_PRIORITYPriority of the info controls managed by this information presenter.-
Fields inherited from class org.eclipse.jface.text.AbstractInformationControlManager
ANCHOR_BOTTOM, ANCHOR_GLOBAL, ANCHOR_LEFT, ANCHOR_RIGHT, ANCHOR_TOP, DEBUG, fDisposed, fInformationControl, fInformationControlCloser, fInformationControlCreator, STORE_LOCATION_X, STORE_LOCATION_Y, STORE_SIZE_HEIGHT, STORE_SIZE_WIDTH
-
-
Constructor Summary
Constructors Constructor Description InformationPresenter(IInformationControlCreator creator)Creates a new information presenter that uses the given information control creator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcomputeInformation()Computes the information to be displayed and the area in which the computed information is valid.StringgetDocumentPartitioning()Returns the document partitioning this information presenter is using.IInformationProvidergetInformationProvider(String contentType)Returns the information provider to be used for the given content type.protected voidhandleInformationControlDisposed()Handles the disposal of the information control.protected voidhideInformationControl()Hides the information control and stops the information control closer.voidinstall(ITextViewer textViewer)Installs the information presenter on the given text viewer.booleanrequestWidgetToken(IWidgetTokenOwner owner)The given widget token owner requests the widget token from this token keeper.booleanrequestWidgetToken(IWidgetTokenOwner owner, int priority)The given widget token owner requests the widget token from this token keeper.voidsetDocumentPartitioning(String partitioning)Sets the document partitioning to be used by this information presenter.booleansetFocus(IWidgetTokenOwner owner)Requests the receiver to give focus to its popup shell, hover, or similar.voidsetInformationProvider(IInformationProvider provider, String contentType)Registers a given information provider for a particular content type.voidsetOffset(int offset)Sets a offset to override the selection.protected voidshowInformationControl(Rectangle subjectArea)Shows the information control and starts the information control closer.voiduninstall()Removes the information presenter from the text viewer it has previously been installed on.-
Methods inherited from class org.eclipse.jface.text.AbstractInformationControlManager
canClearDataOnHide, computeAvailableArea, computeInformationControlLocation, computeLocation, computeSizeConstraints, computeSizeConstraints, dispose, disposeInformationControl, doShowInformation, getInformationControl, getInternalAccessor, getNextFallbackAnchor, getSubjectArea, getSubjectControl, handleSubjectControlDisposed, install, isEnabled, isTakingFocusWhenVisible, presentInformation, restoreInformationControlBounds, setAnchor, setCloser, setCustomInformationControlCreator, setEnabled, setFallbackAnchors, setInformation, setInformation, setMargins, setRestoreInformationControlBounds, setSizeConstraints, showInformation, storeInformationControlBounds, takesFocusWhenVisible, updateLocation
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.jface.text.information.IInformationPresenter
showInformation
-
-
-
-
Field Detail
-
WIDGET_PRIORITY
public static final int WIDGET_PRIORITY
Priority of the info controls managed by this information presenter. Default value:5.- Since:
- 3.0
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
InformationPresenter
public InformationPresenter(IInformationControlCreator creator)
Creates a new information presenter that uses the given information control creator. The presenter is not installed on any text viewer yet. By default, an information control closer is set that closes the information control in the event of key strokes, resizing, moves, focus changes, mouse clicks, and disposal - all of those applied to the information control's parent control. Also, the setup ensures that the information control when made visible will request the focus. By default, the default document partitioningIDocumentExtension3.DEFAULT_PARTITIONINGis used.- Parameters:
creator- the information control creator to be used
-
-
Method Detail
-
setDocumentPartitioning
public void setDocumentPartitioning(String partitioning)
Sets the document partitioning to be used by this information presenter.- Parameters:
partitioning- the document partitioning to be used by this information presenter- Since:
- 3.0
-
getDocumentPartitioning
public String getDocumentPartitioning()
Description copied from interface:IInformationPresenterExtensionReturns the document partitioning this information presenter is using.- Specified by:
getDocumentPartitioningin interfaceIInformationPresenterExtension- Returns:
- the document partitioning this information presenter is using
-
setInformationProvider
public void setInformationProvider(IInformationProvider provider, String contentType)
Registers a given information provider for a particular content type. If there is already a provider registered for this type, the new provider is registered instead of the old one.- Parameters:
provider- the information provider to register, ornullto remove an existing onecontentType- the content type under which to register
-
getInformationProvider
public IInformationProvider getInformationProvider(String contentType)
Description copied from interface:IInformationPresenterReturns the information provider to be used for the given content type.- Specified by:
getInformationProviderin interfaceIInformationPresenter- Parameters:
contentType- the type of the content for which information will be requested- Returns:
- an information provider or
nullif none exists for the specified content type
-
setOffset
public void setOffset(int offset)
Sets a offset to override the selection. Setting the value to-1will disable overriding.- Parameters:
offset- the offset to override selection or-1
-
computeInformation
protected void computeInformation()
Description copied from class:AbstractInformationControlManagerComputes the information to be displayed and the area in which the computed information is valid. Implementation of this method must finish their computation by setting the computation results usingsetInformation.- Specified by:
computeInformationin classAbstractInformationControlManager
-
install
public void install(ITextViewer textViewer)
Description copied from interface:IInformationPresenterInstalls the information presenter on the given text viewer. After this method has been finished, the presenter is operational, i.e. the methodIInformationPresenter.showInformation()can be called untilIInformationPresenter.uninstall()is called.- Specified by:
installin interfaceIInformationPresenter- Parameters:
textViewer- the viewer on which the presenter is installed
-
uninstall
public void uninstall()
Description copied from interface:IInformationPresenterRemoves the information presenter from the text viewer it has previously been installed on.- Specified by:
uninstallin interfaceIInformationPresenter
-
showInformationControl
protected void showInformationControl(Rectangle subjectArea)
Description copied from class:AbstractInformationControlManagerShows the information control and starts the information control closer. This method may not be called by clients.- Overrides:
showInformationControlin classAbstractInformationControlManager- Parameters:
subjectArea- the information area
-
hideInformationControl
protected void hideInformationControl()
Description copied from class:AbstractInformationControlManagerHides the information control and stops the information control closer.- Overrides:
hideInformationControlin classAbstractInformationControlManager
-
handleInformationControlDisposed
protected void handleInformationControlDisposed()
Description copied from class:AbstractInformationControlManagerHandles the disposal of the information control. By default, the information control closer is stopped.- Overrides:
handleInformationControlDisposedin classAbstractInformationControlManager
-
requestWidgetToken
public boolean requestWidgetToken(IWidgetTokenOwner owner)
Description copied from interface:IWidgetTokenKeeperThe given widget token owner requests the widget token from this token keeper. Returnstrueif the token is released by this token keeper. Note, the keeper must not callreleaseWidgetToken(IWidgetTokenKeeper)explicitly.Replaced by
IWidgetTokenKeeperExtension.requestWidgetToken(IWidgetTokenOwner, int).- Specified by:
requestWidgetTokenin interfaceIWidgetTokenKeeper- Parameters:
owner- the token owner- Returns:
trueif token has been releasedfalseotherwise
-
requestWidgetToken
public boolean requestWidgetToken(IWidgetTokenOwner owner, int priority)
Description copied from interface:IWidgetTokenKeeperExtensionThe given widget token owner requests the widget token from this token keeper. Returnstrueif the token is released by this token keeper. Note, the keeper must not callreleaseWidgetToken(IWidgetTokenKeeper)explicitly.The general contract is that the receiver should release the token if
priorityexceeds the receiver's priority.- Specified by:
requestWidgetTokenin interfaceIWidgetTokenKeeperExtension- Parameters:
owner- the token ownerpriority- the priority of the request- Returns:
trueif token has been releasedfalseotherwise
-
setFocus
public boolean setFocus(IWidgetTokenOwner owner)
Description copied from interface:IWidgetTokenKeeperExtensionRequests the receiver to give focus to its popup shell, hover, or similar. There is no assumption made whether the receiver actually succeeded in taking the focus. The return value gives a hint whether the receiver tried to take focus.- Specified by:
setFocusin interfaceIWidgetTokenKeeperExtension- Parameters:
owner- the token owner- Returns:
trueif the receiver tried to take focus,falseif it did not.
-
-