org.eclipse.xtext.ui.codetemplates.ui.contentassist
Class DummyTextViewer

java.lang.Object
  extended by org.eclipse.xtext.ui.codetemplates.ui.contentassist.DummyTextViewer
All Implemented Interfaces:
org.eclipse.jface.text.ITextViewer, org.eclipse.jface.viewers.ISelectionProvider

public class DummyTextViewer
extends java.lang.Object
implements org.eclipse.jface.text.ITextViewer, org.eclipse.jface.viewers.ISelectionProvider

Author:
Sebastian Zarnekow - Initial contribution and API

Constructor Summary
DummyTextViewer(org.eclipse.jface.viewers.ISelection selection, org.eclipse.jface.text.IDocument document)
           
 
Method Summary
 void activatePlugins()
          Activates the installed plug-ins.
 void addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)
          Adds a listener for selection changes in this selection provider.
 void addTextInputListener(org.eclipse.jface.text.ITextInputListener listener)
          Adds a text input listener to this viewer.
 void addTextListener(org.eclipse.jface.text.ITextListener listener)
          Adds a text listener to this viewer.
 void addViewportListener(org.eclipse.jface.text.IViewportListener listener)
          Adds the given view port listener to this viewer.
 void changeTextPresentation(org.eclipse.jface.text.TextPresentation presentation, boolean controlRedraw)
          Applies the color information encoded in the given text presentation.
 int getBottomIndex()
          Returns the visible line with the highest line number.
 int getBottomIndexEndOffset()
          Returns the document offset of the lower right corner of this viewer's view port.
 org.eclipse.jface.text.IDocument getDocument()
          Returns the text viewer's input document.
 org.eclipse.jface.text.IFindReplaceTarget getFindReplaceTarget()
          Returns the find/replace operation target of this viewer.
 org.eclipse.swt.graphics.Point getSelectedRange()
          Returns the range of the current selection in coordinates of this viewer's document.
 org.eclipse.jface.viewers.ISelection getSelection()
          Returns the current selection for this provider.
 org.eclipse.jface.viewers.ISelectionProvider getSelectionProvider()
          Returns a selection provider dedicated to this viewer.
 org.eclipse.jface.text.ITextOperationTarget getTextOperationTarget()
          Returns the text operation target of this viewer.
 org.eclipse.swt.custom.StyledText getTextWidget()
          Returns this viewer's SWT control, null if the control is disposed.
 int getTopIndex()
          Returns the visible line with the smallest line number.
 int getTopIndexStartOffset()
          Returns the document offset of the upper left corner of this viewer's view port.
 int getTopInset()
          Returns the vertical offset of the first visible line.
 org.eclipse.jface.text.IRegion getVisibleRegion()
          Returns the current visible region of this viewer's document.
 void invalidateTextPresentation()
          Marks the currently applied text presentation as invalid.
 boolean isEditable()
          Returns whether the shown text can be manipulated.
 boolean overlapsWithVisibleRegion(int offset, int length)
          Returns whether a given range overlaps with the visible region of this viewer's document.
 void removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)
          Removes the given selection change listener from this selection provider.
 void removeTextInputListener(org.eclipse.jface.text.ITextInputListener listener)
          Removes the given listener from this viewer's set of text input listeners.
 void removeTextListener(org.eclipse.jface.text.ITextListener listener)
          Removes the given listener from this viewer's set of text listeners.
 void removeViewportListener(org.eclipse.jface.text.IViewportListener listener)
          Removes the given listener from this viewer's set of view port listeners.
 void resetPlugins()
          Resets the installed plug-ins.
 void resetVisibleRegion()
          Resets the region of this viewer's document which is visible in the presentation.
 void revealRange(int offset, int length)
          Ensures that the given range is visible.
 void setAutoIndentStrategy(org.eclipse.jface.text.IAutoIndentStrategy strategy, java.lang.String contentType)
          Deprecated. 
 void setDefaultPrefixes(java.lang.String[] defaultPrefixes, java.lang.String contentType)
          Sets the strings that are used as prefixes when lines of the given content type are prefixed using the prefix text operation.
 void setDocument(org.eclipse.jface.text.IDocument document)
          Sets the given document as the text viewer's model and updates the presentation accordingly.
 void setDocument(org.eclipse.jface.text.IDocument document, int modelRangeOffset, int modelRangeLength)
          Sets the given document as this viewer's model and exposes the specified region.
 void setEditable(boolean editable)
          Sets the editable state.
 void setEventConsumer(org.eclipse.jface.text.IEventConsumer consumer)
          Registers an event consumer with this viewer.
 void setIndentPrefixes(java.lang.String[] indentPrefixes, java.lang.String contentType)
          Sets the strings that are used as prefixes when lines of the given content type are shifted using the shift text operation.
 void setSelectedRange(int offset, int length)
          Sets the selection to the specified range.
 void setSelection(org.eclipse.jface.viewers.ISelection selection)
          Sets the current selection for this selection provider.
 void setTextColor(org.eclipse.swt.graphics.Color color)
          Applies the given color as text foreground color to this viewer's selection.
 void setTextColor(org.eclipse.swt.graphics.Color color, int offset, int length, boolean controlRedraw)
          Applies the given color as text foreground color to the specified section of this viewer.
 void setTextDoubleClickStrategy(org.eclipse.jface.text.ITextDoubleClickStrategy strategy, java.lang.String contentType)
          Sets this viewer's text double click strategy for the given content type.
 void setTextHover(org.eclipse.jface.text.ITextHover textViewerHover, java.lang.String contentType)
          Sets this viewer's text hover for the given content type.
 void setTopIndex(int index)
          Scrolls the widget so that the given index is the line with the smallest line number of all visible lines.
 void setUndoManager(org.eclipse.jface.text.IUndoManager undoManager)
          Sets this viewer's undo manager.
 void setVisibleRegion(int offset, int length)
          Defines and sets the region of this viewer's document which will be visible in the presentation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DummyTextViewer

