|
Eclipse Platform Release 3.7 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.jface.text.AbstractInformationControl
public abstract class AbstractInformationControl
An abstract information control that can show content inside a shell. The information control can be created in two styles:
Subclasses must either override IInformationControl.setInformation(String)
or implement IInformationControlExtension2.
They should also extend computeTrim() if they create a content area
with additional trim (e.g. scrollbars) and override getInformationPresenterControlCreator().
| Constructor Summary | |
|---|---|
AbstractInformationControl(Shell parentShell,
boolean isResizable)
Creates an abstract information control with the given shell as parent. |
|
AbstractInformationControl(Shell parentShell,
String statusFieldText)
Creates an abstract information control with the given shell as parent. |
|
AbstractInformationControl(Shell parentShell,
ToolBarManager toolBarManager)
Creates an abstract information control with the given shell as parent. |
|
| Method Summary | |
|---|---|
void |
addDisposeListener(DisposeListener listener)
Adds the given listener to the list of dispose listeners. |
void |
addFocusListener(FocusListener listener)
Adds the given listener to the list of focus listeners. This method is not intended to be overridden by subclasses. |
Point |
computeSizeConstraints(int widthInChars,
int heightInChars)
Computes the size constraints based on the dialog font. |
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). |
boolean |
containsControl(Control control)
Tests whether the given control is this information control or a child of this information control. |
protected void |
create()
Creates the content of this information control. |
protected abstract void |
createContent(Composite parent)
Creates the content of the popup window. |
void |
dispose()
Disposes this information control. |
Rectangle |
getBounds()
Returns a rectangle describing the receiver's size and location relative to its parent (or its display if its parent is null). |
IInformationControlCreator |
getInformationPresenterControlCreator()
Returns the rich information control creator for this information control. This default implementation returns null. |
protected Shell |
getShell()
The shell of the popup window. |
protected Point |
getSizeConstraints()
Returns the size constraints. |
protected ToolBarManager |
getToolBarManager()
The toolbar manager used to manage the toolbar, or null if
no toolbar is shown. |
protected void |
handleDispose()
Frees all resources allocated by this information control. |
boolean |
isFocusControl()
Returns whether this information control (or one of its children) has the focus. This method is not intended to be overridden by subclasses. |
boolean |
isResizable()
Returns whether the information control is resizable. |
boolean |
isVisible()
|
void |
removeDisposeListener(DisposeListener listener)
Removes the given listeners from the list of dispose listeners. |
void |
removeFocusListener(FocusListener listener)
Removes the given listeners from the list of focus listeners. This method is not intended to be overridden by subclasses. |
boolean |
restoresLocation()
Tells whether this control allows to restore the previously used location. The default implementation always returns false. |
boolean |
restoresSize()
Tells whether this control allows to restore the previously used size. The default implementation always returns false. |
void |
setBackgroundColor(Color background)
Sets the background color of this information control. |
void |
setFocus()
This default implementation sets the focus on the popup shell. |
void |
setForegroundColor(Color foreground)
Sets the foreground color of this information control. |
void |
setInformation(String information)
Sets the information to be presented by this information control. |
void |
setLocation(Point location)
Sets the location of this information control. |
void |
setSize(int width,
int height)
Sets the size of this information control. |
void |
setSizeConstraints(int maxWidth,
int maxHeight)
Sets the information control's size constraints. |
void |
setStatusText(String statusFieldText)
Sets the text of the status field. |
void |
setVisible(boolean visible)
Controls the visibility of this information control. |
| 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.IInformationControlExtension |
|---|
hasContents |
| Constructor Detail |
|---|
public AbstractInformationControl(Shell parentShell,
String statusFieldText)
Important: Subclasses are required to call create() at the end of their constructor.
parentShell - the parent of this control's shellstatusFieldText - the text to be used in the status field or null to hide the status field
public AbstractInformationControl(Shell parentShell,
ToolBarManager toolBarManager)
Important: Subclasses are required to call create() at the end of their constructor.
parentShell - the parent of this control's shelltoolBarManager - the manager or null if toolbar is not desired
public AbstractInformationControl(Shell parentShell,
boolean isResizable)
Important: Subclasses are required to call create() at the end of their constructor.
parentShell - the parent of this control's shellisResizable - true if the control should be resizable| Method Detail |
|---|
protected final Shell getShell()
protected final ToolBarManager getToolBarManager()
null if
no toolbar is shown.
nullprotected final void create()
protected abstract void createContent(Composite parent)
Implementors will usually take over Control.getBackground() and
Control.getForeground() from parent.
Implementors must either use the dialog font or override
computeSizeConstraints(int, int).
Implementors are expected to consider 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.
parent - the container of the contentpublic void setInformation(String information)
The default implementation does nothing. Subclasses must either override this method
or implement IInformationControlExtension2.
setInformation in interface IInformationControlinformation - the information to be presentedIInformationControl.setInformation(java.lang.String)public boolean isResizable()
true if the information control is resizable,
false if it is not resizable.public void setVisible(boolean visible)
IInformationControlNote: The information control must not grab focus when made visible.
setVisible in interface IInformationControlvisible - true if the control should be visiblepublic void dispose()
IInformationControl
dispose in interface IInformationControlprotected void handleDispose()
public void setSize(int width,
int height)
IInformationControl
setSize in interface IInformationControlwidth - the width of the controlheight - the height of the controlpublic void setLocation(Point location)
IInformationControl
setLocation in interface IInformationControllocation - the location
public void setSizeConstraints(int maxWidth,
int maxHeight)
IInformationControlSWT.DEFAULT indicates no constraint. This method must be called before
IInformationControl.computeSizeHint() is called.
Note: An information control which implements IInformationControlExtension3
may ignore this method or use it as hint for its very first appearance.
setSizeConstraints in interface IInformationControlmaxWidth - the maximal width of the control to present the information, or SWT.DEFAULT for not constraintmaxHeight - the maximal height of the control to present the information, or SWT.DEFAULT for not constraintprotected final Point getSizeConstraints()
null if not setsetSizeConstraints(int, int)public Point computeSizeHint()
IInformationControl
computeSizeHint in interface IInformationControlpublic Rectangle computeTrim()
computeTrim in interface IInformationControlExtension3x 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).IInformationControlExtension3.computeTrim()public Rectangle getBounds()
IInformationControlExtension3Note: If the receiver is already disposed then this methods must return the last valid location and size.
getBounds in interface IInformationControlExtension3public boolean restoresLocation()
Note: This is not a static property - it can change during the lifetime of this control.
The default implementation always returns false.
restoresLocation in interface IInformationControlExtension3true if restoring location is supportedIInformationControlExtension3.restoresLocation()public boolean restoresSize()
Note: This is not a static property - it can change during the lifetime of this control.
The default implementation always returns false.
restoresSize in interface IInformationControlExtension3true if restoring size is supportedIInformationControlExtension3.restoresSize()public void addDisposeListener(DisposeListener listener)
IInformationControl
addDisposeListener in interface IInformationControllistener - the listener to be addedpublic void removeDisposeListener(DisposeListener listener)
IInformationControl
removeDisposeListener in interface IInformationControllistener - the listener to be removedpublic void setForegroundColor(Color foreground)
IInformationControl
setForegroundColor in interface IInformationControlforeground - the foreground color of this information controlpublic void setBackgroundColor(Color background)
IInformationControl
setBackgroundColor in interface IInformationControlbackground - the background color of this information controlpublic boolean isFocusControl()
fShell is this information control's shell):
return fShell.getDisplay().getActiveShell() == fShellThis method is not intended to be overridden by subclasses.
isFocusControl in interface IInformationControltrue when the information control has the focus, otherwise falsepublic void setFocus()
setFocus in interface IInformationControlIInformationControl.setFocus()public void addFocusListener(FocusListener listener)
The suggested implementation is to install listeners for SWT.Activate and SWT.Deactivate
on the shell and forward events to the focus listeners. Clients are
encouraged to subclass AbstractInformationControl, which does this
for free.
addFocusListener in interface IInformationControllistener - the listener to be addedpublic void removeFocusListener(FocusListener listener)
removeFocusListener in interface IInformationControllistener - the listener to be removedpublic void setStatusText(String statusFieldText)
The default implementation currently only updates the status field when the popup shell is not visible. The status field can currently only be shown if the information control has been created with a non-null status field text.
setStatusText in interface IInformationControlExtension4statusFieldText - the text to be used in the optional status field
or null if the status field should be hiddenIInformationControlExtension4.setStatusText(java.lang.String)public boolean containsControl(Control control)
IInformationControlExtension5
containsControl in interface IInformationControlExtension5control - the control to test
true iff the given control is this information control
or a child of this information controlpublic boolean isVisible()
isVisible in interface IInformationControlExtension5true iff the information control is currently visiblepublic IInformationControlCreator getInformationPresenterControlCreator()
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 returnsnull. Subclasses may override.
getInformationPresenterControlCreator in interface IInformationControlExtension5null to disable enriching
public Point computeSizeConstraints(int widthInChars,
int heightInChars)
dialog font. Subclasses can
override or extend.
computeSizeConstraints in interface IInformationControlExtension5widthInChars - the width constraint in number of charactersheightInChars - the height constraint in number of characters
null
to use the subject control's font to calculate the sizeIInformationControlExtension5.computeSizeConstraints(int, int)
|
Eclipse Platform Release 3.7 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Guidelines for using Eclipse APIs.
Copyright (c) Eclipse contributors and others 2000, 2011. All rights reserved.