org.eclipse.datatools.sqltools.sqlbuilder.views.source
Class SQLCompletionProposal

java.lang.Object
  extended by org.eclipse.datatools.sqltools.sqlbuilder.views.source.SQLCompletionProposal
All Implemented Interfaces:
org.eclipse.jface.text.contentassist.ICompletionProposal, org.eclipse.jface.text.contentassist.ICompletionProposalExtension

public class SQLCompletionProposal
extends java.lang.Object
implements org.eclipse.jface.text.contentassist.ICompletionProposal, org.eclipse.jface.text.contentassist.ICompletionProposalExtension


Field Summary
static int PROPOSAL_TYPE_COLUMN
           
static int PROPOSAL_TYPE_SCHEMA
           
static int PROPOSAL_TYPE_SYNTAX
           
static int PROPOSAL_TYPE_TABLE
           
static int PROPOSAL_TYPE_UNSPECIFIED
           
 
Constructor Summary
SQLCompletionProposal(java.lang.String replacementString, int replacementOffset, int documentOffset, int replacementLength, org.eclipse.swt.graphics.Image image, java.lang.String displayString, org.eclipse.jface.text.contentassist.IContextInformation contextInformation)
          Creates a new completion proposal.
SQLCompletionProposal(java.lang.String replacementString, int replacementOffset, int replacementLength, int cursorPosition, org.eclipse.swt.graphics.Image image, java.lang.String displayString, org.eclipse.jface.text.contentassist.IContextInformation contextInformation, java.lang.String additionalProposalInfo)
          Creates a new completion proposal.
 
Method Summary
 void apply(org.eclipse.jface.text.IDocument document)
           
 void apply(org.eclipse.jface.text.IDocument document, char trigger, int offset)
           
 java.lang.String getAdditionalProposalInfo()
           
 org.eclipse.jface.text.contentassist.IContextInformation getContextInformation()
           
 int getContextInformationPosition()
           
 java.lang.String getDisplayString()
           
 org.eclipse.swt.graphics.Image getImage()
           
 int getProposalType()
          Gets the proposal type of this proposal.
 int getReplacementLength()
          Gets the replacement length.
 int getReplacementOffset()
          Gets the replacement offset.
 java.lang.String getReplacementString()
          Gets the replacement string.
 org.eclipse.swt.graphics.Point getSelection(org.eclipse.jface.text.IDocument document)
           
 char[] getTriggerCharacters()
           
 boolean isValidFor(org.eclipse.jface.text.IDocument document, int offset)
           
 void setContextInformation(org.eclipse.jface.text.contentassist.IContextInformation contextInformation)
          Sets the context information.
 void setCursorPosition(int cursorPosition)
          Sets the cursor position relative to the insertion offset.
 void setImage(org.eclipse.swt.graphics.Image image)
          Sets the image.
 void setProposalType(int proposalType)
          Sets the proposal type for this proposal to the given type.
 void setReplacementLength(int replacementLength)
          Sets the replacement length.
 void setReplacementOffset(int replacementOffset)
          Sets the replacement offset.
 void setReplacementString(java.lang.String replacementString)
          Sets the replacement string.
 void setTriggerCharacters(char[] triggerCharacters)
          Sets the trigger characters.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPOSAL_TYPE_UNSPECIFIED

public static final int PROPOSAL_TYPE_UNSPECIFIED
See Also:
Constant Field Values

PROPOSAL_TYPE_SYNTAX

public static final int PROPOSAL_TYPE_SYNTAX
See Also:
Constant Field Values

PROPOSAL_TYPE_SCHEMA

public static final int PROPOSAL_TYPE_SCHEMA
See Also:
Constant Field Values

PROPOSAL_TYPE_TABLE

public static final int PROPOSAL_TYPE_TABLE
See Also:
Constant Field Values

PROPOSAL_TYPE_COLUMN

public static final int PROPOSAL_TYPE_COLUMN
See Also:
Constant Field Values
Constructor Detail

SQLCompletionProposal

public SQLCompletionProposal(java.lang.String replacementString,
                             int replacementOffset,
                             int documentOffset,
                             int replacementLength,
                             org.eclipse.swt.graphics.Image image,
                             java.lang.String displayString,
                             org.eclipse.jface.text.contentassist.IContextInformation contextInformation)
Creates a new completion proposal. All fields are initialized based on the provided information.

Parameters:
replacementString - the actual string to be inserted into the document
replacementOffset - the offset of the text to be replaced
documentOffset - the offset of the text to be replaced
replacementLength - the length of the text to be replaced
image - the image to display for this proposal
displayString - the string to be displayed for the proposal If set to null, the replacement string will be taken as display string.

