# Class DefaultInformationControl

java.lang.Object
org.eclipse.jface.text.AbstractInformationControl
org.eclipse.jface.text.DefaultInformationControl

All Implemented Interfaces:
  `EventListener, IInformationControl, IInformationControlExtension, IInformationControlExtension3, IInformationControlExtension4, IInformationControlExtension5, DisposeListener`

public class DefaultInformationControl extends AbstractInformationControl implements DisposeListener
Default implementation of `IInformationControl`.

Displays textual information in a `StyledText` widget. Before displaying, the information set to this information control is processed by an `IInformationPresenter`.

Since:
  2.0

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static interface`
`DefaultInformationControl.IInformationPresenter`
An information presenter determines the style presentation of information displayed in the default information control.
`static interface`
`DefaultInformationControl.IInformationPresenterExtension`
An information presenter determines the style presentation of information displayed in the default information control.

## Constructor Summary

Constructors
Constructor
Description
`DefaultInformationControl(Shell parent)`
Creates a default information control with the given shell as parent.
`DefaultInformationControl(Shell parent, boolean isResizeable)`
Creates a default information control with the given shell as parent.
`DefaultInformationControl(Shell parent, int shellStyle, int style, DefaultInformationControl.IInformationPresenter presenter)`
Deprecated, for removal: This API element is subject to removal in a future version.
As of 3.4, replaced by simpler constructors
`DefaultInformationControl(Shell parentShell, int shellStyle, int style, DefaultInformationControl.IInformationPresenter presenter, String statusFieldText)`
Deprecated.
As of 3.4, replaced by simpler constructors
`DefaultInformationControl(Shell parent, int textStyles, DefaultInformationControl.IInformationPresenter presenter)`
Deprecated, for removal: This API element is subject to removal in a future version.
As of 3.4, replaced by `DefaultInformationControl(Shell, DefaultInformationControl.IInformationPresenter)`
`DefaultInformationControl(Shell parent, int textStyles, DefaultInformationControl.IInformationPresenter presenter, String statusFieldText)`
Deprecated.
As of 3.4, replaced by `DefaultInformationControl(Shell, String, DefaultInformationControl.IInformationPresenter)`
`DefaultInformationControl(Shell parent, String statusFieldText)`
Creates a default information control with the given shell as parent.
`DefaultInformationControl(Shell parent, String statusFieldText, DefaultInformationControl.IInformationPresenter presenter)`
Creates a default information control with the given shell as parent.
`DefaultInformationControl(Shell parent, ToolBarManager toolBarManager)`
Creates a resizable default information control with the given shell as parent.
`DefaultInformationControl(Shell parent, ToolBarManager toolBarManager, DefaultInformationControl.IInformationPresenter presenter)`
Creates a resizable default information control with the given shell as parent.
`DefaultInformationControl(Shell parent, DefaultInformationControl.IInformationPresenter presenter)`
Creates a default information control with the given shell as parent.

## Method Summary

Modifier and Type
Method
Description
`Point`
`computeSizeHint()`
Computes and returns a proposal for the size of this information control depending on the information to present.
`Rectangle`
`computeTrim()`
Computes the trim (status text and tool bar are considered as trim).
`protected void`
`createContent(Composite parent)`
Creates the content of the popup window.
`IInformationControlCreator`
`getInformationPresenterControlCreator()`
Returns the rich information control creator for this information control.
`boolean`
`hasContents()`
Returns whether this information control has contents to be displayed.
`void`
`setBackgroundColor(Color background)`
Sets the background color of this information control.
`void`
`setForegroundColor(Color foreground)`
Sets the foreground color of this information control.
`void`
`setInformation(String content)`
Sets the information to be presented by this information control.
`void`
`setVisible(boolean visible)`
Controls the visibility of this information control.
`void`
`widgetDisposed(DisposeEvent event)`
Deprecated.
As of 3.2, no longer used and called

### Methods inherited from class AbstractInformationControl

`addDisposeListener, addFocusListener, computeSizeConstraints, containsControl, create, dispose, getBounds, getShell, getSizeConstraints, getToolBarManager, handleDispose, isFocusControl, isResizable, isVisible, removeDisposeListener, removeFocusListener, restoresLocation, restoresSize, setFocus, setLocation, setSize, setSizeConstraints, setStatusText`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### DefaultInformationControl

public DefaultInformationControl(Shell parent, boolean isResizeable)
Creates a default information control with the given shell as parent. An information presenter that can handle simple HTML is used to process the information to be displayed.

Parameters:
  `parent` - the parent shell
  `isResizeable` - `true` if the control should be resizable
Since:
  3.4

### DefaultInformationControl

public DefaultInformationControl(Shell parent, String statusFieldText)
Creates a default information control with the given shell as parent. An information presenter that can handle simple HTML is used to process the information to be displayed.

Parameters:
  `parent` - the parent shell
  `statusFieldText` - the text to be used in the status field or `null` to hide the status field
Since:
  3.4

### DefaultInformationControl

public DefaultInformationControl(Shell parent, String statusFieldText, DefaultInformationControl.IInformationPresenter presenter)
Creates a default information control with the given shell as parent. The given information presenter is used to process the information to be displayed.

Parameters:
  `parent` - the parent shell
  `statusFieldText` - the text to be used in the status field or `null` to hide the status field
  `presenter` - the presenter to be used, or `null` if no presenter should be used
Since:
  3.4

### DefaultInformationControl

public DefaultInformationControl(Shell parent, ToolBarManager toolBarManager)
Creates a resizable default information control with the given shell as parent. An information presenter that can handle simple HTML is used to process the information to be displayed.

Parameters:
  `parent` - the parent shell
  `toolBarManager` - the manager or `null` if toolbar is not desired
Since:
  3.4

### DefaultInformationControl

public DefaultInformationControl(Shell parent, ToolBarManager toolBarManager, DefaultInformationControl.IInformationPresenter presenter)
Creates a resizable default information control with the given shell as parent. The given information presenter is used to process the information to be displayed.

Parameters:
  `parent` - the parent shell
  `toolBarManager` - the manager or `null` if toolbar is not desired
  `presenter` - the presenter to be used, or `null` if no presenter should be used
Since:
  3.4

### DefaultInformationControl

public DefaultInformationControl(Shell parent)
Creates a default information control with the given shell as parent. No information presenter is used to process the information to be displayed.

Parameters:
  `parent` - the parent shell

### DefaultInformationControl

public DefaultInformationControl(Shell parent, DefaultInformationControl.IInformationPresenter presenter)
Creates a default information control with the given shell as parent. The given information presenter is used to process the information to be displayed.

Parameters:
  `parent` - the parent shell
  `presenter` - the presenter to be used

### DefaultInformationControl

@Deprecated(forRemoval=true, since="2025-12") public DefaultInformationControl(Shell parent, int shellStyle, int style, DefaultInformationControl.IInformationPresenter presenter)
Deprecated, for removal: This API element is subject to removal in a future version.
As of 3.4, replaced by simpler constructors
Creates a default information control with the given shell as parent. The given information presenter is used to process the information to be displayed. The given styles are applied to the created styled text widget.

Parameters:
  `parent` - the parent shell
  `shellStyle` - the additional styles for the shell
  `style` - the additional styles for the styled text widget
  `presenter` - the presenter to be used

### DefaultInformationControl

@Deprecated public DefaultInformationControl(Shell parentShell, int shellStyle, int style, DefaultInformationControl.IInformationPresenter presenter, String statusFieldText)
Deprecated.
As of 3.4, replaced by simpler constructors
Creates a default information control with the given shell as parent. The given information presenter is used to process the information to be displayed. The given styles are applied to the created styled text widget.

Parameters:
  `parentShell` - the parent shell
  `shellStyle` - the additional styles for the shell
  `style` - the additional styles for the styled text widget
  `presenter` - the presenter to be used
  `statusFieldText` - the text to be used in the status field or `null` to hide the status field
Since:
  3.0

### DefaultInformationControl

@Deprecated(forRemoval=true, since="2025-12") public DefaultInformationControl(Shell parent, int textStyles, DefaultInformationControl.IInformationPresenter presenter)
Deprecated, for removal: This API element is subject to removal in a future version.
As of 3.4, replaced by `DefaultInformationControl(Shell, DefaultInformationControl.IInformationPresenter)`
Creates a default information control with the given shell as parent. The given information presenter is used to process the information to be displayed.

Parameters:
  `parent` - the parent shell
  `textStyles` - the additional styles for the styled text widget
  `presenter` - the presenter to be used

### DefaultInformationControl

@Deprecated public DefaultInformationControl(Shell parent, int textStyles, DefaultInformationControl.IInformationPresenter presenter, String statusFieldText)
Deprecated.
As of 3.4, replaced by `DefaultInformationControl(Shell, String, DefaultInformationControl.IInformationPresenter)`
Creates a default information control with the given shell as parent. The given information presenter is used to process the information to be displayed.

Parameters:
  `parent` - the parent shell
  `textStyles` - the additional styles for the styled text widget
  `presenter` - the presenter to be used
  `statusFieldText` - the text to be used in the status field or `null` to hide the status field
Since:
  3.0

## Method Details

### createContent

protected void createContent(Composite parent)
Description copied from class: `AbstractInformationControl`
Creates the content of the popup window.

Implementors will usually take over `Control.getBackground()` and `Control.getForeground()` from `parent`.

Implementors must either use the dialog font or override `AbstractInformationControl.computeSizeConstraints(int, int)`.

Implementors are expected to consider `AbstractInformationControl.isResizable()`: If `true`, they should show scrollbars if their content may exceed the size of the information control. If `false`, they should never show scrollbars.

The given `parent` comes with a `FillLayout`. Subclasses may set a different layout.

Specified by:
  `createContent` in class `AbstractInformationControl`
Parameters:
  `parent` - the container of the content

### setInformation

public void setInformation(String content)
Description copied from class: `AbstractInformationControl`
Sets the information to be presented by this information control.

The default implementation does nothing. Subclasses must either override this method or implement `IInformationControlExtension2`.

Specified by:
  `setInformation` in interface `IInformationControl`
Overrides:
  `setInformation` in class `AbstractInformationControl`
Parameters:
  `content` - the information to be presented
See Also:
  - `IInformationControl.setInformation(java.lang.String)`

### setVisible

public void setVisible(boolean visible)
Description copied from interface: `IInformationControl`
Controls the visibility of this information control.

Note: The information control must not grab focus when made visible.

Specified by:
  `setVisible` in interface `IInformationControl`
Overrides:
  `setVisible` in class `AbstractInformationControl`
Parameters:
  `visible` - `true` if the control should be visible

### computeSizeHint

public Point computeSizeHint()
Description copied from interface: `IInformationControl`
Computes and returns a proposal for the size of this information control depending on the information to present. The method tries to honor known size constraints but might return a size that exceeds them.

Specified by:
  `computeSizeHint` in interface `IInformationControl`
Overrides:
  `computeSizeHint` in class `AbstractInformationControl`
Returns:
  the computed size hint

### computeTrim

public Rectangle computeTrim()
Description copied from class: `AbstractInformationControl`
Computes the trim (status text and tool bar are considered as trim). Subclasses can extend this method to add additional trim (e.g. scroll bars for resizable information controls).

Specified by:
  `computeTrim` in interface `IInformationControlExtension3`
Overrides:
  `computeTrim` in class `AbstractInformationControl`
Returns:
  The receiver's trim. `x` and `y` denote the upper left corner of the trimming relative to this control's location i.e. this will most likely be negative values. `width` and `height` represent the border sizes (the sum of the horizontal and vertical trimmings, respectively).
See Also:
  - `IInformationControlExtension3.computeTrim()`

### setForegroundColor

public void setForegroundColor(Color foreground)
Description copied from interface: `IInformationControl`
Sets the foreground color of this information control.

Specified by:
  `setForegroundColor` in interface `IInformationControl`
Overrides:
  `setForegroundColor` in class `AbstractInformationControl`
Parameters:
  `foreground` - the foreground color of this information control

### setBackgroundColor

public void setBackgroundColor(Color background)
Description copied from interface: `IInformationControl`
Sets the background color of this information control.

Specified by:
  `setBackgroundColor` in interface `IInformationControl`
Overrides:
  `setBackgroundColor` in class `AbstractInformationControl`
Parameters:
  `background` - the background color of this information control

### hasContents

public boolean hasContents()
Description copied from interface: `IInformationControlExtension`
Returns whether this information control has contents to be displayed.

Specified by:
  `hasContents` in interface `IInformationControlExtension`
Returns:
  `true` if there is contents to be displayed.

### widgetDisposed

@Deprecated public void widgetDisposed(DisposeEvent event)
Deprecated.
As of 3.2, no longer used and called
Description copied from interface: `DisposeListener`
Sent when the widget is disposed.

Specified by:
  `widgetDisposed` in interface `DisposeListener`
Parameters:
  `event` - an event containing information about the dispose
Since:
  3.0
See Also:
  - `DisposeListener.widgetDisposed(org.eclipse.swt.events.DisposeEvent)`

### getInformationPresenterControlCreator

public IInformationControlCreator getInformationPresenterControlCreator()
Description copied from class: `AbstractInformationControl`
Returns the rich information control creator for this information control.

The returned information control creator is used to create an enriched version of this information control, e.g. when the mouse is moved into this control and it needs to be `enriched` or when it needs to be made sticky for other reasons.

The returned information control creator must create information controls that implement `IInformationControlExtension3` and `IInformationControlExtension2`, and whose `IInformationControlExtension2.setInput(Object)` accepts all inputs that are also supported by this information control.

Note that automatic enriching of this information control works only if it also implements `IInformationControlExtension3`.

This method may be called frequently, so implementors should ensure it returns quickly, e.g. by caching the returned creator.

This default implementation returns `null`. Subclasses may override.

Specified by:
  `getInformationPresenterControlCreator` in interface `IInformationControlExtension5`
Overrides:
  `getInformationPresenterControlCreator` in class `AbstractInformationControl`
Returns:
  the information presenter control creator or `null` to disable enriching