Package org.eclipse.ltk.ui.refactoring

# Class TextStatusContextViewer

java.lang.Object
org.eclipse.ltk.ui.refactoring.TextStatusContextViewer

All Implemented Interfaces:
  `IStatusContextViewer`

public abstract class TextStatusContextViewer extends Object implements IStatusContextViewer
An abstract base implementation of a status context viewer that presents textual context information.

Subclasses need to implement `createSourceViewer(Composite)` to create the correct source viewer. They should use the method `updateTitle(IAdaptable)` and `setInput(IDocument, IRegion)` to set the title text and image and to populate the source viewer.

Since:
  3.0

## Constructor Summary

Constructors
Constructor
Description
`TextStatusContextViewer()`

## Method Summary

Modifier and Type
Method
Description
`void`
`createControl(Composite parent)`
Creates the status viewer's widget hierarchy.
`protected abstract SourceViewer`
`createSourceViewer(Composite parent)`
Hook to create the source viewer used to present the textual context information.
`Control`
`getControl()`
Returns the status context viewer's SWT control.
`protected SourceViewer`
`getSourceViewer()`
Returns the internal source viewer.
`protected void`
`setInput(IDocument document, IRegion region)`
Sets the input of the source viewer to the given document and reveals the region determined by the given parameter region.
`protected void`
`updateTitle(IAdaptable element)`
Updates the title image and text of the pane surrounding the source viewer.

### Methods inherited from class java.lang.Object

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

### Methods inherited from interface org.eclipse.ltk.ui.refactoring.IStatusContextViewer

`setInput`

## Constructor Details

### TextStatusContextViewer

public TextStatusContextViewer()

## Method Details

### getSourceViewer

protected SourceViewer getSourceViewer()
Returns the internal source viewer.

Returns:
  the internal source viewer or `null` if the source viewer hasn't been created yet

### createSourceViewer

protected abstract SourceViewer createSourceViewer(Composite parent)
Hook to create the source viewer used to present the textual context information.

Parameters:
  `parent` - the composite to be used as the source viewer's parent
Returns:
  the source viewer to be used

### updateTitle

protected void updateTitle(IAdaptable element)
Updates the title image and text of the pane surrounding the source viewer. The image and text is determined by retrieving the `IWorkbenchAdapter` for the given element. If the element doen't provide a `IWorkbenchAdapter` or if the element is `null` the image is reset and a default label is shown.

Parameters:
  `element` - the element providing the image and label for the title. Can be `null` to reset the image and text

### setInput

protected void setInput(IDocument document, IRegion region)
Sets the input of the source viewer to the given document and reveals the region determined by the given parameter region.

Parameters:
  `document` - the document to present
  `region` - the region to reveal.

### createControl

public void createControl(Composite parent)
Description copied from interface: `IStatusContextViewer`
Creates the status viewer's widget hierarchy. This method is only called once. Method `getControl()` should be used to retrieve the widget hierarchy.

Specified by:
  `createControl` in interface `IStatusContextViewer`
Parameters:
  `parent` - the parent for the widget hierarchy
See Also:
  - `IStatusContextViewer.getControl()`

### getControl

public Control getControl()
Description copied from interface: `IStatusContextViewer`
Returns the status context viewer's SWT control.

Specified by:
  `getControl` in interface `IStatusContextViewer`
Returns:
  the status context viewer's SWT control or `null` is the widget hierarchy hasn't been created yet