public class CompletionContext extends Object
CompletionRequestor.acceptContext(CompletionContext)
Modifier and Type | Field and Description |
---|---|
static int |
TL_CONSTRUCTOR_START
The completed token is the first token of a constructor
invocation expression.
|
static int |
TL_MEMBER_START
The completed token is the first token of a member declaration.
|
static int |
TL_STATEMENT_START
The completed token is the first token of a statement.
|
static int |
TOKEN_KIND_NAME
The completion token is a name.
|
static int |
TOKEN_KIND_STRING_LITERAL
The completion token is a string literal.
|
static int |
TOKEN_KIND_UNKNOWN
The completion token is unknown.
|
Constructor and Description |
---|
CompletionContext() |
Modifier and Type | Method and Description |
---|---|
IJavaElement |
getEnclosingElement()
Returns the innermost enclosing Java element which contains the completion location or
null if this element cannot be computed. |
char[][] |
getExpectedTypesKeys()
Return keys of expected types of a potential completion proposal at the completion position.
|
char[][] |
getExpectedTypesSignatures()
Return signatures of expected types of a potential completion proposal at the completion position.
|
int |
getOffset()
Returns the offset position in the source file buffer
after which code assist is requested.
|
char[] |
getToken()
Returns the completed token.
|
int |
getTokenEnd()
Returns the character index of the end (exclusive) of the subrange
in the source file buffer containing the
relevant token.
|
int |
getTokenKind()
Returns the kind of completion token being proposed.
|
int |
getTokenLocation()
Returns the location of completion token being proposed.
|
int |
getTokenStart()
Returns the character index of the start of the
subrange in the source file buffer containing the
relevant token being completed.
|
IJavaElement[] |
getVisibleElements(String typeSignature)
Return the elements which are visible from the completion location and which can be assigned to the given type.
|
boolean |
isExtended()
Returns whether this completion context is an extended context.
|
boolean |
isInJavadoc()
Tell user whether completion takes place in a javadoc comment or not.
|
boolean |
isInJavadocFormalReference()
Tell user whether completion takes place in a formal reference of a javadoc tag or not.
|
boolean |
isInJavadocText()
Tell user whether completion takes place in text area of a javadoc comment or not.
|
public static final int TL_MEMBER_START
public class X { Foo| // completion occurs at | }
getTokenLocation()
,
Constant Field Valuespublic static final int TL_STATEMENT_START
public class X { public void bar() { Foo| // completion occurs at | } }
getTokenLocation()
,
Constant Field Valuespublic static final int TL_CONSTRUCTOR_START
public class X { public void bar() { new Foo| // completion occurs at | } }
getTokenLocation()
,
Constant Field Valuespublic static final int TOKEN_KIND_UNKNOWN
public static final int TOKEN_KIND_NAME
public static final int TOKEN_KIND_STRING_LITERAL
"foo"
or "foo
.public boolean isInJavadoc()
public boolean isInJavadocText()
public boolean isInJavadocFormalReference()
public boolean isExtended()
true
if this completion context is an extended context.public char[][] getExpectedTypesSignatures()
null
if there is no expected types.Signature
public char[][] getExpectedTypesKeys()
null
if there is no expected types.ASTParser.createASTs(ICompilationUnit[], String[], org.eclipse.jdt.core.dom.ASTRequestor, org.eclipse.core.runtime.IProgressMonitor)
public char[] getToken()
null
.null
public int getTokenKind()
The set of different kinds of completion token 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.
TOKEN_KIND
,
or possibly a kind unknown to the callerpublic int getTokenLocation()
TL
,
or possibly values unknown to the caller.
The set of different location values is expected to change over time. It is strongly recommended that clients do not assume that the location contains only known value, and code defensively for the possibility of unexpected future growth.
public int getTokenStart()
public int getTokenEnd()
getTokenEnd() == getTokenStart() - 1
).public int getOffset()
public IJavaElement getEnclosingElement()
null
if this element cannot be computed.
The returned Java element and all Java elements in the same compilation unit which can be navigated to from the returned Java element are special Java elements:
IMember.getCategories()
will return an empty arraynull
include:
null
if this element cannot be computed.UnsupportedOperationException
- if the context is not an extended contextpublic IJavaElement[] getVisibleElements(String typeSignature)
ILocalVariable
- the element type is ILocalVariable.getTypeSignature()
IField
- the element type is IField.getTypeSignature()
IMethod
- the element type is IMethod.getReturnType()
IMember.getCategories()
will return an empty arraytypeSignature
- elements which can be assigned to this type are returned.
If null
there is no constraint on the type of the returned elements.UnsupportedOperationException
- if the context is not an extended contextisExtended()
Copyright (c) 2000, 2018 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.