SQLCompletionProposal

public SQLCompletionProposal(java.lang.String replacementString,
                             int replacementOffset,
                             int replacementLength,
                             int cursorPosition,
                             org.eclipse.swt.graphics.Image image,
                             java.lang.String displayString,
                             org.eclipse.jface.text.contentassist.IContextInformation contextInformation,
                             java.lang.String additionalProposalInfo)
Creates a new completion proposal. All fields are initialized based on the provided information.

Parameters:
replacementString - the actual string to be inserted into the document
replacementOffset - the offset of the text to be replaced
replacementLength - the length of the text to be replaced
cursorPosition - the position of the cursor following the insert relative to replacementOffset
image - the image to display for this proposal
displayString - the string to be displayed for the proposal
contentInformation - the context information associated with this proposal
additionalProposalInfo - the additional information associated with this proposal
Method Detail

setContextInformation

public void setContextInformation(org.eclipse.jface.text.contentassist.IContextInformation contextInformation)
Sets the context information.

Parameters:
contentInformation - The context information associated with this proposal

setTriggerCharacters

public void setTriggerCharacters(char[] triggerCharacters)
Sets the trigger characters.

Parameters:
triggerCharacters - The set of characters which can trigger the application of this completion proposal

setCursorPosition

public void setCursorPosition(int cursorPosition)
Sets the cursor position relative to the insertion offset. By default this is the length of the completion string (Cursor positioned after the completion)

Parameters:
cursorPosition - The cursorPosition to set

apply

public void apply(org.eclipse.jface.text.IDocument document,
                  char trigger,
                  int offset)
Specified by:
apply in interface org.eclipse.jface.text.contentassist.ICompletionProposalExtension

apply

public void apply(org.eclipse.jface.text.IDocument document)
Specified by:
apply in interface org.eclipse.jface.text.contentassist.ICompletionProposal

getSelection

public org.eclipse.swt.graphics.Point getSelection(org.eclipse.jface.text.IDocument document)
Specified by:
getSelection in interface org.eclipse.jface.text.contentassist.ICompletionProposal

getContextInformation

public org.eclipse.jface.text.contentassist.IContextInformation getContextInformation()
Specified by:
getContextInformation in interface org.eclipse.jface.text.contentassist.ICompletionProposal

getImage

public org.eclipse.swt.graphics.Image getImage()
Specified by:
getImage in interface org.eclipse.jface.text.contentassist.ICompletionProposal

getDisplayString

public java.lang.String getDisplayString()
Specified by:
getDisplayString in interface org.eclipse.jface.text.contentassist.ICompletionProposal

getAdditionalProposalInfo

public java.lang.String getAdditionalProposalInfo()
Specified by:
getAdditionalProposalInfo in interface org.eclipse.jface.text.contentassist.ICompletionProposal

getTriggerCharacters

public char[] getTriggerCharacters()
Specified by:
getTriggerCharacters in interface org.eclipse.jface.text.contentassist.ICompletionProposalExtension

getContextInformationPosition

public int getContextInformationPosition()
Specified by:
getContextInformationPosition in interface org.eclipse.jface.text.contentassist.ICompletionProposalExtension

getReplacementOffset

public int getReplacementOffset()
Gets the replacement offset.

Returns:
Returns a int

setReplacementOffset

public void setReplacementOffset(int replacementOffset)
Sets the replacement offset.

Parameters:
replacementOffset - The replacement offset to set

getReplacementLength

public int getReplacementLength()
Gets the replacement length.

Returns:
Returns a int

setReplacementLength

public void setReplacementLength(int replacementLength)
Sets the replacement length.

Parameters:
replacementLength - The replacementLength to set

getReplacementString

public java.lang.String getReplacementString()
Gets the replacement string.

Returns:
Returns a String

setReplacementString

public void setReplacementString(java.lang.String replacementString)
Sets the replacement string.

Parameters:
replacementString - The replacement string to set

setImage

public void setImage(org.eclipse.swt.graphics.Image image)
Sets the image.

Parameters:
image - The image to set

isValidFor

public boolean isValidFor(org.eclipse.jface.text.IDocument document,
                          int offset)
Specified by:
isValidFor in interface org.eclipse.jface.text.contentassist.ICompletionProposalExtension

getProposalType

public int getProposalType()
Gets the proposal type of this proposal. See the proposal type constants defined in this class.

Returns:
the proposal type

setProposalType

public void setProposalType(int proposalType)
Sets the proposal type for this proposal to the given type. See the proposal type constants defined in this class.

Parameters:
proposalType - the proposal type to set