Package org.eclipse.jface.fieldassist
Class TextContentAdapter
java.lang.Object
org.eclipse.jface.fieldassist.TextContentAdapter
- All Implemented Interfaces:
- IControlContentAdapter,- IControlContentAdapter2
public class TextContentAdapter
extends Object
implements IControlContentAdapter, IControlContentAdapter2
An 
IControlContentAdapter for SWT Text controls. This is a
 convenience class for easily creating a ContentProposalAdapter for
 text fields.- Since:
- 3.2
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptiongetControlContents(Control control) Get the text contents of the control.intgetCursorPosition(Control control) Get the current cursor position in the control.getInsertionBounds(Control control) Get the bounds (in pixels) of the insertion point for the control content.getSelection(Control control) Get the current selection range in the control.voidinsertControlContents(Control control, String text, int cursorPosition) Insert the specified contents into the control's current contents.voidsetControlContents(Control control, String text, int cursorPosition) Set the contents of the specified control to the specified text.voidsetCursorPosition(Control control, int position) Set the current cursor position in the control.voidsetSelection(Control control, Point range) Set the current selection range in the control.
- 
Constructor Details- 
TextContentAdapterpublic TextContentAdapter()
 
- 
- 
Method Details- 
getControlContentsDescription copied from interface:IControlContentAdapterGet the text contents of the control.- Specified by:
- getControlContentsin interface- IControlContentAdapter
- Parameters:
- control- the control whose contents are to be retrieved.
- Returns:
- the String contents of the control.
 
- 
setControlContentsDescription copied from interface:IControlContentAdapterSet the contents of the specified control to the specified text. Must not benull.- Specified by:
- setControlContentsin interface- IControlContentAdapter
- Parameters:
- control- the control whose contents are to be set (replaced).
- text- the String specifying the new control content.
- cursorPosition- the zero-based index representing the desired cursor position in the control's contents after the contents are set.
 
- 
insertControlContentsDescription copied from interface:IControlContentAdapterInsert the specified contents into the control's current contents. Must not benull.- Specified by:
- insertControlContentsin interface- IControlContentAdapter
- Parameters:
- control- the control whose contents are to be altered.
- text- the String to be inserted into the control contents.
- cursorPosition- the zero-based index representing the desired cursor position within the inserted contents after the insertion is made.
 
- 
getCursorPositionDescription copied from interface:IControlContentAdapterGet the current cursor position in the control. The position is specified as a zero-based index into the string. Valid ranges are from 0 to N, where N is the size of the contents string. A value of N indicates that the cursor is at the end of the contents.- Specified by:
- getCursorPositionin interface- IControlContentAdapter
- Parameters:
- control- the control whose position is to be retrieved.
- Returns:
- the zero-based index representing the cursor position in the control's contents.
 
- 
getInsertionBoundsDescription copied from interface:IControlContentAdapterGet the bounds (in pixels) of the insertion point for the control content. This is a rectangle, in coordinates relative to the control, where the insertion point is displayed. If the implementer does not have an insertion point, or cannot determine the location of the insertion point, it is appropriate to return the bounds of the entire control. This value may be used to position a content proposal popup.- Specified by:
- getInsertionBoundsin interface- IControlContentAdapter
- Parameters:
- control- the control whose offset is to be retrieved.
- Returns:
- the pixel width representing the distance between the edge of the control and the insertion point.
 
- 
setCursorPositionDescription copied from interface:IControlContentAdapterSet the current cursor position in the control. The position is specified as a zero-based index into the string. Valid ranges are from 0 to N, where N is the size of the contents string. A value of N indicates that the cursor is at the end of the contents.- Specified by:
- setCursorPositionin interface- IControlContentAdapter
- Parameters:
- control- the control whose cursor position is to be set.
- position- the zero-based index representing the cursor position in the control's contents.
 
- 
getSelectionDescription copied from interface:IControlContentAdapter2Get the current selection range in the control. The x coordinate of the returned point is the position of the first selected character and the y coordinate of the returned point is the position of the last selected character. The positions are specified as a zero-based index into the string. Valid ranges are from 0 to N, where N is the size of the contents string. A value of N indicates that the last character is in the selection.- Specified by:
- getSelectionin interface- IControlContentAdapter2
- Parameters:
- control- the control whose position is to be retrieved.
- Returns:
- a point representing the selection start and end
- Since:
- 3.4
- See Also:
 
- 
setSelectionDescription copied from interface:IControlContentAdapter2Set the current selection range in the control. The x coordinate of the provided point is the position of the first selected character and the y coordinate of the point is the position of the last selected character. The positions are specified as a zero-based index into the string. Valid ranges are from 0 to N, where N is the size of the contents string. A value of N indicates that the last character is in the selection. If the x and y coordinates are the same, then there is no selection.- Specified by:
- setSelectionin interface- IControlContentAdapter2
- Parameters:
- control- the control whose position is to be retrieved.
- range- a point representing the selection start and end
- Since:
- 3.4
- See Also:
 
 
-