Class InternalCompletionProposal
- Since:
- 3.1
-
Field Summary
Modifier and TypeFieldDescriptionprotected int
protected CompletionEngine
protected char[]
protected char[]
protected boolean
protected char[]
protected NameLookup
protected char[]
protected char[]
protected char[][]
protected char[][]
protected char[]
Fields inherited from class org.aspectj.org.eclipse.jdt.core.CompletionProposal
ANNOTATION_ATTRIBUTE_REF, ANONYMOUS_CLASS_CONSTRUCTOR_INVOCATION, ANONYMOUS_CLASS_DECLARATION, CONSTRUCTOR_INVOCATION, FIELD_IMPORT, FIELD_REF, FIELD_REF_WITH_CASTED_RECEIVER, FIRST_KIND, JAVADOC_BLOCK_TAG, JAVADOC_FIELD_REF, JAVADOC_INLINE_TAG, JAVADOC_METHOD_REF, JAVADOC_PARAM_REF, JAVADOC_TYPE_REF, JAVADOC_VALUE_REF, KEYWORD, LABEL_REF, LAMBDA_EXPRESSION, LAST_KIND, LOCAL_VARIABLE_REF, METHOD_DECLARATION, METHOD_IMPORT, METHOD_NAME_REFERENCE, METHOD_REF, METHOD_REF_WITH_CASTED_RECEIVER, MODULE_DECLARATION, MODULE_REF, PACKAGE_REF, POTENTIAL_METHOD_DECLARATION, TYPE_IMPORT, TYPE_REF, VARIABLE_DECLARATION
-
Constructor Summary
ConstructorDescriptionInternalCompletionProposal
(int kind, int completionLocation) Creates a basic completion proposal. -
Method Summary
Modifier and TypeMethodDescriptionboolean
canUseDiamond
(CompletionContext coreContext) Returns whether it is safe to use the'<>'
(diamond) operator in place of explicitly specifying type arguments for this proposal.protected char[][]
findConstructorParameterNames
(char[] declaringTypePackageName, char[] declaringTypeName, char[] selector, char[][] paramTypeNames) protected char[][]
findMethodParameterNames
(char[] declaringTypePackageName, char[] declaringTypeName, char[] selector, char[][] paramTypeNames) char[][]
findParameterNames
(org.eclipse.core.runtime.IProgressMonitor monitor) Finds the method parameter names.int
Returns the accessibility of the proposal.int
Returns the completion flags relevant in the context, orCompletionFlags.Default
if none.int
Returns the dimension count if this proposal holds a array completion.Returns a binding of the method or field corresponding to this proposal ornull
if none.char[]
Returns the proposed sequence of characters to insert into the source file buffer, replacing the characters at the specified source range.int
Returns the character index in the source file buffer where source completion was requested (theoffset
parameter toICodeAssist.codeComplete
minus one).char[]
Returns the key of the relevant declaration in the context, ornull
if none.protected char[]
char[]
Returns the type signature or package name or module name (9) of the relevant declaration in the context, ornull
if none.protected char[]
char[][]
Returns the type variables of the declaring type corresponding to this proposal.int
getFlags()
Returns the modifier flags relevant in the context, orFlags.AccDefault
if none.char[]
getKey()
Returns the key relevant in the context, ornull
if none.int
getKind()
Returns the kind of completion being proposed.protected char[]
char[]
getName()
Returns the simple name of the method, field, member, or variable relevant in the context, ornull
if none.protected char[]
protected char[][]
protected char[][]
int
Returns the character index of the end (exclusive) of the subrange in the source file buffer containing the relevant receiver of the member being completed.char[]
Returns the type signature or package name of the relevant receiver in the context, ornull
if none.int
Returns the character index of the start of the subrange in the source file buffer containing the relevant receiver of the member being completed.int
Returns the relative relevance rating of this proposal.int
Returns the character index of the end of the subrange in the source file buffer to be replaced by the completion string.int
Returns the character index of the start of the subrange in the source file buffer to be replaced by the completion string.Returns the required completion proposals.char[]
Returns the signature of the method or type relevant in the context, ornull
if none.int
Returns the character index of the end (exclusive) of the subrange in the source file buffer containing the relevant token.int
Returns the character index of the start of the subrange in the source file buffer containing the relevant token being completed.protected char[]
boolean
Returns whether the completion proposal is a context-compatible proposal.boolean
Returns whether this proposal is a constructor.protected void
setAccessibility
(int kind) void
setAdditionalFlags
(int additionalFlags) Sets the completion flags relevant in the context.void
setArrayDimensions
(int dimensions) void
setBinding
(Binding binding) void
setCompatibleProposal
(boolean isCompatibleProposal) void
setCompletion
(char[] completion) Sets the proposed sequence of characters to insert into the source file buffer, replacing the characters at the specified source range.void
setDeclarationKey
(char[] key) Sets the type or package key of the relevant declaration in the context, ornull
if none.protected void
setDeclarationPackageName
(char[] declarationPackageName) void
setDeclarationSignature
(char[] signature) Sets the type or package signature or module name (9) of the relevant declaration in the context, ornull
if none.protected void
setDeclarationTypeName
(char[] declarationTypeName) void
setDeclarationTypeVariables
(char[][] declarationTypeVariables) void
setFlags
(int flags) Sets the modifier flags relevant in the context.void
setHasNoParameterNamesFromIndex
(boolean hasNoParameterNamesFromIndex) protected void
setIsContructor
(boolean isConstructor) void
setKey
(char[] key) Sets the key of the method, field type, member type, relevant in the context, ornull
if none.protected void
setModuleName
(char[] moduleName) void
setName
(char[] name) Sets the simple name of the method (type simple name for constructor), field, member, or variable relevant in the context, ornull
if none.void
setOriginalSignature
(char[] originalSignature) protected void
setPackageName
(char[] packageName) void
setParameterNames
(char[][] parameterNames) Sets the method parameter names.protected void
setParameterPackageNames
(char[][] parameterPackageNames) protected void
setParameterTypeNames
(char[][] parameterTypeNames) void
setReceiverRange
(int startIndex, int endIndex) Sets the character indices of the subrange in the source file buffer containing the relevant receiver of the member being completed.void
setReceiverSignature
(char[] signature) Sets the type or package signature of the relevant receiver in the context, ornull
if none.void
setRelevance
(int rating) Sets the relative relevance rating of this proposal.void
setReplaceRange
(int startIndex, int endIndex) Sets the character indices of the subrange in the source file buffer to be replaced by the completion string.void
setRequiredProposals
(CompletionProposal[] proposals) Sets the list of required completion proposals, ornull
if none.void
setSignature
(char[] signature) Sets the signature of the method, field type, member type, relevant in the context, ornull
if none.void
setTokenRange
(int startIndex, int endIndex) Sets the character indices of the subrange in the source file buffer containing the relevant token being completed.protected void
setTypeName
(char[] typeName) toString()
Methods inherited from class org.aspectj.org.eclipse.jdt.core.CompletionProposal
create
-
Field Details
-
completionEngine
-
nameLookup
-
declarationPackageName
protected char[] declarationPackageName -
declarationTypeName
protected char[] declarationTypeName -
moduleName
protected char[] moduleName -
packageName
protected char[] packageName -
typeName
protected char[] typeName -
parameterPackageNames
protected char[][] parameterPackageNames -
parameterTypeNames
protected char[][] parameterTypeNames -
originalSignature
protected char[] originalSignature -
accessibility
protected int accessibility -
isConstructor
protected boolean isConstructor
-
-
Constructor Details
-
InternalCompletionProposal
public InternalCompletionProposal(int kind, int completionLocation) Creates a basic completion proposal. All instance field have plausible default values unless otherwise noted.Note that the constructors for this class are internal to the Java model implementation. Clients cannot directly create CompletionProposal objects.
- Parameters:
kind
- one of the kind constants declared on this classcompletionLocation
- original offset of code completion request
-
-
Method Details
-
findConstructorParameterNames
protected char[][] findConstructorParameterNames(char[] declaringTypePackageName, char[] declaringTypeName, char[] selector, char[][] paramTypeNames) -
findMethodParameterNames
protected char[][] findMethodParameterNames(char[] declaringTypePackageName, char[] declaringTypeName, char[] selector, char[][] paramTypeNames) -
getDeclarationPackageName
protected char[] getDeclarationPackageName() -
getDeclarationTypeName
protected char[] getDeclarationTypeName() -
getModuleName
protected char[] getModuleName() -
getPackageName
protected char[] getPackageName() -
getTypeName
protected char[] getTypeName() -
getParameterPackageNames
protected char[][] getParameterPackageNames() -
getParameterTypeNames
protected char[][] getParameterTypeNames() -
setDeclarationPackageName
protected void setDeclarationPackageName(char[] declarationPackageName) -
setDeclarationTypeName
protected void setDeclarationTypeName(char[] declarationTypeName) -
setModuleName
protected void setModuleName(char[] moduleName) -
setPackageName
protected void setPackageName(char[] packageName) -
setTypeName
protected void setTypeName(char[] typeName) -
setParameterPackageNames
protected void setParameterPackageNames(char[][] parameterPackageNames) -
setParameterTypeNames
protected void setParameterTypeNames(char[][] parameterTypeNames) -
setAccessibility
protected void setAccessibility(int kind) -
setIsContructor
protected void setIsContructor(boolean isConstructor) -
setOriginalSignature
public void setOriginalSignature(char[] originalSignature) -
getAdditionalFlags
public int getAdditionalFlags()Description copied from class:CompletionProposal
Returns the completion flags relevant in the context, orCompletionFlags.Default
if none.This field is available for the following kinds of completion proposals:
FIELD_IMPORT
- completion flags of the attribute that is referenced. Completion flags for this proposal kind can only includeCompletionFlags.StaticImport
METHOD_IMPORT
- completion flags of the attribute that is referenced. Completion flags for this proposal kind can only includeCompletionFlags.StaticImport
TYPE_IMPORT
- completion flags of the attribute that is referenced. Completion flags for this proposal kind can only includeCompletionFlags.StaticImport
CompletionFlags.Default
.- Overrides:
getAdditionalFlags
in classCompletionProposal
- Returns:
- the completion flags, or
CompletionFlags.Default
if none - See Also:
-
setAdditionalFlags
public void setAdditionalFlags(int additionalFlags) Description copied from class:CompletionProposal
Sets the completion flags relevant in the context.If not set, defaults to none.
The completion engine creates instances of this class and sets its properties; this method is not intended to be used by other clients.
- Overrides:
setAdditionalFlags
in classCompletionProposal
- Parameters:
additionalFlags
- the completion flags, orCompletionFlags.Default
if none
-
getKind
public int getKind()Description copied from class:CompletionProposal
Returns the kind of completion being proposed.The set of different kinds of completion proposals is expected to change over time. It is strongly recommended that clients do not assume that the kind is one of the ones they know about, and code defensively for the possibility of unexpected future growth.
- Overrides:
getKind
in classCompletionProposal
- Returns:
- the kind; one of the kind constants declared on this class, or possibly a kind unknown to the caller
-
getCompletionLocation
public int getCompletionLocation()Description copied from class:CompletionProposal
Returns the character index in the source file buffer where source completion was requested (theoffset
parameter toICodeAssist.codeComplete
minus one).- Overrides:
getCompletionLocation
in classCompletionProposal
- Returns:
- character index in source file buffer
- See Also:
-
getTokenStart
public int getTokenStart()Description copied from class:CompletionProposal
Returns the character index of the start of the subrange in the source file buffer containing the relevant token being completed. This token is either the identifier or Java language keyword under, or immediately preceding, the original request offset. If the original request offset is not within or immediately after an identifier or keyword, then the position returned is original request offset and the token range is empty.- Overrides:
getTokenStart
in classCompletionProposal
- Returns:
- character index of token start position (inclusive)
-
getTokenEnd
public int getTokenEnd()Description copied from class:CompletionProposal
Returns the character index of the end (exclusive) of the subrange in the source file buffer containing the relevant token. When there is no relevant token, the range is empty (getEndToken() == getStartToken()
).- Overrides:
getTokenEnd
in classCompletionProposal
- Returns:
- character index of token end position (exclusive)
-
setTokenRange
public void setTokenRange(int startIndex, int endIndex) Description copied from class:CompletionProposal
Sets the character indices of the subrange in the source file buffer containing the relevant token being completed. This token is either the identifier or Java language keyword under, or immediately preceding, the original request offset. If the original request offset is not within or immediately after an identifier or keyword, then the source range begins at original request offset and is empty.If not set, defaults to empty subrange at [0,0).
- Overrides:
setTokenRange
in classCompletionProposal
- Parameters:
startIndex
- character index of token start position (inclusive)endIndex
- character index of token end position (exclusive)
-
getCompletion
public char[] getCompletion()Description copied from class:CompletionProposal
Returns the proposed sequence of characters to insert into the source file buffer, replacing the characters at the specified source range. The string can be arbitrary; for example, it might include not only the name of a method but a set of parentheses.The client must not modify the array returned.
- Overrides:
getCompletion
in classCompletionProposal
- Returns:
- the completion string
-
setCompletion
public void setCompletion(char[] completion) Description copied from class:CompletionProposal
Sets the proposed sequence of characters to insert into the source file buffer, replacing the characters at the specified source range. The string can be arbitrary; for example, it might include not only the name of a method but a set of parentheses.If not set, defaults to an empty character array.
The completion engine creates instances of this class and sets its properties; this method is not intended to be used by other clients.
- Overrides:
setCompletion
in classCompletionProposal
- Parameters:
completion
- the completion string
-
getReplaceStart
public int getReplaceStart()Description copied from class:CompletionProposal
Returns the character index of the start of the subrange in the source file buffer to be replaced by the completion string. If the subrange is empty (getReplaceEnd() == getReplaceStart()
), the completion string is to be inserted at this index.Note that while the token subrange is precisely specified, the replacement range is loosely constrained and may not bear any direct relation to the original request offset. For example, it would be possible for a type completion to propose inserting an import declaration at the top of the compilation unit; or the completion might include trailing parentheses and punctuation for a method completion.
- Overrides:
getReplaceStart
in classCompletionProposal
- Returns:
- replacement start position (inclusive)
-
getReplaceEnd
public int getReplaceEnd()Description copied from class:CompletionProposal
Returns the character index of the end of the subrange in the source file buffer to be replaced by the completion string. If the subrange is empty (getReplaceEnd() == getReplaceStart()
), the completion string is to be inserted at this index.- Overrides:
getReplaceEnd
in classCompletionProposal
- Returns:
- replacement end position (exclusive)
-
setReplaceRange
public void setReplaceRange(int startIndex, int endIndex) Description copied from class:CompletionProposal
Sets the character indices of the subrange in the source file buffer to be replaced by the completion string. If the subrange is empty (startIndex == endIndex
), the completion string is to be inserted at this index.If not set, defaults to empty subrange at [0,0).
The completion engine creates instances of this class and sets its properties; this method is not intended to be used by other clients.
- Overrides:
setReplaceRange
in classCompletionProposal
- Parameters:
startIndex
- character index of replacement start position (inclusive)endIndex
- character index of replacement end position (exclusive)
-
getRelevance
public int getRelevance()Description copied from class:CompletionProposal
Returns the relative relevance rating of this proposal.- Overrides:
getRelevance
in classCompletionProposal
- Returns:
- relevance rating of this proposal; ratings are positive; higher means better
-
setRelevance
public void setRelevance(int rating) Description copied from class:CompletionProposal
Sets the relative relevance rating of this proposal.If not set, defaults to the lowest possible rating (1).
The completion engine creates instances of this class and sets its properties; this method is not intended to be used by other clients.
- Overrides:
setRelevance
in classCompletionProposal
- Parameters:
rating
- relevance rating of this proposal; ratings are positive; higher means better
-
getDeclarationSignature
public char[] getDeclarationSignature()Description copied from class:CompletionProposal
Returns the type signature or package name or module name (9) of the relevant declaration in the context, ornull
if none.This field is available for the following kinds of completion proposals:
ANNOTATION_ATTRIBUT_REF
- type signature of the annotation that declares the attribute that is referencedANONYMOUS_CLASS_DECLARATION
- type signature of the type that is being subclassed or implementedFIELD_IMPORT
- type signature of the type that declares the field that is importedFIELD_REF
- type signature of the type that declares the field that is referencedFIELD_REF_WITH_CASTED_RECEIVER
- type signature of the type that declares the field that is referencedMETHOD_IMPORT
- type signature of the type that declares the method that is importedMETHOD_REF
- type signature of the type that declares the method that is referencedMETHOD_REF_WITH_CASTED_RECEIVER
- type signature of the type that declares the method that is referencedMETHOD_DECLARATION
- type signature of the type that declares the method that is being implemented or overriddenMODULE_DECLARATION
- possible name of the module that is being declaredMODULE_REF
- name of the module that is referencedPACKAGE_REF
- dot-based package name of the package that is referencedTYPE_IMPORT
- dot-based package name of the package containing the type that is importedTYPE_REF
- dot-based package name of the package containing the type that is referencedPOTENTIAL_METHOD_DECLARATION
- type signature of the type that declares the method that is being created
null
. Clients must not modify the array returned.- Overrides:
getDeclarationSignature
in classCompletionProposal
- Returns:
- a type signature or a package name or module name (9) (depending
on the kind of completion), or
null
if none - See Also:
-
getDeclarationKey
public char[] getDeclarationKey()Description copied from class:CompletionProposal
Returns the key of the relevant declaration in the context, ornull
if none.This field is available for the following kinds of completion proposals:
ANONYMOUS_CLASS_DECLARATION
- key of the type that is being subclassed or implementedMETHOD_DECLARATION
- key of the type that declares the method that is being implemented or overridden
null
. Clients must not modify the array returned.- Overrides:
getDeclarationKey
in classCompletionProposal
- Returns:
- a key, or
null
if none - See Also:
-
setDeclarationSignature
public void setDeclarationSignature(char[] signature) Description copied from class:CompletionProposal
Sets the type or package signature or module name (9) of the relevant declaration in the context, ornull
if none.If not set, defaults to none.
The completion engine creates instances of this class and sets its properties; this method is not intended to be used by other clients.
- Overrides:
setDeclarationSignature
in classCompletionProposal
- Parameters:
signature
- the type or package signature or module name(9) , ornull
if none
-
setDeclarationKey
public void setDeclarationKey(char[] key) Description copied from class:CompletionProposal
Sets the type or package key of the relevant declaration in the context, ornull
if none.If not set, defaults to none.
The completion engine creates instances of this class and sets its properties; this method is not intended to be used by other clients.
- Overrides:
setDeclarationKey
in classCompletionProposal
- Parameters:
key
- the type or package key, ornull
if none
-
getName
public char[] getName()Description copied from class:CompletionProposal
Returns the simple name of the method, field, member, or variable relevant in the context, ornull
if none.This field is available for the following kinds of completion proposals:
ANNOTATION_ATTRIBUT_REF
- the name of the attributeFIELD_IMPORT
- the name of the fieldFIELD_REF
- the name of the fieldFIELD_REF_WITH_CASTED_RECEIVER
- the name of the fieldKEYWORD
- the keywordLABEL_REF
- the name of the labelLOCAL_VARIABLE_REF
- the name of the local variableMETHOD_IMPORT
- the name of the methodMETHOD_REF
- the name of the method (the type simple name for constructor)METHOD_REF_WITH_CASTED_RECEIVER
- the name of the methodMETHOD_DECLARATION
- the name of the method (the type simple name for constructor)VARIABLE_DECLARATION
- the name of the variablePOTENTIAL_METHOD_DECLARATION
- the name of the method
null
. Clients must not modify the array returned.- Overrides:
getName
in classCompletionProposal
- Returns:
- the keyword, field, method, local variable, or member
name, or
null
if none
-
setName
public void setName(char[] name) Description copied from class:CompletionProposal
Sets the simple name of the method (type simple name for constructor), field, member, or variable relevant in the context, ornull
if none.If not set, defaults to none.
The completion engine creates instances of this class and sets its properties; this method is not intended to be used by other clients.
- Overrides:
setName
in classCompletionProposal
- Parameters:
name
- the keyword, field, method, local variable, or member name, ornull
if none
-
getBinding
Returns a binding of the method or field corresponding to this proposal ornull
if none.The binding may be available for the following kinds of completion proposals:
ANONYMOUS_CLASS_CONSTRUCTOR_INVOCATION
-MethodBinding
of the constructor being proposedCONSTRUCTOR_INVOCATION
-MethodBinding
of the constructor being proposedFIELD_REF
-FieldBinding
of the field being proposedFIELD_REF_WITH_CASTED_RECEIVER
-FieldBinding
of the field being proposedJAVADOC_FIELD_REF
-FieldBinding
of the field being proposedJAVADOC_METHOD_REF
-MethodBinding
of the method or constructor being proposedMETHOD_DECLARATION
-MethodBinding
of the method or constructor being proposedMETHOD_NAME_REFERENCE
-MethodBinding
of the method or constructor being proposedMETHOD_REF
-MethodBinding
of the method or constructor being proposedMETHOD_REF_WITH_CASTED_RECEIVER
-MethodBinding
of the method or constructor being proposed
null
.- Returns:
- the binding corresponding to this proposal (if available), or
null
if none
-
setBinding
-
getSignature
public char[] getSignature()Description copied from class:CompletionProposal
Returns the signature of the method or type relevant in the context, ornull
if none.This field is available for the following kinds of completion proposals:
ANNOTATION_ATTRIBUT_REF
- the type signature of the referenced attribute's typeANONYMOUS_CLASS_DECLARATION
- method signature of the constructor that is being invokedFIELD_IMPORT
- the type signature of the referenced field's typeFIELD_REF
- the type signature of the referenced field's typeFIELD_REF_WITH_CASTED_RECEIVER
- the type signature of the referenced field's typeLOCAL_VARIABLE_REF
- the type signature of the referenced local variable's typeMETHOD_IMPORT
- method signature of the method that is importedMETHOD_REF
- method signature of the method that is referencedMETHOD_REF_WITH_CASTED_RECEIVER
- method signature of the method that is referencedMETHOD_DECLARATION
- method signature of the method that is being implemented or overriddenTYPE_IMPORT
- type signature of the type that is importedTYPE_REF
- type signature of the type that is referencedVARIABLE_DECLARATION
- the type signature of the type of the variable being declaredPOTENTIAL_METHOD_DECLARATION
- method signature of the method that is being created
null
. Clients must not modify the array returned.- Overrides:
getSignature
in classCompletionProposal
- Returns:
- the signature, or
null
if none - See Also:
-
getKey
public char[] getKey()Description copied from class:CompletionProposal
Returns the key relevant in the context, ornull
if none.This field is available for the following kinds of completion proposals:
ANONYMOUS_CLASS_DECLARATION
- method key of the constructor that is being invoked, ornull
if the declaring type is an interfaceMETHOD_DECLARATION
- method key of the method that is being implemented or overridden
null
. Clients must not modify the array returned.- Overrides:
getKey
in classCompletionProposal
- Returns:
- the key, or
null
if none - See Also:
-
setSignature
public void setSignature(char[] signature) Description copied from class:CompletionProposal
Sets the signature of the method, field type, member type, relevant in the context, ornull
if none.If not set, defaults to none.
The completion engine creates instances of this class and sets its properties; this method is not intended to be used by other clients.
- Overrides:
setSignature
in classCompletionProposal
- Parameters:
signature
- the signature, ornull
if none
-
setKey
public void setKey(char[] key) Description copied from class:CompletionProposal
Sets the key of the method, field type, member type, relevant in the context, ornull
if none.If not set, defaults to none.
The completion engine creates instances of this class and sets its properties; this method is not intended to be used by other clients.
- Overrides:
setKey
in classCompletionProposal
- Parameters:
key
- the key, ornull
if none
-
getFlags
public int getFlags()Description copied from class:CompletionProposal
Returns the modifier flags relevant in the context, orFlags.AccDefault
if none.This field is available for the following kinds of completion proposals:
ANNOTATION_ATTRIBUT_REF
- modifier flags of the attribute that is referenced;ANONYMOUS_CLASS_DECLARATION
- modifier flags of the constructor that is referencedFIELD_IMPORT
- modifier flags of the field that is imported.FIELD_REF
- modifier flags of the field that is referenced;Flags.AccEnum
can be used to recognize references to enum constantsFIELD_REF_WITH_CASTED_RECEIVER
- modifier flags of the field that is referenced.KEYWORD
- modifier flag corresponding to the modifier keywordLOCAL_VARIABLE_REF
- modifier flags of the local variable that is referencedMETHOD_IMPORT
- modifier flags of the method that is imported;METHOD_REF
- modifier flags of the method that is referenced;Flags.AccAnnotation
can be used to recognize references to annotation type membersMETHOD_REF_WITH_CASTED_RECEIVER
- modifier flags of the method that is referenced.METHOD_DECLARATION
- modifier flags for the method that is being implemented or overriddenTYPE_IMPORT
- modifier flags of the type that is imported;Flags.AccInterface
can be used to recognize references to interfaces,Flags.AccEnum
enum types, andFlags.AccAnnotation
annotation typesTYPE_REF
- modifier flags of the type that is referenced;Flags.AccInterface
can be used to recognize references to interfaces,Flags.AccEnum
enum types, andFlags.AccAnnotation
annotation typesVARIABLE_DECLARATION
- modifier flags for the variable being declaredPOTENTIAL_METHOD_DECLARATION
- modifier flags for the method that is being created
Flags.AccDefault
.- Overrides:
getFlags
in classCompletionProposal
- Returns:
- the modifier flags, or
Flags.AccDefault
if none - See Also:
-
setFlags
public void setFlags(int flags) Description copied from class:CompletionProposal
Sets the modifier flags relevant in the context.If not set, defaults to none.
The completion engine creates instances of this class and sets its properties; this method is not intended to be used by other clients.
- Overrides:
setFlags
in classCompletionProposal
- Parameters:
flags
- the modifier flags, orFlags.AccDefault
if none
-
setHasNoParameterNamesFromIndex
public void setHasNoParameterNamesFromIndex(boolean hasNoParameterNamesFromIndex) -
getRequiredProposals
Description copied from class:CompletionProposal
Returns the required completion proposals. The proposal can be apply only if these required completion proposals are also applied. If the required proposal aren't applied the completion could create completion problems.This field is available for the following kinds of completion proposals:
FIELD_REF
- The allowed required proposals for this kind are:TYPE_REF
TYPE_IMPORT
FIELD_IMPORT
METHOD_REF
- The allowed required proposals for this kind are:TYPE_REF
TYPE_IMPORT
METHOD_IMPORT
TYPE_REF
- The allowed required proposals for this kind are:TYPE_REF
CONSTRUCTOR_INVOCATION
- The allowed required proposals for this kind are:TYPE_REF
ANONYMOUS_CLASS_CONSTRUCTOR_INVOCATION
- The allowed required proposals for this kind are:TYPE_REF
ANONYMOUS_CLASS_DECLARATION
- The allowed required proposals for this kind are:TYPE_REF
Other kinds of required proposals will be returned in the future, therefore clients of this API must allow with
CompletionRequestor.setAllowsRequiredProposals(int, int, boolean)
only kinds which are in this list to avoid unexpected results in the future.A required proposal of a given kind is proposed even if
CompletionRequestor.isIgnored(int)
returntrue
for that kind.A required completion proposal cannot have required completion proposals.
- Overrides:
getRequiredProposals
in classCompletionProposal
- Returns:
- the required completion proposals, or
null
if none. - See Also:
-
setRequiredProposals
Description copied from class:CompletionProposal
Sets the list of required completion proposals, ornull
if none.If not set, defaults to none.
The completion engine creates instances of this class and sets its properties; this method is not intended to be used by other clients.
- Overrides:
setRequiredProposals
in classCompletionProposal
- Parameters:
proposals
- the list of required completion proposals, ornull
if none
-
findParameterNames
public char[][] findParameterNames(org.eclipse.core.runtime.IProgressMonitor monitor) Description copied from class:CompletionProposal
Finds the method parameter names. This information is relevant to method reference (and method declaration proposals). Returnsnull
if not available or not relevant.The client must not modify the array returned.
Note that this is an expensive thing to compute, which may require parsing Java source files, etc. Use sparingly.
- Overrides:
findParameterNames
in classCompletionProposal
- Parameters:
monitor
- the progress monitor, ornull
if none- Returns:
- the parameter names, or
null
if none or not available or not relevant
-
setParameterNames
public void setParameterNames(char[][] parameterNames) Description copied from class:CompletionProposal
Sets the method parameter names. This information is relevant to method reference (and method declaration proposals).The completion engine creates instances of this class and sets its properties; this method is not intended to be used by other clients.
- Overrides:
setParameterNames
in classCompletionProposal
- Parameters:
parameterNames
- the parameter names, ornull
if none
-
getAccessibility
public int getAccessibility()Description copied from class:CompletionProposal
Returns the accessibility of the proposal.This field is available for the following kinds of completion proposals:
TYPE_REF
- accessibility of the type
IAccessRule.K_ACCESSIBLE
orIAccessRule.K_DISCOURAGED
orIAccessRule.K_NON_ACCESSIBLE
. By default this method returnIAccessRule.K_ACCESSIBLE
.- Overrides:
getAccessibility
in classCompletionProposal
- Returns:
- the accessibility of the proposal
- See Also:
-
isConstructor
public boolean isConstructor()Description copied from class:CompletionProposal
Returns whether this proposal is a constructor.This field is available for the following kinds of completion proposals:
METHOD_REF
- returntrue
if the referenced method is a constructorMETHOD_DECLARATION
- returntrue
if the declared method is a constructor
false
.- Overrides:
isConstructor
in classCompletionProposal
- Returns:
true
if the proposal is a constructor.
-
getReceiverSignature
public char[] getReceiverSignature()Description copied from class:CompletionProposal
Returns the type signature or package name of the relevant receiver in the context, ornull
if none.This field is available for the following kinds of completion proposals:
FIELD_REF_WITH_CASTED_RECEIVER
- type signature of the type that cast the receiver of the field that is referencedMETHOD_REF_WITH_CASTED_RECEIVER
- type signature of the type that cast the receiver of the method that is referenced
null
. Clients must not modify the array returned.- Overrides:
getReceiverSignature
in classCompletionProposal
- Returns:
- a type signature or a package name (depending
on the kind of completion), or
null
if none - See Also:
-
getReceiverStart
public int getReceiverStart()Description copied from class:CompletionProposal
Returns the character index of the start of the subrange in the source file buffer containing the relevant receiver of the member being completed. This receiver is an expression.This field is available for the following kinds of completion proposals:
FIELD_REF_WITH_CASTED_RECEIVER
METHOD_REF_WITH_CASTED_RECEIVER
0
.- Overrides:
getReceiverStart
in classCompletionProposal
- Returns:
- character index of receiver start position (inclusive)
-
getReceiverEnd
public int getReceiverEnd()Description copied from class:CompletionProposal
Returns the character index of the end (exclusive) of the subrange in the source file buffer containing the relevant receiver of the member being completed. *This field is available for the following kinds of completion proposals:
FIELD_REF_WITH_CASTED_RECEIVER
METHOD_REF_WITH_CASTED_RECEIVER
0
.- Overrides:
getReceiverEnd
in classCompletionProposal
- Returns:
- character index of receiver end position (exclusive)
-
setReceiverSignature
public void setReceiverSignature(char[] signature) Description copied from class:CompletionProposal
Sets the type or package signature of the relevant receiver in the context, ornull
if none.If not set, defaults to none.
The completion engine creates instances of this class and sets its properties; this method is not intended to be used by other clients.
- Overrides:
setReceiverSignature
in classCompletionProposal
- Parameters:
signature
- the type or package signature, ornull
if none
-
setReceiverRange
public void setReceiverRange(int startIndex, int endIndex) Description copied from class:CompletionProposal
Sets the character indices of the subrange in the source file buffer containing the relevant receiver of the member being completed.If not set, defaults to empty subrange at [0,0).
- Overrides:
setReceiverRange
in classCompletionProposal
- Parameters:
startIndex
- character index of receiver start position (inclusive)endIndex
- character index of receiver end position (exclusive)
-
toString
-
canUseDiamond
Description copied from class:CompletionProposal
Returns whether it is safe to use the'<>'
(diamond) operator in place of explicitly specifying type arguments for this proposal.This is only relevant for source level 1.7 or greater.
- Overrides:
canUseDiamond
in classCompletionProposal
- Parameters:
coreContext
- the completion context associated with the proposal- Returns:
true
if it is safe to use the diamond operator for the constructor invocation,false
otherwise. Also returnsfalse
for source levels below 1.7
-
getArrayDimensions
public int getArrayDimensions()Description copied from class:CompletionProposal
Returns the dimension count if this proposal holds a array completion.This field is available for the following kinds of completion proposals:
TYPE_REF
- return dimension count if the referenced type is an array, otherwise0
.
0
.- Overrides:
getArrayDimensions
in classCompletionProposal
- Returns:
- dimension count or
0
for non arrayTYPE_REF
proposals.
-
setArrayDimensions
public void setArrayDimensions(int dimensions) -
getDeclarationTypeVariables
public char[][] getDeclarationTypeVariables()Returns the type variables of the declaring type corresponding to this proposal. If not set, defaults to null.- Returns:
- the type variable names
-
setDeclarationTypeVariables
public void setDeclarationTypeVariables(char[][] declarationTypeVariables) -
isCompatibleProposal
public boolean isCompatibleProposal()Returns whether the completion proposal is a context-compatible proposal. -
setCompatibleProposal
public void setCompatibleProposal(boolean isCompatibleProposal)
-