Package org.eclipse.jface.fieldassist
Class ContentProposal
- java.lang.Object
-
- org.eclipse.jface.fieldassist.ContentProposal
-
- All Implemented Interfaces:
IContentProposal
public class ContentProposal extends Object implements IContentProposal
A default implementation ofIContentProposal
that allows clients to specify a content proposal using simple constructors.- Since:
- 3.6
-
-
Constructor Summary
Constructors Constructor Description ContentProposal(String content)
Create a content proposal whose label and content are the specified String.ContentProposal(String content, String description)
Create a content proposal whose content and description are as specified in the parameters.ContentProposal(String content, String label, String description)
Create a content proposal whose content, label, and description are as specified in the parameters.ContentProposal(String content, String label, String description, int cursorPosition)
Create a content proposal whose content, label, description, and cursor position are as specified in the parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getContent()
Return the content represented by this proposal.int
getCursorPosition()
Return the integer position within the contents that the cursor should be placed after the proposal is accepted.String
getDescription()
Return a description that describes this proposal.String
getLabel()
Return the label used to describe this proposal.
-
-
-
Constructor Detail
-
ContentProposal
public ContentProposal(String content)
Create a content proposal whose label and content are the specified String. The cursor position will be located at the end of the content.- Parameters:
content
- the String representing the content. Should not benull
.
-
ContentProposal
public ContentProposal(String content, String description)
Create a content proposal whose content and description are as specified in the parameters. The cursor position will be located at the end of the content.- Parameters:
content
- the String representing the content. Should not benull
. This string will also be used as the label.description
- the String representing the description, ornull
if there should be no description.
-
ContentProposal
public ContentProposal(String content, String label, String description)
Create a content proposal whose content, label, and description are as specified in the parameters. The cursor position will be located at the end of the content.- Parameters:
content
- the String representing the content. Should not benull
.label
- the String representing the label. Should not benull
.description
- the String representing the description, ornull
if there should be no description.
-
ContentProposal
public ContentProposal(String content, String label, String description, int cursorPosition)
Create a content proposal whose content, label, description, and cursor position are as specified in the parameters.- Parameters:
content
- the String representing the content. Should not benull
.label
- the String representing the label. Should not benull
.description
- the String representing the description, ornull
if there should be no description.cursorPosition
- the zero-based index position within the contents where the cursor should be placed after the proposal is accepted. The range of the cursor position is from 0..N where N is the number of characters in the content.- Throws:
IllegalArgumentException
- if the index is not between 0 and the number of characters in the content.
-
-
Method Detail
-
getContent
public String getContent()
Description copied from interface:IContentProposal
Return the content represented by this proposal.- Specified by:
getContent
in interfaceIContentProposal
- Returns:
- the String content represented by this proposal.
-
getCursorPosition
public int getCursorPosition()
Description copied from interface:IContentProposal
Return the integer position within the contents that the cursor should be placed after the proposal is accepted.- Specified by:
getCursorPosition
in interfaceIContentProposal
- Returns:
- the zero-based index position within the contents where the cursor should be placed after the proposal is accepted. The range of the cursor position is from 0..N where N is the number of characters in the contents.
-
getDescription
public String getDescription()
Description copied from interface:IContentProposal
Return a description that describes this proposal.- Specified by:
getDescription
in interfaceIContentProposal
- Returns:
- the String label used to further the proposal. If
null
, then no description will be displayed.
-
getLabel
public String getLabel()
Description copied from interface:IContentProposal
Return the label used to describe this proposal.- Specified by:
getLabel
in interfaceIContentProposal
- Returns:
- the String label used to display the proposal. If
null
, then the content will be displayed as the label.
-
-