public DummyTextViewer(org.eclipse.jface.viewers.ISelection selection,
                       org.eclipse.jface.text.IDocument document)
Method Detail

activatePlugins

public void activatePlugins()
Description copied from interface: org.eclipse.jface.text.ITextViewer
Activates the installed plug-ins. If the plug-ins are already activated this call has no effect.

Specified by:
activatePlugins in interface org.eclipse.jface.text.ITextViewer

addTextInputListener

public void addTextInputListener(org.eclipse.jface.text.ITextInputListener listener)
Description copied from interface: org.eclipse.jface.text.ITextViewer
Adds a text input listener to this viewer. If the listener is already registered with this viewer, this call has no effect.

Specified by:
addTextInputListener in interface org.eclipse.jface.text.ITextViewer
Parameters:
listener - the listener to be added

addTextListener

public void addTextListener(org.eclipse.jface.text.ITextListener listener)
Description copied from interface: org.eclipse.jface.text.ITextViewer
Adds a text listener to this viewer. If the listener is already registered with this viewer, this call has no effect.

Specified by:
addTextListener in interface org.eclipse.jface.text.ITextViewer
Parameters:
listener - the listener to be added

addViewportListener

public void addViewportListener(org.eclipse.jface.text.IViewportListener listener)
Description copied from interface: org.eclipse.jface.text.ITextViewer
Adds the given view port listener to this viewer. If the listener is already registered with this viewer, this call has no effect.

Specified by:
addViewportListener in interface org.eclipse.jface.text.ITextViewer
Parameters:
listener - the listener to be added

changeTextPresentation

public void changeTextPresentation(org.eclipse.jface.text.TextPresentation presentation,
                                   boolean controlRedraw)
Description copied from interface: org.eclipse.jface.text.ITextViewer
Applies the color information encoded in the given text presentation. controlRedraw tells this viewer whether it should take care of redraw management or not. If, e.g., this call is one in a sequence of multiple presentation calls, it is more appropriate to explicitly control redrawing at the beginning and the end of the sequence.

Specified by:
changeTextPresentation in interface org.eclipse.jface.text.ITextViewer
Parameters:
presentation - the presentation to be applied to this viewer
controlRedraw - indicates whether this viewer should manage redraws

getBottomIndex

public int getBottomIndex()
Description copied from interface: org.eclipse.jface.text.ITextViewer
Returns the visible line with the highest line number.

Specified by:
getBottomIndex in interface org.eclipse.jface.text.ITextViewer
Returns:
the number of the bottom most line

getBottomIndexEndOffset

public int getBottomIndexEndOffset()
Description copied from interface: org.eclipse.jface.text.ITextViewer
Returns the document offset of the lower right corner of this viewer's view port. This is the visible character with the highest character position. If the content of this viewer is shorter, the position of the last character of the content is returned.

Specified by:
getBottomIndexEndOffset in interface org.eclipse.jface.text.ITextViewer
Returns:
the lower right corner offset

getDocument

public org.eclipse.jface.text.IDocument getDocument()
Description copied from interface: org.eclipse.jface.text.ITextViewer
Returns the text viewer's input document.

Specified by:
getDocument in interface org.eclipse.jface.text.ITextViewer
Returns:
the viewer's input document or null if none

getFindReplaceTarget

public org.eclipse.jface.text.IFindReplaceTarget getFindReplaceTarget()
Description copied from interface: org.eclipse.jface.text.ITextViewer
Returns the find/replace operation target of this viewer.

Specified by:
getFindReplaceTarget in interface org.eclipse.jface.text.ITextViewer
Returns:
the find/replace operation target of this viewer

getSelectedRange

public org.eclipse.swt.graphics.Point getSelectedRange()
Description copied from interface: org.eclipse.jface.text.ITextViewer
Returns the range of the current selection in coordinates of this viewer's document.

Specified by:
getSelectedRange in interface org.eclipse.jface.text.ITextViewer
Returns:
a Point with x as the offset and y as the length of the current selection

getSelectionProvider

public org.eclipse.jface.viewers.ISelectionProvider getSelectionProvider()
Description copied from interface: org.eclipse.jface.text.ITextViewer
Returns a selection provider dedicated to this viewer. Subsequent calls to this method return always the same selection provider.

Specified by:
getSelectionProvider in interface org.eclipse.jface.text.ITextViewer
Returns:
this viewer's selection provider

getTextOperationTarget

public org.eclipse.jface.text.ITextOperationTarget getTextOperationTarget()
Description copied from interface: org.eclipse.jface.text.ITextViewer
Returns the text operation target of this viewer.

Specified by:
getTextOperationTarget in interface org.eclipse.jface.text.ITextViewer
Returns:
the text operation target of this viewer

getTextWidget

public org.eclipse.swt.custom.StyledText getTextWidget()
Description copied from interface: org.eclipse.jface.text.ITextViewer
Returns this viewer's SWT control, null if the control is disposed.

Calling API directly on the widget can interfere with features provided by a text viewer. Clients who call API directly on the widget are responsible to resolve such conflicts on their side.

Specified by:
getTextWidget in interface org.eclipse.jface.text.ITextViewer
Returns:
the SWT control or null

getTopIndex

public int getTopIndex()
Description copied from interface: org.eclipse.jface.text.ITextViewer
Returns the visible line with the smallest line number.

Specified by:
getTopIndex in interface org.eclipse.jface.text.ITextViewer
Returns:
the number of the top most visible line

getTopIndexStartOffset

public int getTopIndexStartOffset()
Description copied from interface: org.eclipse.jface.text.ITextViewer
Returns the document offset of the upper left corner of this viewer's view port.

Specified by:
getTopIndexStartOffset in interface org.eclipse.jface.text.ITextViewer
Returns:
the upper left corner offset

getTopInset

public int getTopInset()
Description copied from interface: org.eclipse.jface.text.ITextViewer
Returns the vertical offset of the first visible line.

Specified by:
getTopInset in interface org.eclipse.jface.text.ITextViewer
Returns:
the vertical offset of the first visible line

getVisibleRegion

public org.eclipse.jface.text.IRegion getVisibleRegion()
Description copied from interface: org.eclipse.jface.text.ITextViewer
Returns the current visible region of this viewer's document. The result may differ from the argument passed to setVisibleRegion if the document has been modified since then. The visible region is supposed to be a consecutive region in viewer's input document and every character inside that region is supposed to visible in the viewer's widget.

Viewers implementing ITextViewerExtension5 may be forced to change the fractions of the input document that are shown, in order to fulfill this contract.

Specified by:
getVisibleRegion in interface org.eclipse.jface.text.ITextViewer
Returns:
this viewer's current visible region

invalidateTextPresentation

public void invalidateTextPresentation()
Description copied from interface: org.eclipse.jface.text.ITextViewer
Marks the currently applied text presentation as invalid. It is the viewer's responsibility to take any action it can to repair the text presentation.

See ITextViewerExtension2.invalidateTextPresentation(int, int) for a way to invalidate specific regions rather than the presentation as a whole.

Specified by:
invalidateTextPresentation in interface org.eclipse.jface.text.ITextViewer

isEditable

public boolean isEditable()
Description copied from interface: org.eclipse.jface.text.ITextViewer
Returns whether the shown text can be manipulated.

Specified by:
isEditable in interface org.eclipse.jface.text.ITextViewer
Returns:
the viewer's editable state

overlapsWithVisibleRegion

public boolean overlapsWithVisibleRegion(int offset,
                                         int length)
Description copied from interface: org.eclipse.jface.text.ITextViewer
Returns whether a given range overlaps with the visible region of this viewer's document.

Viewers implementing ITextViewerExtension5may be forced to change the fractions of the input document that are shown in order to fulfill this request. This is because the overlap is supposed to be without gaps.

Specified by:
overlapsWithVisibleRegion in interface org.eclipse.jface.text.ITextViewer
Parameters:
offset - the offset
length - the length
Returns:
true if the specified range overlaps with the visible region

removeTextInputListener

public void removeTextInputListener(org.eclipse.jface.text.ITextInputListener listener)
Description copied from interface: org.eclipse.jface.text.ITextViewer
Removes the given listener from this viewer's set of text input listeners. If the listener is not registered with this viewer, this call has no effect.

Specified by:
removeTextInputListener in interface org.eclipse.jface.text.ITextViewer
Parameters:
listener - the listener to be removed

removeTextListener

public void removeTextListener(org.eclipse.jface.text.ITextListener listener)
Description copied from interface: org.eclipse.jface.text.ITextViewer
Removes the given listener from this viewer's set of text listeners. If the listener is not registered with this viewer, this call has no effect.

Specified by:
removeTextListener in interface org.eclipse.jface.text.ITextViewer
Parameters:
listener - the listener to be removed

removeViewportListener

public void removeViewportListener(org.eclipse.jface.text.IViewportListener listener)
Description copied from interface: org.eclipse.jface.text.ITextViewer
Removes the given listener from this viewer's set of view port listeners. If the listener is not registered with this viewer, this call has no effect.

Specified by:
removeViewportListener in interface org.eclipse.jface.text.ITextViewer
Parameters:
listener - the listener to be removed

resetPlugins

public void resetPlugins()
Description copied from interface: org.eclipse.jface.text.ITextViewer
Resets the installed plug-ins. If plug-ins change their state or behavior over the course of time, this method causes them to be set back to their initial state and behavior. E.g., if an IUndoManager has been installed on this text viewer, the manager's list of remembered text editing operations is removed.

Specified by:
resetPlugins in interface org.eclipse.jface.text.ITextViewer

resetVisibleRegion

public void resetVisibleRegion()
Description copied from interface: org.eclipse.jface.text.ITextViewer
Resets the region of this viewer's document which is visible in the presentation. Afterwards, the whole input document is visible.

Specified by:
resetVisibleRegion in interface org.eclipse.jface.text.ITextViewer

revealRange

public void revealRange(int offset,
                        int length)
Description copied from interface: org.eclipse.jface.text.ITextViewer
Ensures that the given range is visible.

Specified by:
revealRange in interface org.eclipse.jface.text.ITextViewer
Parameters:
offset - the offset of the range to be revealed
length - the length of the range to be revealed

setAutoIndentStrategy

@Deprecated
public void setAutoIndentStrategy(org.eclipse.jface.text.IAutoIndentStrategy strategy,
                                             java.lang.String contentType)
Deprecated. 

Description copied from interface: org.eclipse.jface.text.ITextViewer
Sets this viewer's auto indent strategy for the given content type. If the given strategy is null any installed strategy for the content type is removed. This method has been replaced by ITextViewerExtension2.prependAutoEditStrategy(IAutoEditStrategy, String) and ITextViewerExtension2.removeAutoEditStrategy(IAutoEditStrategy, String). It is now equivalent to
                ITextViewerExtension2 extension= (ITextViewerExtension2) viewer;
                extension.removeAutoEditStrategy(oldStrategy, contentType);
                extension.prependAutoEditStrategy(strategy, contentType);
 

