Klasse CompletionRequestor
- Bekannte direkte Unterklassen:
CompletionRequestorWrapper
This class is intended to be subclassed by clients.
The code assist engine normally invokes methods on completion requestor in the following sequence:
requestor.beginReporting(); requestor.acceptContext(context); requestor.accept(proposal_1); requestor.accept(proposal_2); ... requestor.endReporting();
If, however, the engine is unable to offer completion proposals
for whatever reason, completionFailure
is called
with a problem object describing why completions were unavailable.
In this case, the sequence of calls is:
requestor.beginReporting(); requestor.acceptContext(context); requestor.completionFailure(problem); requestor.endReporting();
In either case, the bracketing beginReporting
endReporting
calls are always made as well as
acceptContext
call.
The class was introduced in 3.0 as a more evolvable replacement
for the ICompletionRequestor
interface.
- Seit:
- 3.0
- Siehe auch:
-
Konstruktorübersicht
KonstruktorBeschreibungCreates a new completion requestor.CompletionRequestor
(boolean ignoreAll) Creates a new completion requestor. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungabstract void
accept
(CompletionProposal proposal) Proposes a completion.void
acceptContext
(CompletionContext context) Propose the context in which the completion occurs.void
Pro forma notification sent before reporting a batch of completion proposals.void
completionFailure
(IProblem problem) Notification of failure to produce any completions.void
Pro forma notification sent after reporting a batch of completion proposals.String[]
Returns the favorite references which are used to compute some completion proposals.boolean
isAllowingRequiredProposals
(int proposalKind, int requiredProposalKind) Returns whether a proposal of a given kind with a required proposal of the given kind is allowed.boolean
Returns whether this requestor requires an extended context.boolean
isIgnored
(char[] fullTypeName) Returns whether the given type proposal is ignored.boolean
isIgnored
(int completionProposalKind) Returns whether the given kind of completion proposal is ignored.boolean
If this returns true, exclude test sources and dependencies.void
setAllowsRequiredProposals
(int proposalKind, int requiredProposalKind, boolean allow) Sets whether a proposal of a given kind with a required proposal of the given kind is allowed.void
setFavoriteReferences
(String[] favoriteImports) Set the favorite references which will be used to compute some completion proposals.void
setIgnored
(int completionProposalKind, boolean ignore) Sets whether the given kind of completion proposal is ignored.void
setRequireExtendedContext
(boolean require) Sets whether this requestor requires an extended context.
-
Konstruktordetails
-
CompletionRequestor
public CompletionRequestor()Creates a new completion requestor. The requestor is interested in all kinds of completion proposals; none will be ignored. Calls to this constructor are identical to calls toCompletionRequestor(false)
-
CompletionRequestor
public CompletionRequestor(boolean ignoreAll) Creates a new completion requestor. IfignoreAll
istrue
the requestor is not interested in all kinds of completion proposals; all will be ignored. For each kind of completion proposals that is of interest,setIgnored(kind, false)
must be called. IfignoreAll
isfalse
the requestor is interested in all kinds of completion proposals; none will be ignored.- Parameter:
ignoreAll
-true
to ignore all kinds of completion proposals, andfalse
to propose all kinds- Seit:
- 3.4
-
-
Methodendetails
-
isIgnored
public boolean isIgnored(int completionProposalKind) Returns whether the given kind of completion proposal is ignored.- Parameter:
completionProposalKind
- one of the kind constants declared onCompletionProposal
- Gibt zurück:
true
if the given kind of completion proposal is ignored by this requestor, andfalse
if it is of interest- Siehe auch:
-
setIgnored
public void setIgnored(int completionProposalKind, boolean ignore) Sets whether the given kind of completion proposal is ignored.- Parameter:
completionProposalKind
- one of the kind constants declared onCompletionProposal
ignore
-true
if the given kind of completion proposal is ignored by this requestor, andfalse
if it is of interest- Siehe auch:
-
isIgnored
public boolean isIgnored(char[] fullTypeName) Returns whether the given type proposal is ignored.- Parameter:
fullTypeName
- the proposed type name of CompletionProposal- Gibt zurück:
true
if the given type name is ignored by this requestor, andfalse
if it is of interest- Seit:
- 3.30
-
isAllowingRequiredProposals
public boolean isAllowingRequiredProposals(int proposalKind, int requiredProposalKind) Returns whether a proposal of a given kind with a required proposal of the given kind is allowed.- Parameter:
proposalKind
- one of the kind constants declaredrequiredProposalKind
- one of the kind constants declared onCompletionProposal
- Gibt zurück:
true
if a proposal of a given kind with a required proposal of the given kind is allowed by this requestor, andfalse
if it isn't of interest.By default, all kinds of required proposals aren't allowed.
- Seit:
- 3.3
- Siehe auch:
-
setAllowsRequiredProposals
public void setAllowsRequiredProposals(int proposalKind, int requiredProposalKind, boolean allow) Sets whether a proposal of a given kind with a required proposal of the given kind is allowed. A required proposal of a given kind is proposed even ifisIgnored(int)
returntrue
for that kind. Currently only a subset of kinds support required proposals. To see what combinations are supported you must look atCompletionProposal.getRequiredProposals()
documentation.- Parameter:
proposalKind
- one of the kind constants declaredrequiredProposalKind
- one of the kind constants declared onCompletionProposal
allow
-true
if a proposal of a given kind with a required proposal of the given kind is allowed by this requestor, andfalse
if it isn't of interest- Seit:
- 3.3
- Siehe auch:
-
getFavoriteReferences
Returns the favorite references which are used to compute some completion proposals.A favorite reference is a qualified reference as it can be seen in an import statement.
e.g.{"java.util.Arrays"}
It can be an on demand reference.
e.g.{"java.util.Arrays.*"}
It can be a reference to a static method or field (as in a static import)
e.g.{"java.util.Arrays.equals"}
Currently only on demand type references (
"java.util.Arrays.*"
), references to a static method or a static field are used to compute completion proposals. Other kind of reference could be used in the future.- Gibt zurück:
- favorite imports
- Seit:
- 3.3
-
setFavoriteReferences
Set the favorite references which will be used to compute some completion proposals. A favorite reference is a qualified reference as it can be seen in an import statement.- Parameter:
favoriteImports
-- Seit:
- 3.3
- Siehe auch:
-
beginReporting
public void beginReporting()Pro forma notification sent before reporting a batch of completion proposals.The default implementation of this method does nothing. Clients may override.
-
endReporting
public void endReporting()Pro forma notification sent after reporting a batch of completion proposals.The default implementation of this method does nothing. Clients may override.
-
completionFailure
Notification of failure to produce any completions. The problem object explains what prevented completing.The default implementation of this method does nothing. Clients may override to receive this kind of notice.
- Parameter:
problem
- the problem object
-
accept
Proposes a completion. Has no effect if the kind of proposal is being ignored by this requestor. Callers should consider checkingisIgnored(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.- Parameter:
proposal
- the completion proposal- Löst aus:
IllegalArgumentException
- if the proposal is null
-
acceptContext
Propose the context in which the completion occurs.This method is called one and only one time before any call to
accept(CompletionProposal)
. The default implementation of this method does nothing. Clients may override.- Parameter:
context
- the completion context- Seit:
- 3.1
-
isExtendedContextRequired
public boolean isExtendedContextRequired()Returns whether this requestor requires an extended context. By default this method returnfalse
.- Gibt zurück:
true
if this requestor requires an extended context.- Seit:
- 3.4
- Siehe auch:
-
setRequireExtendedContext
public void setRequireExtendedContext(boolean require) Sets whether this requestor requires an extended context.- Parameter:
require
-true
if this requestor requires an extended context.- Seit:
- 3.4
- Siehe auch:
-
isTestCodeExcluded
public boolean isTestCodeExcluded()If this returns true, exclude test sources and dependencies.- Gibt zurück:
true
if this requestor does not want to get any completions from test code.- Seit:
- 3.14
- Siehe auch:
-