Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.jface.fieldassist
Class TextContentAdapter

java.lang.Object
  extended by 
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 Summary
TextContentAdapter ()
           
 
Method Summary
  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 position)
          Set the current cursor position in the control.
 void setSelection ( Control control, Point range)
          Set the current selection range in the control.
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextContentAdapter

public TextContentAdapter()
Method Detail

getControlContents

public 
String getControlContents(
Control control)
Description copied from interface: IControlContentAdapter
Get the text contents of the control.

Specified by:
getControlContents in interface IControlContentAdapter
Parameters:
control - the control whose contents are to be retrieved.
Returns:
the String contents of the control.

setControlContents

public void setControlContents(
Control control,
                               
String text,
                               int cursorPosition)
Description copied from interface: IControlContentAdapter
Set the contents of the specified control to the specified text. Must not be null.

Specified by:
setControlContents in 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.

insertControlContents

public void insertControlContents(
Control control,
                                  
String text,
                                  int cursorPosition)
Description copied from interface: IControlContentAdapter
Insert the specified contents into the control's current contents. Must not be null.

Specified by:
insertControlContents in 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.

getCursorPosition

public int getCursorPosition(
Control control)
Description copied from interface: IControlContentAdapter
Get 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:
getCursorPosition in 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.

getInsertionBounds

public 
Rectangle getInsertionBounds(
Control control)
Description copied from interface: IControlContentAdapter
Get 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:
getInsertionBounds in 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.

setCursorPosition

public void setCursorPosition(
Control control,
                              int position)
Description copied from interface: IControlContentAdapter
Set 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:
setCursorPosition in 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.

getSelection

public 
Point getSelection(
Control control)
Description copied from interface: IControlContentAdapter2
Get 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:
getSelection in 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:
IControlContentAdapter2.getSelection(org.eclipse.swt.widgets.Control)

setSelection

public void setSelection(
Control control,
                         
Point range)
Description copied from interface: IControlContentAdapter2
Set 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:
setSelection in 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:
IControlContentAdapter2.setSelection(org.eclipse.swt.widgets.Control, org.eclipse.swt.graphics.Point)

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire