Eclipse Platform
2.0

org.eclipse.jface.text.information
Class InformationPresenter

java.lang.Object
  |
  +--org.eclipse.jface.text.AbstractInformationControlManager
        |
        +--org.eclipse.jface.text.information.InformationPresenter
All Implemented Interfaces:
IInformationPresenter, IWidgetTokenKeeper

public class InformationPresenter
extends AbstractInformationControlManager
implements IInformationPresenter, IWidgetTokenKeeper

Standard implementation of IInformationPresenter. This implementation extends AbstractInformationControlManager. The information control is made visible on request by calling showInformation.

Usually, clients instantiate this class and configure it before using it. The configuration must be consistent: This means the used IInformationControlCreator must create an information control expecting information in the same format the configured IInformationProviders use to encode the information they provide.

Since:
2.0

Nested Class Summary
 
Nested classes inherited from class org.eclipse.jface.text.AbstractInformationControlManager
AbstractInformationControlManager.Anchor, AbstractInformationControlManager.IInformationControlCloser
 
Field Summary
 
Fields inherited from class org.eclipse.jface.text.AbstractInformationControlManager
ANCHOR_BOTTOM, ANCHOR_LEFT, ANCHOR_RIGHT, ANCHOR_TOP
 
Constructor Summary
InformationPresenter(IInformationControlCreator creator)
          Creates a new information presenter that uses the given information control creator.
 
Method Summary
protected  void computeInformation()
          Computes the information to be displayed and the area in which the computed information is valid.
 IInformationProvider getInformationProvider(String contentType)
          Returns the information provider to be used for the given content type.
protected  void handleInformationControlDisposed()
          Handles the disposal of the information control.
protected  void hideInformationControl()
          Hides the information control and stops the information control closer.
 void install(ITextViewer textViewer)
          Installs the information presenter on the given text viewer.
 boolean requestWidgetToken(IWidgetTokenOwner owner)
          The given widget token owner requests the widget token back from this token keeper.
 void setInformationProvider(IInformationProvider provider, String contentType)
          Registers a given information provider for a particular content type.
protected  void showInformationControl(Rectangle subjectArea)
          Shows the information control and starts the information control closer.
 void uninstall()
          Removes the information presenter from the text viewer it has previously been installed on.
 
Methods inherited from class org.eclipse.jface.text.AbstractInformationControlManager
computeInformationControlLocation, computeLocation, computeSizeConstraints, dispose, disposeInformationControl, doShowInformation, getInformationControl, getNextFallbackAnchor, getSubjectArea, getSubjectControl, handleSubjectControlDisposed, install, isEnabled, presentInformation, setAnchor, setCloser, setEnabled, setFallbackAnchors, setInformation, setMargins, setSizeConstraints, showInformation, 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
 

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 thel focus.

Parameters:
creator - the information control creator to be used
Method Detail

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, or null to remove an existing one
contentType - the content type under which to register

getInformationProvider

public IInformationProvider getInformationProvider(String contentType)
Description copied from interface: IInformationPresenter
Returns the information provider to be used for the given content type.

Specified by:
getInformationProvider in interface IInformationPresenter
Parameters:
contentType - the type of the content for which information will be requested
Returns:
an information provider or null if none exists for the specified content type

computeInformation

protected void computeInformation()
Description copied from class: AbstractInformationControlManager
Computes 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 using setInformation.

Specified by:
computeInformation in class AbstractInformationControlManager

install

public void install(ITextViewer textViewer)
Description copied from interface: IInformationPresenter
Installs the information presenter on the given text viewer. After this method has been finished, the presenter is operational. I.e., the method showInformation can be called until uninstall is called.

Specified by:
install in interface IInformationPresenter
Parameters:
textViewer - the viewer on which the presenter is installed

uninstall

public void uninstall()
Description copied from interface: IInformationPresenter
Removes the information presenter from the text viewer it has previously been installed on.

Specified by:
uninstall in interface IInformationPresenter

showInformationControl

protected void showInformationControl(Rectangle subjectArea)
Description copied from class: AbstractInformationControlManager
Shows the information control and starts the information control closer. This method may not be called by clients.

Overrides:
showInformationControl in class AbstractInformationControlManager
Parameters:
subjectArea - the information area

hideInformationControl

protected void hideInformationControl()
Description copied from class: AbstractInformationControlManager
Hides the information control and stops the information control closer.

Overrides:
hideInformationControl in class AbstractInformationControlManager

handleInformationControlDisposed

protected void handleInformationControlDisposed()
Description copied from class: AbstractInformationControlManager
Handles the disposal of the information control. By default, the information control closer is stopped.

Overrides:
handleInformationControlDisposed in class AbstractInformationControlManager

requestWidgetToken

public boolean requestWidgetToken(IWidgetTokenOwner owner)
Description copied from interface: IWidgetTokenKeeper
The given widget token owner requests the widget token back from this token keeper. Returns true if the token is released by this token keeper. Note, the keeper must not call releaseWidgetToken(IWidgetTokenKeeper) explicitly.

Specified by:
requestWidgetToken in interface IWidgetTokenKeeper
Parameters:
owner - the token owner
Returns:
true if token has been released false otherwise

Eclipse Platform
2.0

Copyright (c) IBM Corp. and others 2000, 2002. All Rights Reserved.