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
,SWTEventListener
public class DefaultInformationControl extends AbstractInformationControl implements DisposeListener
Default implementation ofIInformationControl
.Displays textual information in a
StyledText
widget. Before displaying, the information set to this information control is processed by anIInformationPresenter
.- 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.As of 3.4, replaced by simpler constructorsDefaultInformationControl(Shell parentShell, int shellStyle, int style, DefaultInformationControl.IInformationPresenter presenter, String statusFieldText)
Deprecated.As of 3.4, replaced by simpler constructorsDefaultInformationControl(Shell parent, int textStyles, DefaultInformationControl.IInformationPresenter presenter)
Deprecated.As of 3.4, replaced byDefaultInformationControl(Shell, DefaultInformationControl.IInformationPresenter)
DefaultInformationControl(Shell parent, int textStyles, DefaultInformationControl.IInformationPresenter presenter, String statusFieldText)
Deprecated.As of 3.4, replaced byDefaultInformationControl(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
All Methods Instance Methods Concrete Methods Deprecated Methods 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 org.eclipse.jface.text.AbstractInformationControl
addDisposeListener, addFocusListener, computeSizeConstraints, containsControl, create, dispose, getBounds, getShell, getSizeConstraints, getToolBarManager, handleDispose, isFocusControl, isResizable, isVisible, removeDisposeListener, removeFocusListener, restoresLocation, restoresSize, setFocus, setLocation, setSize, setSizeConstraints, setStatusText
-
-
-
-
Constructor Detail
-
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 shellisResizeable
-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 shellstatusFieldText
- the text to be used in the status field ornull
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 shellstatusFieldText
- the text to be used in the status field ornull
to hide the status fieldpresenter
- the presenter to be used, ornull
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 shelltoolBarManager
- the manager ornull
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 shelltoolBarManager
- the manager ornull
if toolbar is not desiredpresenter
- the presenter to be used, ornull
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 shellpresenter
- the presenter to be used
-
DefaultInformationControl
@Deprecated public DefaultInformationControl(Shell parent, int shellStyle, int style, DefaultInformationControl.IInformationPresenter presenter)
Deprecated.As of 3.4, replaced by simpler constructorsCreates 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 shellshellStyle
- the additional styles for the shellstyle
- the additional styles for the styled text widgetpresenter
- 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 constructorsCreates 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 shellshellStyle
- the additional styles for the shellstyle
- the additional styles for the styled text widgetpresenter
- the presenter to be usedstatusFieldText
- the text to be used in the status field ornull
to hide the status field- Since:
- 3.0
-
DefaultInformationControl
@Deprecated public DefaultInformationControl(Shell parent, int textStyles, DefaultInformationControl.IInformationPresenter presenter)
Deprecated.As of 3.4, replaced byDefaultInformationControl(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 shelltextStyles
- the additional styles for the styled text widgetpresenter
- the presenter to be used
-
DefaultInformationControl
@Deprecated public DefaultInformationControl(Shell parent, int textStyles, DefaultInformationControl.IInformationPresenter presenter, String statusFieldText)
Deprecated.As of 3.4, replaced byDefaultInformationControl(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 shelltextStyles
- the additional styles for the styled text widgetpresenter
- the presenter to be usedstatusFieldText
- the text to be used in the status field ornull
to hide the status field- Since:
- 3.0
-
-
Method Detail
-
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()
andControl.getForeground()
fromparent
.Implementors must either use the dialog font or override
AbstractInformationControl.computeSizeConstraints(int, int)
.Implementors are expected to consider
AbstractInformationControl.isResizable()
: Iftrue
, they should show scrollbars if their content may exceed the size of the information control. Iffalse
, they should never show scrollbars.The given
parent
comes with aFillLayout
. Subclasses may set a different layout.- Specified by:
createContent
in classAbstractInformationControl
- 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 interfaceIInformationControl
- Overrides:
setInformation
in classAbstractInformationControl
- 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 interfaceIInformationControl
- Overrides:
setVisible
in classAbstractInformationControl
- 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 interfaceIInformationControl
- Overrides:
computeSizeHint
in classAbstractInformationControl
- 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 interfaceIInformationControlExtension3
- Overrides:
computeTrim
in classAbstractInformationControl
- Returns:
- The receiver's trim.
x
andy
denote the upper left corner of the trimming relative to this control's location i.e. this will most likely be negative values.width
andheight
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 interfaceIInformationControl
- Overrides:
setForegroundColor
in classAbstractInformationControl
- 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 interfaceIInformationControl
- Overrides:
setBackgroundColor
in classAbstractInformationControl
- 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 interfaceIInformationControlExtension
- 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 calledDescription copied from interface:DisposeListener
Sent when the widget is disposed.- Specified by:
widgetDisposed
in interfaceDisposeListener
- 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
andIInformationControlExtension2
, and whoseIInformationControlExtension2.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 returnsnull
. Subclasses may override.- Specified by:
getInformationPresenterControlCreator
in interfaceIInformationControlExtension5
- Overrides:
getInformationPresenterControlCreator
in classAbstractInformationControl
- Returns:
- the information presenter control creator or
null
to disable enriching
-
-