start, end);
if(type != null) {
try {
IField[] fields = type.getFields();
for (int i = 0; i < fields.length; i++) {
IField field = fields[i];
ISourceRange range = field.getNameRange();
if(range.getOffset() <= start
&& range.getOffset() + range.getLength() >= end
&& field.getElementName().equals(new String(name))) {
addElement(fields[i]);
if(SelectionEngine.DEBUG){
System.out.print("SELECTION - accept field("); //$NON-NLS-1$
System.out.print(field.toString());
System.out.println(")"); //$NON-NLS-1$
}
return; // only one method is possible
}
}
} catch (JavaModelException e) {
return;
}
}
} else {
IType type= resolveType(declaringTypePackageName, declaringTypeName, NameLookup.ACCEPT_ALL);
if (type != null) {
IField field= type.getField(new String(name));
if (field.exists()) {
if (uniqueKey != null) {
if(field.isBinary()) {
ResolvedBinaryField resolvedField = new ResolvedBinaryField(
(JavaElement)field.getParent(),
field.getElementName(),
new String(uniqueKey));
resolvedField.occurrenceCount = field.getOccurrenceCount();
field = resolvedField;
} else {
ResolvedSourceField resolvedField = new ResolvedSourceField(
(JavaElement)field.getParent(),
field.getElementName(),
new String(uniqueKey));
resolvedField.occurrenceCount = field.getOccurrenceCount();
field = resolvedField;
}
}
addElement(field);
if(SelectionEngine.DEBUG){
System.out.print("SELECTION - accept field("); //$NON-NLS-1$
System.out.print(field.toString());
System.out.println(")"); //$NON-NLS-1$
}
}
}
}