|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.wst.jsdt.core.CompletionRequestor
org.eclipse.wst.jsdt.ui.text.java.CompletionProposalCollector
public class CompletionProposalCollector
JavaScript UI implementation of CompletionRequestor
. Produces
IJavaCompletionProposal
s from the proposal descriptors received via
the CompletionRequestor
interface.
The lifecycle of a CompletionProposalCollector
instance is very
simple:
IJavaScriptUnit unit= ... int offset= ... CompletionProposalCollector collector= new CompletionProposalCollector(unit); unit.codeComplete(offset, collector); IJavaCompletionProposal[] proposals= collector.getJavaCompletionProposals(); String errorMessage= collector.getErrorMessage(); // display / process proposalsNote that after a code completion operation, the collector will store any received proposals, which may require a considerable amount of memory, so the collector should not be kept as a reference after a completion operation.
Clients may instantiate or subclass.
Provisional API: This class/interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.
Constructor Summary | |
---|---|
CompletionProposalCollector(IJavaScriptProject project)
Creates a new instance ready to collect proposals. |
|
CompletionProposalCollector(IJavaScriptUnit cu)
Creates a new instance ready to collect proposals. |
Method Summary | |
---|---|
void |
accept(CompletionProposal proposal)
Proposes a completion. Subclasses may replace, but usually should not need to. |
void |
acceptContext(CompletionContext context)
Propose the context in which the completion occurs. Subclasses may extend, but usually should not need to. |
void |
beginReporting()
Pro forma notification sent before reporting a batch of completion proposals. Subclasses may extend, but must call the super implementation. |
void |
completionFailure(IProblem problem)
Notification of failure to produce any completions. Subclasses may extend, but must call the super implementation. |
void |
endReporting()
Pro forma notification sent after reporting a batch of completion proposals. Subclasses may extend, but must call the super implementation. |
java.lang.String |
getErrorMessage()
Returns an error message about any error that may have occurred during code completion, or the empty string if none. |
IJavaCompletionProposal[] |
getJavaCompletionProposals()
Returns the unsorted list of received proposals. |
org.eclipse.wst.jsdt.internal.ui.text.java.JavaCompletionProposal[] |
getKeywordCompletionProposals()
Returns the unsorted list of received keyword proposals. |
void |
setInvocationContext(JavaContentAssistInvocationContext context)
Sets the invocation context. |
void |
setReplacementLength(int length)
If the replacement length is set, it overrides the length returned from the content assist infrastructure. |
Methods inherited from class org.eclipse.wst.jsdt.core.CompletionRequestor |
---|
getFavoriteReferences, isAllowingRequiredProposals, isIgnored, setAllowsRequiredProposals, setFavoriteReferences, setIgnored |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CompletionProposalCollector(IJavaScriptUnit cu)
IJavaScriptUnit
is not contained in an
IJavaScriptProject
, no javadoc will be available as
additional info
on the created proposals.
cu
- the compilation unit that the result collector will operate onpublic CompletionProposalCollector(IJavaScriptProject project)
CompletionProposalCollector(IJavaScriptUnit)
instead to get all proposals.
If the passed JavaScript project is null
, no javadoc will be
available as
additional info
on the created (e.g. method and type) proposals.
project
- the project that the result collector will operate on, or
null
Method Detail |
---|
public void setInvocationContext(JavaContentAssistInvocationContext context)
Subclasses may extend.
context
- the invocation contextgetInvocationContext()
public void accept(CompletionProposal proposal)
CompletionRequestor.isIgnored(int)
before avoid creating proposal
objects that would only be ignored.
Similarly, implementers should check
isIgnored(proposal.getKind())
and ignore proposals that have been declared as uninteresting.
The proposal object passed is only valid for the duration of
completion operation.
Subclasses may replace, but usually should not need to. Consider replacing createJavaCompletionProposal instead.
accept
in class CompletionRequestor
proposal
- the completion proposalpublic void acceptContext(CompletionContext context)
This method is called one and only one time before any call to
CompletionRequestor.accept(CompletionProposal)
.
The default implementation of this method does nothing.
Clients may override.
Subclasses may extend, but usually should not need to.
acceptContext
in class CompletionRequestor
context
- the completion contextgetContext()
public void beginReporting()
The default implementation of this method does nothing. Clients may override.
Subclasses may extend, but must call the super implementation.
beginReporting
in class CompletionRequestor
public void completionFailure(IProblem problem)
The default implementation of this method does nothing. Clients may override to receive this kind of notice.
Subclasses may extend, but must call the super implementation.
completionFailure
in class CompletionRequestor
problem
- the problem objectpublic void endReporting()
The default implementation of this method does nothing. Clients may override.
Subclasses may extend, but must call the super implementation.
endReporting
in class CompletionRequestor
public java.lang.String getErrorMessage()
Subclasses may replace or extend.
public final IJavaCompletionProposal[] getJavaCompletionProposals()
public final org.eclipse.wst.jsdt.internal.ui.text.java.JavaCompletionProposal[] getKeywordCompletionProposals()
public final void setReplacementLength(int length)
length
- the new replacement length, relative to the code assist
offset. Must be equal to or greater than zero.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |