|
Eclipse Platform Release 3.1 |
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
java.lang.Objectorg.eclipse.jface.contentassist.ContentAssistInvocationContext
org.eclipse.jface.text.contentassist.TextContentAssistInvocationContext
A content assist invocation context for text viewers. The context knows the viewer, the invocation offset and can lazily compute the identifier prefix preceding the invocation offset.
Clients may instantiate and subclass.
XXX this API is provisional and may change anytime during the course of 3.2
| Constructor Summary | |
|---|---|
TextContentAssistInvocationContext(ITextViewer viewer)
Equivalent to TextContentAssistInvocationContext(viewer, viewer.getSelectedRange().x). |
|
TextContentAssistInvocationContext(ITextViewer viewer,
int offset)
Creates a new context for the given viewer and offset. |
|
| Method Summary | |
|---|---|
CharSequence |
computeIdentifierPrefix()
Computes the identifier (as specified by Character.isJavaIdentifierPart(char)) that
immediately precedes the invocation offset. |
boolean |
equals(Object obj)
Invocation contexts are equal if they describe the same context and are of the same type. |
IDocument |
getDocument()
Shortcut for getViewer().getDocument(). |
int |
getInvocationOffset()
Returns the invocation offset. |
ITextViewer |
getViewer()
Returns the viewer. |
int |
hashCode()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public TextContentAssistInvocationContext(ITextViewer viewer)
viewer - the text viewer that content assist is invoked in
public TextContentAssistInvocationContext(ITextViewer viewer,
int offset)
viewer - the text viewer that content assist is invoked inoffset - the offset into the viewer's document where content assist is invoked at| Method Detail |
public final int getInvocationOffset()
public final ITextViewer getViewer()
public IDocument getDocument()
getViewer().getDocument().
public CharSequence computeIdentifierPrefix()
throws BadLocationException
Character.isJavaIdentifierPart(char)) that
immediately precedes the invocation offset.
BadLocationException - if accessing the document failspublic boolean equals(Object obj)
ContentAssistInvocationContextnull values and class equality. Subclasses
should extend this method by adding checks for their context relevant fields (but not
necessarily cached values).
Example:
class MyContext extends ContentAssistInvocationContext {
private final Object fState;
private Object fCachedInfo;
...
public boolean equals(Object obb) {
if (!super.equals(obj))
return false;
MyContext other= (MyContext) obj;
return fState.equals(other.fState);
}
}
Subclasses should also extend Object.hashCode().
equals in class ContentAssistInvocationContextobj -
public int hashCode()
hashCode in class ContentAssistInvocationContext
|
Eclipse Platform Release 3.1 |
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2005. All rights reserved.