|
Lines 2254-2263
Link Here
|
| 2254 |
|| !this.requestor.isIgnored(CompletionProposal.JAVADOC_FIELD_REF)) { |
2254 |
|| !this.requestor.isIgnored(CompletionProposal.JAVADOC_FIELD_REF)) { |
| 2255 |
findFields(this.completionToken, |
2255 |
findFields(this.completionToken, |
| 2256 |
receiverType, |
2256 |
receiverType, |
| 2257 |
scope, |
2257 |
scope, |
| 2258 |
new ObjectVector(), |
2258 |
new ObjectVector(), |
|
|
2259 |
null, |
| 2259 |
new ObjectVector(), |
2260 |
new ObjectVector(), |
| 2260 |
false, /*not only static */ |
2261 |
false, /*not only static */ |
| 2261 |
fieldRef, |
2262 |
fieldRef, |
| 2262 |
scope, |
2263 |
scope, |
| 2263 |
false, |
2264 |
false, |
|
Lines 6139-6148
Link Here
|
| 6139 |
private void findFields( |
6140 |
private void findFields( |
| 6140 |
char[] fieldName, |
6141 |
char[] fieldName, |
| 6141 |
FieldBinding[] fields, |
6142 |
FieldBinding[] fields, |
| 6142 |
Scope scope, |
6143 |
Scope scope, |
| 6143 |
ObjectVector fieldsFound, |
6144 |
ObjectVector fieldsFound, |
|
|
6145 |
ObjectVector fieldProposals, |
| 6144 |
ObjectVector localsFound, |
6146 |
ObjectVector localsFound, |
| 6145 |
boolean onlyStaticFields, |
6147 |
boolean onlyStaticFields, |
| 6146 |
ReferenceBinding receiverType, |
6148 |
ReferenceBinding receiverType, |
| 6147 |
InvocationSite invocationSite, |
6149 |
InvocationSite invocationSite, |
| 6148 |
Scope invocationScope, |
6150 |
Scope invocationScope, |
|
Lines 6155-6164
Link Here
|
| 6155 |
char[] castedReceiver, |
6157 |
char[] castedReceiver, |
| 6156 |
int receiverStart, |
6158 |
int receiverStart, |
| 6157 |
int receiverEnd) { |
6159 |
int receiverEnd) { |
| 6158 |
|
6160 |
|
| 6159 |
ObjectVector newFieldsFound = new ObjectVector(); |
6161 |
ObjectVector newFieldsFound = new ObjectVector(); |
|
|
6162 |
ObjectVector newFieldProposals = new ObjectVector(); |
| 6160 |
// if the proposal is being asked inside a field's initialization, we'll record its id |
6163 |
// if the proposal is being asked inside a field's initialization, we'll record its id |
| 6161 |
int fieldBeingCompletedId = -1; |
6164 |
int fieldBeingCompletedId = -1; |
| 6162 |
boolean isFieldBeingCompletedStatic = false; |
6165 |
boolean isFieldBeingCompletedStatic = false; |
| 6163 |
for (int f = fields.length; --f >=0;) { |
6166 |
for (int f = fields.length; --f >=0;) { |
| 6164 |
FieldBinding field = fields[f]; |
6167 |
FieldBinding field = fields[f]; |
|
Lines 6237-6246
Link Here
|
| 6237 |
continue next; // non-constants not allowed in case. |
6240 |
continue next; // non-constants not allowed in case. |
| 6238 |
} |
6241 |
} |
| 6239 |
} |
6242 |
} |
| 6240 |
|
6243 |
|
| 6241 |
boolean prefixRequired = false; |
6244 |
boolean prefixRequired = false; |
|
|
6245 |
boolean rootNameCompletion = false; |
| 6242 |
|
6246 |
|
| 6243 |
for (int i = fieldsFound.size; --i >= 0;) { |
6247 |
for (int i = fieldsFound.size; --i >= 0;) { |
| 6244 |
Object[] other = (Object[])fieldsFound.elementAt(i); |
6248 |
Object[] other = (Object[])fieldsFound.elementAt(i); |
| 6245 |
FieldBinding otherField = (FieldBinding) other[0]; |
6249 |
FieldBinding otherField = (FieldBinding) other[0]; |
| 6246 |
ReferenceBinding otherReceiverType = (ReferenceBinding) other[1]; |
6250 |
ReferenceBinding otherReceiverType = (ReferenceBinding) other[1]; |
|
Lines 6258-6267
Link Here
|
| 6258 |
if (field.declaringClass.isInterface()) |
6262 |
if (field.declaringClass.isInterface()) |
| 6259 |
if (otherField.declaringClass.implementsInterface(field.declaringClass, true)) |
6263 |
if (otherField.declaringClass.implementsInterface(field.declaringClass, true)) |
| 6260 |
continue next; |
6264 |
continue next; |
| 6261 |
if(canBePrefixed) { |
6265 |
if(canBePrefixed) { |
| 6262 |
prefixRequired = true; |
6266 |
prefixRequired = true; |
|
|
6267 |
if (fieldProposals != null) { |
| 6268 |
InternalCompletionProposal oldProposal = (InternalCompletionProposal)fieldProposals.elementAt(i); |
| 6269 |
if (oldProposal.getKind() == CompletionProposal.FIELD_REF && CharOperation.equals(field.name, oldProposal.getName())) { |
| 6270 |
rootNameCompletion = true; |
| 6271 |
oldProposal.setCompletion(CharOperation.concat(oldProposal.declarationTypeName, oldProposal.getName(), '.')); |
| 6272 |
} |
| 6273 |
} |
| 6263 |
} else { |
6274 |
} else { |
| 6264 |
continue next; |
6275 |
continue next; |
| 6265 |
} |
6276 |
} |
| 6266 |
} |
6277 |
} |
| 6267 |
} |
6278 |
} |
|
Lines 6356-6371
Link Here
|
| 6356 |
missingElementsEnds[i], |
6367 |
missingElementsEnds[i], |
| 6357 |
relevance); |
6368 |
relevance); |
| 6358 |
} |
6369 |
} |
| 6359 |
proposal.setRequiredProposals(subProposals); |
6370 |
proposal.setRequiredProposals(subProposals); |
| 6360 |
} |
6371 |
} |
| 6361 |
proposal.setCompletion(completion); |
6372 |
proposal.setCompletion(rootNameCompletion ? CharOperation.concat(field.declaringClass.qualifiedSourceName(), field.name, '.') : completion); |
| 6362 |
proposal.setFlags(field.modifiers); |
6373 |
proposal.setFlags(field.modifiers); |
| 6363 |
proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset); |
6374 |
proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset); |
| 6364 |
proposal.setTokenRange(this.tokenStart - this.offset, this.tokenEnd - this.offset); |
6375 |
proposal.setTokenRange(this.tokenStart - this.offset, this.tokenEnd - this.offset); |
| 6365 |
proposal.setRelevance(relevance); |
6376 |
proposal.setRelevance(relevance); |
| 6366 |
this.requestor.accept(proposal); |
6377 |
if (fieldProposals != null) { |
|
|
6378 |
newFieldProposals.add(proposal); |
| 6379 |
} |
| 6380 |
else { |
| 6381 |
this.requestor.accept(proposal); |
| 6382 |
} |
| 6367 |
if(DEBUG) { |
6383 |
if(DEBUG) { |
| 6368 |
this.printDebug(proposal); |
6384 |
this.printDebug(proposal); |
| 6369 |
} |
6385 |
} |
| 6370 |
} |
6386 |
} |
| 6371 |
|
6387 |
|
|
Lines 6384-6394
Link Here
|
| 6384 |
proposal.setFlags(field.modifiers); |
6400 |
proposal.setFlags(field.modifiers); |
| 6385 |
int start = (this.assistNodeInJavadoc & CompletionOnJavadoc.REPLACE_TAG) != 0 ? this.javadocTagPosition : this.startPosition; |
6401 |
int start = (this.assistNodeInJavadoc & CompletionOnJavadoc.REPLACE_TAG) != 0 ? this.javadocTagPosition : this.startPosition; |
| 6386 |
proposal.setReplaceRange(start - this.offset, this.endPosition - this.offset); |
6402 |
proposal.setReplaceRange(start - this.offset, this.endPosition - this.offset); |
| 6387 |
proposal.setTokenRange(this.tokenStart - this.offset, this.tokenEnd - this.offset); |
6403 |
proposal.setTokenRange(this.tokenStart - this.offset, this.tokenEnd - this.offset); |
| 6388 |
proposal.setRelevance(relevance+R_INLINE_TAG); |
6404 |
proposal.setRelevance(relevance+R_INLINE_TAG); |
| 6389 |
this.requestor.accept(proposal); |
6405 |
if (fieldProposals != null) { |
|
|
6406 |
newFieldProposals.add(proposal); |
| 6407 |
} |
| 6408 |
else { |
| 6409 |
this.requestor.accept(proposal); |
| 6410 |
} |
| 6390 |
if(DEBUG) { |
6411 |
if(DEBUG) { |
| 6391 |
this.printDebug(proposal); |
6412 |
this.printDebug(proposal); |
| 6392 |
} |
6413 |
} |
| 6393 |
// Javadoc value completion for static fields |
6414 |
// Javadoc value completion for static fields |
| 6394 |
if (field.isStatic() && !this.requestor.isIgnored(CompletionProposal.JAVADOC_VALUE_REF)) { |
6415 |
if (field.isStatic() && !this.requestor.isIgnored(CompletionProposal.JAVADOC_VALUE_REF)) { |
|
Lines 6404-6414
Link Here
|
| 6404 |
valueProposal.setCompletion(javadocCompletion); |
6425 |
valueProposal.setCompletion(javadocCompletion); |
| 6405 |
valueProposal.setFlags(field.modifiers); |
6426 |
valueProposal.setFlags(field.modifiers); |
| 6406 |
valueProposal.setReplaceRange(start - this.offset, this.endPosition - this.offset); |
6427 |
valueProposal.setReplaceRange(start - this.offset, this.endPosition - this.offset); |
| 6407 |
valueProposal.setTokenRange(this.tokenStart - this.offset, this.tokenEnd - this.offset); |
6428 |
valueProposal.setTokenRange(this.tokenStart - this.offset, this.tokenEnd - this.offset); |
| 6408 |
valueProposal.setRelevance(relevance+R_VALUE_TAG); |
6429 |
valueProposal.setRelevance(relevance+R_VALUE_TAG); |
| 6409 |
this.requestor.accept(valueProposal); |
6430 |
if (fieldProposals != null) { |
|
|
6431 |
newFieldProposals.add(valueProposal); |
| 6432 |
} |
| 6433 |
else { |
| 6434 |
this.requestor.accept(valueProposal); |
| 6435 |
} |
| 6410 |
if(DEBUG) { |
6436 |
if(DEBUG) { |
| 6411 |
this.printDebug(valueProposal); |
6437 |
this.printDebug(valueProposal); |
| 6412 |
} |
6438 |
} |
| 6413 |
} |
6439 |
} |
| 6414 |
} |
6440 |
} |
|
Lines 6433-6463
Link Here
|
| 6433 |
missingElementsEnds[i], |
6459 |
missingElementsEnds[i], |
| 6434 |
relevance); |
6460 |
relevance); |
| 6435 |
} |
6461 |
} |
| 6436 |
proposal.setRequiredProposals(subProposals); |
6462 |
proposal.setRequiredProposals(subProposals); |
| 6437 |
} |
6463 |
} |
| 6438 |
proposal.setCompletion(completion); |
6464 |
proposal.setCompletion(rootNameCompletion ? CharOperation.concat(field.declaringClass.qualifiedSourceName(), field.name, '.') : completion); |
| 6439 |
proposal.setFlags(field.modifiers); |
6465 |
proposal.setFlags(field.modifiers); |
| 6440 |
proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset); |
6466 |
proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset); |
| 6441 |
proposal.setReceiverRange(receiverStart - this.offset, receiverEnd - this.offset); |
6467 |
proposal.setReceiverRange(receiverStart - this.offset, receiverEnd - this.offset); |
| 6442 |
proposal.setTokenRange(this.tokenStart - this.offset, this.tokenEnd - this.offset); |
6468 |
proposal.setTokenRange(this.tokenStart - this.offset, this.tokenEnd - this.offset); |
| 6443 |
proposal.setRelevance(relevance); |
6469 |
proposal.setRelevance(relevance); |
| 6444 |
this.requestor.accept(proposal); |
6470 |
if (fieldProposals != null) { |
|
|
6471 |
newFieldProposals.add(proposal); |
| 6472 |
} |
| 6473 |
else { |
| 6474 |
this.requestor.accept(proposal); |
| 6475 |
} |
| 6445 |
if(DEBUG) { |
6476 |
if(DEBUG) { |
| 6446 |
this.printDebug(proposal); |
6477 |
this.printDebug(proposal); |
| 6447 |
} |
6478 |
} |
| 6448 |
} |
6479 |
} |
| 6449 |
} |
6480 |
} |
| 6450 |
} |
6481 |
} |
| 6451 |
|
6482 |
|
| 6452 |
fieldsFound.addAll(newFieldsFound); |
6483 |
fieldsFound.addAll(newFieldsFound); |
|
|
6484 |
if (fieldProposals != null) { |
| 6485 |
fieldProposals.addAll(newFieldProposals); |
| 6486 |
} |
| 6453 |
} |
6487 |
} |
| 6454 |
private void findFields( |
6488 |
private void findFields( |
| 6455 |
char[] fieldName, |
6489 |
char[] fieldName, |
| 6456 |
ReferenceBinding receiverType, |
6490 |
ReferenceBinding receiverType, |
| 6457 |
Scope scope, |
6491 |
Scope scope, |
| 6458 |
ObjectVector fieldsFound, |
6492 |
ObjectVector fieldsFound, |
|
|
6493 |
ObjectVector fieldProposals, |
| 6459 |
ObjectVector localsFound, |
6494 |
ObjectVector localsFound, |
| 6460 |
boolean onlyStaticFields, |
6495 |
boolean onlyStaticFields, |
| 6461 |
InvocationSite invocationSite, |
6496 |
InvocationSite invocationSite, |
| 6462 |
Scope invocationScope, |
6497 |
Scope invocationScope, |
| 6463 |
boolean implicitCall, |
6498 |
boolean implicitCall, |
|
Lines 6501-6510
Link Here
|
| 6501 |
findFields( |
6536 |
findFields( |
| 6502 |
fieldName, |
6537 |
fieldName, |
| 6503 |
fields, |
6538 |
fields, |
| 6504 |
scope, |
6539 |
scope, |
| 6505 |
fieldsFound, |
6540 |
fieldsFound, |
|
|
6541 |
null, |
| 6506 |
localsFound, |
6542 |
localsFound, |
| 6507 |
onlyStaticFields, |
6543 |
onlyStaticFields, |
| 6508 |
receiverType, |
6544 |
receiverType, |
| 6509 |
invocationSite, |
6545 |
invocationSite, |
| 6510 |
invocationScope, |
6546 |
invocationScope, |
|
Lines 6529-6538
Link Here
|
| 6529 |
findFields( |
6565 |
findFields( |
| 6530 |
fieldName, |
6566 |
fieldName, |
| 6531 |
fields, |
6567 |
fields, |
| 6532 |
scope, |
6568 |
scope, |
| 6533 |
fieldsFound, |
6569 |
fieldsFound, |
|
|
6570 |
fieldProposals, |
| 6534 |
localsFound, |
6571 |
localsFound, |
| 6535 |
onlyStaticFields, |
6572 |
onlyStaticFields, |
| 6536 |
receiverType, |
6573 |
receiverType, |
| 6537 |
invocationSite, |
6574 |
invocationSite, |
| 6538 |
invocationScope, |
6575 |
invocationScope, |
|
Lines 6557-6566
Link Here
|
| 6557 |
for (int b = 0; b < nextPosition; b++) |
6594 |
for (int b = 0; b < nextPosition; b++) |
| 6558 |
if (next == interfacesToVisit[b]) continue nextInterface; |
6595 |
if (next == interfacesToVisit[b]) continue nextInterface; |
| 6559 |
interfacesToVisit[nextPosition++] = next; |
6596 |
interfacesToVisit[nextPosition++] = next; |
| 6560 |
} |
6597 |
} |
| 6561 |
} |
6598 |
} |
|
|
6599 |
} |
| 6600 |
if (fieldProposals != null) { |
| 6601 |
for (int indx = 0; indx < fieldProposals.size; indx++) { |
| 6602 |
this.requestor.accept((InternalCompletionProposal)fieldProposals.elementAt(indx)); |
| 6603 |
} |
| 6604 |
fieldProposals.removeAll(); |
| 6562 |
} |
6605 |
} |
| 6563 |
} |
6606 |
} |
| 6564 |
} |
6607 |
} |
| 6565 |
|
6608 |
|
| 6566 |
protected void findFieldsAndMethods( |
6609 |
protected void findFieldsAndMethods( |
|
Lines 6807-6816
Link Here
|
| 6807 |
findFields( |
6850 |
findFields( |
| 6808 |
token, |
6851 |
token, |
| 6809 |
(ReferenceBinding) receiverType, |
6852 |
(ReferenceBinding) receiverType, |
| 6810 |
scope, |
6853 |
scope, |
| 6811 |
fieldsFound, |
6854 |
fieldsFound, |
|
|
6855 |
null, |
| 6812 |
new ObjectVector(), |
6856 |
new ObjectVector(), |
| 6813 |
false, |
6857 |
false, |
| 6814 |
invocationSite, |
6858 |
invocationSite, |
| 6815 |
invocationScope, |
6859 |
invocationScope, |
| 6816 |
implicitCall, |
6860 |
implicitCall, |
|
Lines 7343-7352
Link Here
|
| 7343 |
findFields( |
7387 |
findFields( |
| 7344 |
token, |
7388 |
token, |
| 7345 |
(ReferenceBinding)binding, |
7389 |
(ReferenceBinding)binding, |
| 7346 |
scope, |
7390 |
scope, |
| 7347 |
fieldsFound, |
7391 |
fieldsFound, |
|
|
7392 |
null, |
| 7348 |
localsFound, |
7393 |
localsFound, |
| 7349 |
true, |
7394 |
true, |
| 7350 |
invocationSite, |
7395 |
invocationSite, |
| 7351 |
invocationScope, |
7396 |
invocationScope, |
| 7352 |
true, |
7397 |
true, |
|
Lines 7389-7398
Link Here
|
| 7389 |
findFields( |
7434 |
findFields( |
| 7390 |
token, |
7435 |
token, |
| 7391 |
new FieldBinding[]{(FieldBinding)binding}, |
7436 |
new FieldBinding[]{(FieldBinding)binding}, |
| 7392 |
scope, |
7437 |
scope, |
| 7393 |
fieldsFound, |
7438 |
fieldsFound, |
|
|
7439 |
null, |
| 7394 |
localsFound, |
7440 |
localsFound, |
| 7395 |
true, |
7441 |
true, |
| 7396 |
((FieldBinding)binding).declaringClass, |
7442 |
((FieldBinding)binding).declaringClass, |
| 7397 |
invocationSite, |
7443 |
invocationSite, |
| 7398 |
invocationScope, |
7444 |
invocationScope, |
|
Lines 9250-9259
Link Here
|
| 9250 |
findFields( |
9296 |
findFields( |
| 9251 |
token, |
9297 |
token, |
| 9252 |
receiverType, |
9298 |
receiverType, |
| 9253 |
scope, |
9299 |
scope, |
| 9254 |
new ObjectVector(), |
9300 |
new ObjectVector(), |
|
|
9301 |
null, |
| 9255 |
new ObjectVector(), |
9302 |
new ObjectVector(), |
| 9256 |
true, |
9303 |
true, |
| 9257 |
invocationSite, |
9304 |
invocationSite, |
| 9258 |
scope, |
9305 |
scope, |
| 9259 |
false, |
9306 |
false, |
|
Lines 11591-11600
Link Here
|
| 11591 |
|
11638 |
|
| 11592 |
ObjectVector localsFound = new ObjectVector(); |
11639 |
ObjectVector localsFound = new ObjectVector(); |
| 11593 |
ObjectVector fieldsFound = new ObjectVector(); |
11640 |
ObjectVector fieldsFound = new ObjectVector(); |
| 11594 |
ObjectVector methodsFound = new ObjectVector(); |
11641 |
ObjectVector methodsFound = new ObjectVector(); |
| 11595 |
|
11642 |
|
|
|
11643 |
ObjectVector fieldProposals = new ObjectVector(); |
| 11644 |
|
| 11596 |
Scope currentScope = scope; |
11645 |
Scope currentScope = scope; |
| 11597 |
|
11646 |
|
| 11598 |
if (!this.requestor.isIgnored(CompletionProposal.LOCAL_VARIABLE_REF)) { |
11647 |
if (!this.requestor.isIgnored(CompletionProposal.LOCAL_VARIABLE_REF)) { |
| 11599 |
done1 : while (true) { // done when a COMPILATION_UNIT_SCOPE is found |
11648 |
done1 : while (true) { // done when a COMPILATION_UNIT_SCOPE is found |
| 11600 |
|
11649 |
|
|
Lines 11740-11749
Link Here
|
| 11740 |
findFields( |
11789 |
findFields( |
| 11741 |
token, |
11790 |
token, |
| 11742 |
enclosingType, |
11791 |
enclosingType, |
| 11743 |
classScope, |
11792 |
classScope, |
| 11744 |
fieldsFound, |
11793 |
fieldsFound, |
|
|
11794 |
fieldProposals, |
| 11745 |
localsFound, |
11795 |
localsFound, |
| 11746 |
staticsOnly, |
11796 |
staticsOnly, |
| 11747 |
invocationSite, |
11797 |
invocationSite, |
| 11748 |
invocationScope, |
11798 |
invocationScope, |
| 11749 |
true, |
11799 |
true, |