Specified by:
setAutoIndentStrategy in interface org.eclipse.jface.text.ITextViewer
Parameters:
strategy - the new auto indent strategy. null is a valid argument.
contentType - the type for which the strategy is registered

setDefaultPrefixes

public void setDefaultPrefixes(java.lang.String[] defaultPrefixes,
                               java.lang.String contentType)
Description copied from interface: org.eclipse.jface.text.ITextViewer
Sets the strings that are used as prefixes when lines of the given content type are prefixed using the prefix text operation. The prefixes are considered equivalent. Inserting a prefix always inserts the defaultPrefixes[0]. Removing a prefix removes all of the specified prefixes.

Specified by:
setDefaultPrefixes in interface org.eclipse.jface.text.ITextViewer
Parameters:
defaultPrefixes - the prefixes to be used
contentType - the content type for which the prefixes are specified

setDocument

public void setDocument(org.eclipse.jface.text.IDocument document)
Description copied from interface: org.eclipse.jface.text.ITextViewer
Sets the given document as the text viewer's model and updates the presentation accordingly. An appropriate TextEvent is issued. This text event does not carry a related document event.

Specified by:
setDocument in interface org.eclipse.jface.text.ITextViewer
Parameters:
document - the viewer's new input document null if none

setDocument

public void setDocument(org.eclipse.jface.text.IDocument document,
                        int modelRangeOffset,
                        int modelRangeLength)
Description copied from interface: org.eclipse.jface.text.ITextViewer
Sets the given document as this viewer's model and exposes the specified region. An appropriate TextEvent is issued. The text event does not carry a related document event. This method is a convenience method for setDocument(document);setVisibleRegion(offset, length).

Specified by:
setDocument in interface org.eclipse.jface.text.ITextViewer
Parameters:
document - the new input document or null if none
modelRangeOffset - the offset of the model range
modelRangeLength - the length of the model range

setEditable

public void setEditable(boolean editable)
Description copied from interface: org.eclipse.jface.text.ITextViewer
Sets the editable state.

Specified by:
setEditable in interface org.eclipse.jface.text.ITextViewer
Parameters:
editable - the editable state

setEventConsumer

public void setEventConsumer(org.eclipse.jface.text.IEventConsumer consumer)
Description copied from interface: org.eclipse.jface.text.ITextViewer
Registers an event consumer with this viewer. This method has been replaces with the VerifyKeyListener management methods in ITextViewerExtension.

Specified by:
setEventConsumer in interface org.eclipse.jface.text.ITextViewer
Parameters:
consumer - the viewer's event consumer. null is a valid argument.

setIndentPrefixes

public void setIndentPrefixes(java.lang.String[] indentPrefixes,
                              java.lang.String contentType)
Description copied from interface: org.eclipse.jface.text.ITextViewer
Sets the strings that are used as prefixes when lines of the given content type are shifted using the shift text operation. The prefixes are considered equivalent. Thus "\t" and " " can both be used as prefix characters. Shift right always inserts the indentPrefixes[0]. Shift left removes all of the specified prefixes.

Specified by:
setIndentPrefixes in interface org.eclipse.jface.text.ITextViewer
Parameters:
indentPrefixes - the prefixes to be used
contentType - the content type for which the prefixes are specified

setSelectedRange

public void setSelectedRange(int offset,
                             int length)
Description copied from interface: org.eclipse.jface.text.ITextViewer
Sets the selection to the specified range.

Specified by:
setSelectedRange in interface org.eclipse.jface.text.ITextViewer
Parameters:
offset - the offset of the selection range
length - the length of the selection range. A negative length places the caret at the visual start of the selection.

setTextColor

public void setTextColor(org.eclipse.swt.graphics.Color color)
Description copied from interface: org.eclipse.jface.text.ITextViewer
Applies the given color as text foreground color to this viewer's selection.

Specified by:
setTextColor in interface org.eclipse.jface.text.ITextViewer
Parameters:
color - the color to be applied

setTextColor

public void setTextColor(org.eclipse.swt.graphics.Color color,
                         int offset,
                         int length,
                         boolean controlRedraw)
