Class ContentProposal

java.lang.Object
org.eclipse.jface.fieldassist.ContentProposal
All Implemented Interfaces:
IContentProposal

public class ContentProposal extends Object implements IContentProposal
A default implementation of IContentProposal that allows clients to specify a content proposal using simple constructors.
Since:
3.6
  • Constructor Details

    • 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 be null.
    • 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 be null. This string will also be used as the label.
      description - the String representing the description, or null 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 be null.
      label - the String representing the label. Should not be null.
      description - the String representing the description, or null 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 be null.
      label - the String representing the label. Should not be null.
      description - the String representing the description, or null 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 Details

    • getContent

      public String getContent()
      Description copied from interface: IContentProposal
      Return the content represented by this proposal.
      Specified by:
      getContent in interface IContentProposal
      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 interface IContentProposal
      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 interface IContentProposal
      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 interface IContentProposal
      Returns:
      the String label used to display the proposal. If null, then the content will be displayed as the label.