org.aspectj.org.eclipse.jdt.internal.codeassist
Class InternalCompletionContext

java.lang.Object
  extended by org.aspectj.org.eclipse.jdt.core.CompletionContext
      extended by org.aspectj.org.eclipse.jdt.internal.codeassist.InternalCompletionContext

public class InternalCompletionContext
extends CompletionContext

Internal completion context

Since:
3.1

Field Summary
protected  char[][] expectedTypesKeys
           
protected  char[][] expectedTypesSignatures
           
protected  InternalExtendedCompletionContext extendedContext
           
protected  boolean isExtended
           
protected  int javadoc
           
protected  int offset
           
protected  char[] token
           
protected  int tokenEnd
           
protected  int tokenKind
           
protected  int tokenLocation
           
protected  int tokenStart
           
 
Fields inherited from class org.aspectj.org.eclipse.jdt.core.CompletionContext
TL_MEMBER_START, TL_STATEMENT_START, TOKEN_KIND_NAME, TOKEN_KIND_STRING_LITERAL, TOKEN_KIND_UNKNOWN
 
Constructor Summary
InternalCompletionContext()
           
 
Method Summary
 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(java.lang.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.
protected  void setExpectedTypesKeys(char[][] expectedTypesKeys)
           
protected  void setExpectedTypesSignatures(char[][] expectedTypesSignatures)
           
protected  void setExtended()
           
protected  void setExtendedData(ITypeRoot typeRoot, CompilationUnitDeclaration compilationUnitDeclaration, LookupEnvironment lookupEnvironment, Scope scope, ASTNode astNode, WorkingCopyOwner owner, CompletionParser parser)
           
protected  void setJavadoc(int javadoc)
           
protected  void setOffset(int offset)
           
protected  void setToken(char[] token)
           
protected  void setTokenKind(int tokenKind)
           
protected  void setTokenLocation(int tokenLocation)
           
protected  void setTokenRange(int start, int end)
           
protected  void setTokenRange(int start, int end, int endOfEmptyToken)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

expectedTypesSignatures

protected char[][] expectedTypesSignatures

expectedTypesKeys

protected char[][] expectedTypesKeys

javadoc

protected int javadoc

offset

protected int offset

tokenStart

protected int tokenStart

tokenEnd

protected int tokenEnd

token

protected char[] token

tokenKind

protected int tokenKind

tokenLocation

protected int tokenLocation

isExtended

protected boolean isExtended

extendedContext

protected InternalExtendedCompletionContext extendedContext
Constructor Detail

InternalCompletionContext

public InternalCompletionContext()
Method Detail

setExpectedTypesKeys

protected void setExpectedTypesKeys(char[][] expectedTypesKeys)

setExpectedTypesSignatures

protected void setExpectedTypesSignatures(char[][] expectedTypesSignatures)

setExtended

protected void setExtended()

setExtendedData

protected void setExtendedData(ITypeRoot typeRoot,
                               CompilationUnitDeclaration compilationUnitDeclaration,
                               LookupEnvironment lookupEnvironment,
                               Scope scope,
                               ASTNode astNode,
                               WorkingCopyOwner owner,
                               CompletionParser parser)

setJavadoc

protected void setJavadoc(int javadoc)

setOffset

protected void setOffset(int offset)

setToken

protected void setToken(char[] token)

setTokenKind

protected void setTokenKind(int tokenKind)

setTokenLocation

protected void setTokenLocation(int tokenLocation)

setTokenRange

protected void setTokenRange(int start,
                             int end)

setTokenRange

protected void setTokenRange(int start,
                             int end,
                             int endOfEmptyToken)

getEnclosingElement

public IJavaElement getEnclosingElement()
Returns the innermost enclosing Java element which contains the completion location or 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: Reasons for returning null include:

Overrides:
getEnclosingElement in class CompletionContext
Returns:
the innermost enclosing Java element which contains the completion location or null if this element cannot be computed.
Throws:
java.lang.UnsupportedOperationException - if the context is not an extended context
Since:
3.4

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.

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

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.

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

getOffset

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

Overrides:
getOffset in class CompletionContext
Returns:
offset position in the source file buffer
Since:
3.2

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.

Overrides:
getToken in class CompletionContext
Returns:
completed token or null
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).

Overrides:
getTokenEnd in class CompletionContext
Returns:
character index of token end position (exclusive)
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.

Overrides:
getTokenKind in class CompletionContext
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

getTokenLocation

public int getTokenLocation()
Returns the location of completion token being proposed. The returned location is a bit mask which can contain some values of the constants declared on this class whose name starts with 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.

Overrides:
getTokenLocation in class CompletionContext
Returns:
the location
Since:
3.4

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.

Overrides:
getTokenStart in class CompletionContext
Returns:
character index of token start position (inclusive)
Since:
3.2

getVisibleElements

public IJavaElement[] getVisibleElements(java.lang.String typeSignature)
Return the elements which are visible from the completion location and which can be assigned to the given type. An element is assignable if its type can be assigned to a variable of the given type, as specified in section 5.2 of The Java Language Specification, Third Edition (JLS3). A visible element is either: Returned elements defined in the completed compilation unit are special Java elements: Note the array can be empty if:

Overrides:
getVisibleElements in class CompletionContext
Parameters:
typeSignature - elements which can be assigned to this type are returned. If null there is no constraint on the type of the returned elements.
Returns:
elements which are visible from the completion location and which can be assigned to the given type.
Throws:
java.lang.UnsupportedOperationException - if the context is not an extended context
Since:
3.4
See Also:
isExtended()

isExtended

public boolean isExtended()
Returns whether this completion context is an extended context. Some methods of this context can be used only if this context is an extended context but an extended context consumes more memory.

Overrides:
isExtended in class CompletionContext
Returns:
true if this completion context is an extended context.
Since:
3.4

isInJavadoc

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

Overrides:
isInJavadoc in class CompletionContext
Returns:
boolean true if completion takes place in 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:

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

isInJavadocText

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

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