//array containing all the fields
IVariableBinding[] vb = b.getDeclaredFields();
//add all the global proposals within the array into the list.
for(int i = 0; i<vb.length; i++){
IVariableBinding temp = vb[i];
int modifier = temp.getModifiers();
//find out if the current type has been declared in the same package
//as the class where code completion has been called
boolean isSamePackage = false;
if(temp.getDeclaringClass().getPackage().equals(packageBinding)){
isSamePackage=true;
}
if(Modifier.isPublic(modifier)||(Modifier.isProtected(modifier)&&inherited)||(isSamePackage && !Modifier.isPrivate(modifier) && !Modifier.isProtected(modifier))){
VarProposal entry = new VarProposal(temp, name);