Eclipse JDT
Release 3.3

org.eclipse.jdt.core
Class CompletionContext

java.lang.Object
  extended byorg.eclipse.jdt.internal.codeassist.InternalCompletionContext
      extended byorg.eclipse.jdt.core.CompletionContext

public final class CompletionContext
extends org.eclipse.jdt.internal.codeassist.InternalCompletionContext

Completion context. Represent the context in which the completion occurs.

This class is not intended to be instantiated or subclassed by clients.

Since:
3.1
See Also:
CompletionRequestor.acceptContext(CompletionContext)

Field Summary
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.
 
Fields inherited from class org.eclipse.jdt.internal.codeassist.InternalCompletionContext
expectedTypesKeys, expectedTypesSignatures, javadoc, offset, token, tokenEnd, tokenKind, tokenStart
 
Constructor Summary
CompletionContext()
           
 
Method Summary
 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 getTokenStart()
          Returns the character index of the start of the subrange in the source file buffer containing the relevant token being completed.
 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.
 String toString()
           
 
Methods inherited from class org.eclipse.jdt.internal.codeassist.InternalCompletionContext
setExpectedTypesKeys, setExpectedTypesSignatures, setJavadoc, setOffset, setToken, setTokenKind, setTokenRange, setTokenRange
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TOKEN_KIND_UNKNOWN

public static final int TOKEN_KIND_UNKNOWN
The completion token is unknown.

Since:
3.2
See Also:
Constant Field Values

TOKEN_KIND_NAME

public static final int TOKEN_KIND_NAME
The completion token is a name.

Since:
3.2
See Also:
Constant Field Values

TOKEN_KIND_STRING_LITERAL

public static final int TOKEN_KIND_STRING_LITERAL
The completion token is a string literal. The string literal ends quote can be not present the source. "foo" or "foo.

Since:
3.2
See Also:
Constant Field Values
Constructor Detail

CompletionContext

public CompletionContext()
Method Detail

isInJavadoc

public boolean isInJavadoc()
Tell user whether completion takes place in a javadoc comment or not.

Returns:
boolean true if completion takes place in a javadoc comment, false otherwise.
Since:
3.2

isInJavadocText

public boolean isInJavadocText()
Tell user whether completion takes place in text area of a javadoc comment or not.

Returns:
boolean true if completion takes place in a text area of a javadoc comment, false otherwise.
Since:
3.2

isInJavadocFormalReference

public boolean isInJavadocFormalReference()
Tell user whether completion takes place in a formal reference of a javadoc tag or not. Tags with formal reference are:

Returns:
boolean true if completion takes place in formal reference of a javadoc tag, false otherwise.
Since:
3.2

getExpectedTypesSignatures

public char[][] getExpectedTypesSignatures()
Return signatures of expected types of a potential completion proposal at the completion position. It's not mandatory to a completion proposal to respect this expectation.

Returns:
signatures expected types of a potential completion proposal at the completion position or null if there is no expected types.
See Also:
Signature

getExpectedTypesKeys

public char[][] getExpectedTypesKeys()
Return keys of expected types of a potential completion proposal at the completion position. It's not mandatory to a completion proposal to respect this expectation.

Returns:
keys of expected types of a potential completion proposal at the completion position or null if there is no expected types.
See Also:
ASTParser.createASTs(ICompilationUnit[], String[], org.eclipse.jdt.core.dom.ASTRequestor, org.eclipse.core.runtime.IProgressMonitor)

getToken

public char[] getToken()
Returns the completed token. This token is either the identifier or Java language keyword or the string literal under, immediately preceding, the original request offset. If the original request offset is not within or immediately after an identifier or keyword or a string literal then the returned value is null.

Returns:
completed token or null
Since:
3.2

getTokenKind

public int getTokenKind()
Returns the kind of completion token being proposed.

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.

Returns:
the kind; one of the kind constants declared on this class whose name starts with TOKEN_KIND, or possibly a kind unknown to the caller
Since:
3.2

getTokenStart

public int getTokenStart()
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.

Returns:
character index of token start position (inclusive)
Since:
3.2

getTokenEnd

public int getTokenEnd()
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 (getTokenEnd() == getTokenStart() - 1).

Returns:
character index of token end position (exclusive)
Since:
3.2

getOffset

public int getOffset()
Returns the offset position in the source file buffer after which code assist is requested.

Returns:
offset position in the source file buffer
Since:
3.2

toString

public String toString()

Eclipse JDT
Release 3.3

Copyright (c) IBM Corp. and others 2000, 2007. All Rights Reserved.