Description copied from interface: org.eclipse.jface.text.ITextViewer
Applies the given color as text foreground color to the specified section of this viewer. controlRedraw tells this viewer whether it should take care of redraw management or not.

Specified by:
setTextColor in interface org.eclipse.jface.text.ITextViewer
Parameters:
color - the color to be applied
offset - the offset of the range to be changed
length - the length of the range to be changed
controlRedraw - indicates whether this viewer should manage redraws

setTextDoubleClickStrategy

public void setTextDoubleClickStrategy(org.eclipse.jface.text.ITextDoubleClickStrategy strategy,
                                       java.lang.String contentType)
Description copied from interface: org.eclipse.jface.text.ITextViewer
Sets this viewer's text double click strategy for the given content type.

Specified by:
setTextDoubleClickStrategy in interface org.eclipse.jface.text.ITextViewer
Parameters:
strategy - the new double click strategy. null is a valid argument.
contentType - the type for which the strategy is registered

setTextHover

public void setTextHover(org.eclipse.jface.text.ITextHover textViewerHover,
                         java.lang.String contentType)
Description copied from interface: org.eclipse.jface.text.ITextViewer
Sets this viewer's text hover for the given content type.

This method has been replaced by ITextViewerExtension2.setTextHover(ITextHover, String, int). It is now equivalent to

    ITextViewerExtension2 extension= (ITextViewerExtension2) document;
    extension.setTextHover(textViewerHover, contentType, ITextViewerExtension2#DEFAULT_HOVER_STATE_MASK);
 

Specified by:
setTextHover in interface org.eclipse.jface.text.ITextViewer
Parameters:
textViewerHover - the new hover. null is a valid argument.
contentType - the type for which the hover is registered

setTopIndex

public void setTopIndex(int index)
Description copied from interface: org.eclipse.jface.text.ITextViewer
Scrolls the widget so that the given index is the line with the smallest line number of all visible lines.

Specified by:
setTopIndex in interface org.eclipse.jface.text.ITextViewer
Parameters:
index - the line which should become the top most line

setUndoManager

public void setUndoManager(org.eclipse.jface.text.IUndoManager undoManager)
Description copied from interface: org.eclipse.jface.text.ITextViewer
Sets this viewer's undo manager.

Specified by:
setUndoManager in interface org.eclipse.jface.text.ITextViewer
Parameters:
undoManager - the new undo manager. null is a valid argument.

setVisibleRegion

public void setVisibleRegion(int offset,
                             int length)
Description copied from interface: org.eclipse.jface.text.ITextViewer
Defines and sets the region of this viewer's document which will be visible in the presentation. Every character inside the specified region is supposed to be visible in the viewer's widget after that call.

Specified by:
setVisibleRegion in interface org.eclipse.jface.text.ITextViewer
Parameters:
offset - the offset of the visible region
length - the length of the visible region

addSelectionChangedListener

public void addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)
Description copied from interface: org.eclipse.jface.viewers.ISelectionProvider
Adds a listener for selection changes in this selection provider. Has no effect if an identical listener is already registered.

Specified by:
addSelectionChangedListener in interface org.eclipse.jface.viewers.ISelectionProvider
Parameters:
listener - a selection changed listener

getSelection

public org.eclipse.jface.viewers.ISelection getSelection()
Description copied from interface: org.eclipse.jface.viewers.ISelectionProvider
Returns the current selection for this provider.

Specified by:
getSelection in interface org.eclipse.jface.viewers.ISelectionProvider
Returns:
the current selection

removeSelectionChangedListener

public void removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)
Description copied from interface: org.eclipse.jface.viewers.ISelectionProvider
Removes the given selection change listener from this selection provider. Has no effect if an identical listener is not registered.

Specified by:
removeSelectionChangedListener in interface org.eclipse.jface.viewers.ISelectionProvider
Parameters:
listener - a selection changed listener

setSelection

public void setSelection(org.eclipse.jface.viewers.ISelection selection)
Description copied from interface: org.eclipse.jface.viewers.ISelectionProvider
Sets the current selection for this selection provider.

Specified by:
setSelection in interface org.eclipse.jface.viewers.ISelectionProvider
Parameters:
selection - the new selection