public class ComboContentAdapter extends Object implements IControlContentAdapter, IControlContentAdapter2
IControlContentAdapter
for SWT Combo controls. This is a
convenience class for easily creating a ContentProposalAdapter
for
combo fields.Constructor and Description |
---|
ComboContentAdapter() |
Modifier and Type | Method and Description |
---|---|
String |
getControlContents(Control control)
Get the text contents of the control.
|
int |
getCursorPosition(Control control)
Get the current cursor position in the control.
|
Rectangle |
getInsertionBounds(Control control)
Get the bounds (in pixels) of the insertion point for the control
content.
|
Point |
getSelection(Control control)
Get the current selection range in the control.
|
void |
insertControlContents(Control control,
String text,
int cursorPosition)
Insert the specified contents into the control's current contents.
|
void |
setControlContents(Control control,
String text,
int cursorPosition)
Set the contents of the specified control to the specified text.
|
void |
setCursorPosition(Control control,
int index)
Set the current cursor position in the control.
|
void |
setSelection(Control control,
Point range)
Set the current selection range in the control.
|
public String getControlContents(Control control)
IControlContentAdapter
getControlContents
in interface IControlContentAdapter
control
- the control whose contents are to be retrieved.public void setControlContents(Control control, String text, int cursorPosition)
IControlContentAdapter
null
.setControlContents
in interface IControlContentAdapter
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.public void insertControlContents(Control control, String text, int cursorPosition)
IControlContentAdapter
null
.insertControlContents
in interface IControlContentAdapter
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.public int getCursorPosition(Control control)
IControlContentAdapter
getCursorPosition
in interface IControlContentAdapter
control
- the control whose position is to be retrieved.public Rectangle getInsertionBounds(Control control)
IControlContentAdapter
getInsertionBounds
in interface IControlContentAdapter
control
- the control whose offset is to be retrieved.public void setCursorPosition(Control control, int index)
IControlContentAdapter
setCursorPosition
in interface IControlContentAdapter
control
- the control whose cursor position is to be set.index
- the zero-based index representing the cursor position in the
control's contents.public Point getSelection(Control control)
IControlContentAdapter2
getSelection
in interface IControlContentAdapter2
control
- the control whose position is to be retrieved.IControlContentAdapter2.getSelection(org.eclipse.swt.widgets.Control)
public void setSelection(Control control, Point range)
IControlContentAdapter2
setSelection
in interface IControlContentAdapter2
control
- the control whose position is to be retrieved.range
- a point representing the selection start and endIControlContentAdapter2.setSelection(org.eclipse.swt.widgets.Control,
org.eclipse.swt.graphics.Point)
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.