Lines 1096-1221
Link Here
|
1096 |
this.actualSelectionEnd); |
1096 |
this.actualSelectionEnd); |
1097 |
} |
1097 |
} |
1098 |
this.acceptedAnswer = true; |
1098 |
this.acceptedAnswer = true; |
1099 |
} else |
1099 |
} else if (binding instanceof MethodBinding) { |
1100 |
if (binding instanceof MethodBinding) { |
1100 |
MethodBinding methodBinding = (MethodBinding) binding; |
1101 |
MethodBinding methodBinding = (MethodBinding) binding; |
1101 |
this.noProposal = false; |
1102 |
this.noProposal = false; |
|
|
1103 |
|
1102 |
|
1104 |
boolean isValuesOrValueOf = false; |
1103 |
boolean isValuesOrValueOf = false; |
1105 |
if(binding instanceof SyntheticMethodBinding) { |
1104 |
if(binding instanceof SyntheticMethodBinding) { |
1106 |
SyntheticMethodBinding syntheticMethodBinding = (SyntheticMethodBinding) binding; |
1105 |
SyntheticMethodBinding syntheticMethodBinding = (SyntheticMethodBinding) binding; |
1107 |
if(syntheticMethodBinding.purpose == SyntheticMethodBinding.EnumValues |
1106 |
if(syntheticMethodBinding.purpose == SyntheticMethodBinding.EnumValues |
1108 |
|| syntheticMethodBinding.purpose == SyntheticMethodBinding.EnumValueOf) { |
1107 |
|| syntheticMethodBinding.purpose == SyntheticMethodBinding.EnumValueOf) { |
1109 |
isValuesOrValueOf = true; |
1108 |
isValuesOrValueOf = true; |
1110 |
} |
|
|
1111 |
} |
1109 |
} |
|
|
1110 |
} |
1112 |
|
1111 |
|
1113 |
if(!isValuesOrValueOf && !methodBinding.isSynthetic()) { |
1112 |
if(!isValuesOrValueOf && !methodBinding.isSynthetic()) { |
1114 |
TypeBinding[] parameterTypes = methodBinding.original().parameters; |
1113 |
TypeBinding[] parameterTypes = methodBinding.original().parameters; |
1115 |
int length = parameterTypes.length; |
1114 |
int length = parameterTypes.length; |
1116 |
char[][] parameterPackageNames = new char[length][]; |
1115 |
char[][] parameterPackageNames = new char[length][]; |
1117 |
char[][] parameterTypeNames = new char[length][]; |
1116 |
char[][] parameterTypeNames = new char[length][]; |
1118 |
String[] parameterSignatures = new String[length]; |
1117 |
String[] parameterSignatures = new String[length]; |
1119 |
for (int i = 0; i < length; i++) { |
1118 |
for (int i = 0; i < length; i++) { |
1120 |
parameterPackageNames[i] = parameterTypes[i].qualifiedPackageName(); |
1119 |
parameterPackageNames[i] = parameterTypes[i].qualifiedPackageName(); |
1121 |
parameterTypeNames[i] = parameterTypes[i].qualifiedSourceName(); |
1120 |
parameterTypeNames[i] = parameterTypes[i].qualifiedSourceName(); |
1122 |
parameterSignatures[i] = new String(getSignature(parameterTypes[i])).replace('/', '.'); |
1121 |
parameterSignatures[i] = new String(getSignature(parameterTypes[i])).replace('/', '.'); |
|
|
1122 |
} |
1123 |
|
1124 |
TypeVariableBinding[] typeVariables = methodBinding.original().typeVariables; |
1125 |
length = typeVariables == null ? 0 : typeVariables.length; |
1126 |
char[][] typeParameterNames = new char[length][]; |
1127 |
char[][][] typeParameterBoundNames = new char[length][][]; |
1128 |
for (int i = 0; i < length; i++) { |
1129 |
TypeVariableBinding typeVariable = typeVariables[i]; |
1130 |
typeParameterNames[i] = typeVariable.sourceName; |
1131 |
if (typeVariable.firstBound == null) { |
1132 |
typeParameterBoundNames[i] = new char[0][]; |
1133 |
} else if (typeVariable.firstBound == typeVariable.superclass) { |
1134 |
int boundCount = 1 + (typeVariable.superInterfaces == null ? 0 : typeVariable.superInterfaces.length); |
1135 |
typeParameterBoundNames[i] = new char[boundCount][]; |
1136 |
typeParameterBoundNames[i][0] = typeVariable.superclass.sourceName; |
1137 |
for (int j = 1; j < boundCount; j++) { |
1138 |
typeParameterBoundNames[i][j] = typeVariables[i].superInterfaces[j - 1].sourceName; |
1139 |
} |
1140 |
} else { |
1141 |
int boundCount = typeVariable.superInterfaces == null ? 0 : typeVariable.superInterfaces.length; |
1142 |
typeParameterBoundNames[i] = new char[boundCount][]; |
1143 |
for (int j = 0; j < boundCount; j++) { |
1144 |
typeParameterBoundNames[i][j] = typeVariables[i].superInterfaces[j].sourceName; |
1145 |
} |
1123 |
} |
1146 |
} |
|
|
1147 |
} |
1124 |
|
1148 |
|
1125 |
TypeVariableBinding[] typeVariables = methodBinding.original().typeVariables; |
1149 |
ReferenceBinding declaringClass = methodBinding.declaringClass; |
1126 |
length = typeVariables == null ? 0 : typeVariables.length; |
1150 |
if (isLocal(declaringClass) && this.requestor instanceof SelectionRequestor) { |
1127 |
char[][] typeParameterNames = new char[length][]; |
1151 |
((SelectionRequestor)this.requestor).acceptLocalMethod(methodBinding); |
1128 |
char[][][] typeParameterBoundNames = new char[length][][]; |
1152 |
} else { |
1129 |
for (int i = 0; i < length; i++) { |
1153 |
this.requestor.acceptMethod( |
1130 |
TypeVariableBinding typeVariable = typeVariables[i]; |
1154 |
declaringClass.qualifiedPackageName(), |
1131 |
typeParameterNames[i] = typeVariable.sourceName; |
1155 |
declaringClass.qualifiedSourceName(), |
1132 |
if (typeVariable.firstBound == null) { |
1156 |
declaringClass.enclosingType() == null ? null : new String(getSignature(declaringClass.enclosingType())), |
1133 |
typeParameterBoundNames[i] = new char[0][]; |
1157 |
methodBinding.isConstructor() |
1134 |
} else if (typeVariable.firstBound == typeVariable.superclass) { |
1158 |
? declaringClass.sourceName() |
1135 |
int boundCount = 1 + (typeVariable.superInterfaces == null ? 0 : typeVariable.superInterfaces.length); |
1159 |
: methodBinding.selector, |
1136 |
typeParameterBoundNames[i] = new char[boundCount][]; |
1160 |
parameterPackageNames, |
1137 |
typeParameterBoundNames[i][0] = typeVariable.superclass.sourceName; |
1161 |
parameterTypeNames, |
1138 |
for (int j = 1; j < boundCount; j++) { |
1162 |
parameterSignatures, |
1139 |
typeParameterBoundNames[i][j] = typeVariables[i].superInterfaces[j - 1].sourceName; |
1163 |
typeParameterNames, |
1140 |
} |
1164 |
typeParameterBoundNames, |
|
|
1165 |
methodBinding.isConstructor(), |
1166 |
isDeclaration, |
1167 |
methodBinding.computeUniqueKey(), |
1168 |
this.actualSelectionStart, |
1169 |
this.actualSelectionEnd); |
1170 |
} |
1171 |
} |
1172 |
this.acceptedAnswer = true; |
1173 |
} else if (binding instanceof FieldBinding) { |
1174 |
FieldBinding fieldBinding = (FieldBinding) binding; |
1175 |
ReferenceBinding declaringClass = fieldBinding.declaringClass; |
1176 |
if (declaringClass != null) { // arraylength |
1177 |
this.noProposal = false; |
1178 |
if (isLocal(declaringClass) && this.requestor instanceof SelectionRequestor) { |
1179 |
((SelectionRequestor)this.requestor).acceptLocalField(fieldBinding); |
1180 |
} else { |
1181 |
// if the binding is a problem field binding, we want to make sure |
1182 |
// we can retrieve the closestMatch if the problem reason is NotVisible |
1183 |
FieldBinding currentFieldBinding = fieldBinding; |
1184 |
while (currentFieldBinding instanceof ProblemFieldBinding) { |
1185 |
ProblemFieldBinding problemFieldBinding = (ProblemFieldBinding) currentFieldBinding; |
1186 |
if (problemFieldBinding.problemId() == ProblemReasons.NotVisible) { |
1187 |
currentFieldBinding = problemFieldBinding.closestMatch; |
1141 |
} else { |
1188 |
} else { |
1142 |
int boundCount = typeVariable.superInterfaces == null ? 0 : typeVariable.superInterfaces.length; |
1189 |
currentFieldBinding = null; |
1143 |
typeParameterBoundNames[i] = new char[boundCount][]; |
|
|
1144 |
for (int j = 0; j < boundCount; j++) { |
1145 |
typeParameterBoundNames[i][j] = typeVariables[i].superInterfaces[j].sourceName; |
1146 |
} |
1147 |
} |
1190 |
} |
1148 |
} |
1191 |
} |
1149 |
|
1192 |
char[] fieldName = null; |
1150 |
ReferenceBinding declaringClass = methodBinding.declaringClass; |
1193 |
char[] key = null; |
1151 |
if (isLocal(declaringClass) && this.requestor instanceof SelectionRequestor) { |
1194 |
if (currentFieldBinding != null) { |
1152 |
((SelectionRequestor)this.requestor).acceptLocalMethod(methodBinding); |
1195 |
fieldName = currentFieldBinding.name; |
|
|
1196 |
key = currentFieldBinding.computeUniqueKey(); |
1153 |
} else { |
1197 |
} else { |
1154 |
this.requestor.acceptMethod( |
1198 |
fieldName = fieldBinding.name; |
1155 |
declaringClass.qualifiedPackageName(), |
1199 |
key = fieldBinding.computeUniqueKey(); |
1156 |
declaringClass.qualifiedSourceName(), |
|
|
1157 |
declaringClass.enclosingType() == null ? null : new String(getSignature(declaringClass.enclosingType())), |
1158 |
methodBinding.isConstructor() |
1159 |
? declaringClass.sourceName() |
1160 |
: methodBinding.selector, |
1161 |
parameterPackageNames, |
1162 |
parameterTypeNames, |
1163 |
parameterSignatures, |
1164 |
typeParameterNames, |
1165 |
typeParameterBoundNames, |
1166 |
methodBinding.isConstructor(), |
1167 |
isDeclaration, |
1168 |
methodBinding.computeUniqueKey(), |
1169 |
this.actualSelectionStart, |
1170 |
this.actualSelectionEnd); |
1171 |
} |
1200 |
} |
|
|
1201 |
this.requestor.acceptField( |
1202 |
declaringClass.qualifiedPackageName(), |
1203 |
declaringClass.qualifiedSourceName(), |
1204 |
fieldName, |
1205 |
false, |
1206 |
key, |
1207 |
this.actualSelectionStart, |
1208 |
this.actualSelectionEnd); |
1172 |
} |
1209 |
} |
1173 |
this.acceptedAnswer = true; |
1210 |
this.acceptedAnswer = true; |
1174 |
} else |
1211 |
} |
1175 |
if (binding instanceof FieldBinding) { |
1212 |
} else if (binding instanceof LocalVariableBinding) { |
1176 |
FieldBinding fieldBinding = (FieldBinding) binding; |
1213 |
if (this.requestor instanceof SelectionRequestor) { |
1177 |
ReferenceBinding declaringClass = fieldBinding.declaringClass; |
1214 |
((SelectionRequestor)this.requestor).acceptLocalVariable((LocalVariableBinding)binding); |
1178 |
if (declaringClass != null) { // arraylength |
1215 |
this.acceptedAnswer = true; |
1179 |
this.noProposal = false; |
1216 |
} else { |
1180 |
if (isLocal(declaringClass) && this.requestor instanceof SelectionRequestor) { |
1217 |
// open on the type of the variable |
1181 |
((SelectionRequestor)this.requestor).acceptLocalField(fieldBinding); |
1218 |
selectFrom(((LocalVariableBinding) binding).type, parsedUnit, false); |
1182 |
} else { |
1219 |
} |
1183 |
this.requestor.acceptField( |
1220 |
} else if (binding instanceof ArrayBinding) { |
1184 |
declaringClass.qualifiedPackageName(), |
1221 |
selectFrom(((ArrayBinding) binding).leafComponentType, parsedUnit, false); |
1185 |
declaringClass.qualifiedSourceName(), |
1222 |
// open on the type of the array |
1186 |
fieldBinding.name, |
1223 |
} else if (binding instanceof PackageBinding) { |
1187 |
false, |
1224 |
PackageBinding packageBinding = (PackageBinding) binding; |
1188 |
fieldBinding.computeUniqueKey(), |
1225 |
this.noProposal = false; |
1189 |
this.actualSelectionStart, |
1226 |
this.requestor.acceptPackage(packageBinding.readableName()); |
1190 |
this.actualSelectionEnd); |
1227 |
this.acceptedAnswer = true; |
1191 |
} |
1228 |
} else if(binding instanceof BaseTypeBinding) { |
1192 |
this.acceptedAnswer = true; |
1229 |
this.acceptedAnswer = true; |
1193 |
} |
1230 |
} |
1194 |
} else |
|
|
1195 |
if (binding instanceof LocalVariableBinding) { |
1196 |
if (this.requestor instanceof SelectionRequestor) { |
1197 |
((SelectionRequestor)this.requestor).acceptLocalVariable((LocalVariableBinding)binding); |
1198 |
this.acceptedAnswer = true; |
1199 |
} else { |
1200 |
// open on the type of the variable |
1201 |
selectFrom(((LocalVariableBinding) binding).type, parsedUnit, false); |
1202 |
} |
1203 |
} else |
1204 |
if (binding instanceof ArrayBinding) { |
1205 |
selectFrom(((ArrayBinding) binding).leafComponentType, parsedUnit, false); |
1206 |
// open on the type of the array |
1207 |
} else |
1208 |
if (binding instanceof PackageBinding) { |
1209 |
PackageBinding packageBinding = (PackageBinding) binding; |
1210 |
this.noProposal = false; |
1211 |
this.requestor.acceptPackage(packageBinding.readableName()); |
1212 |
this.acceptedAnswer = true; |
1213 |
} else |
1214 |
if(binding instanceof BaseTypeBinding) { |
1215 |
this.acceptedAnswer = true; |
1216 |
} |
1217 |
} |
1231 |
} |
1218 |
|
|
|
1219 |
/* |
1232 |
/* |
1220 |
* Checks if a local declaration got selected in this method/initializer/field. |
1233 |
* Checks if a local declaration got selected in this method/initializer/field. |
1221 |
*/ |
1234 |
*/ |