private void printDeclaration(StringBuilder ptn,
Declaration declaration, boolean fullyQualified,
Unit unit) {
// type parameters are not fully qualified
if (fullyQualified && !(declaration instanceof TypeParameter)) {
Scope container = declaration.getContainer();
while(container != null
&& container instanceof Package == false
&& container instanceof Declaration == false){
container = container.getContainer();
}
if(container != null){
if(container instanceof Package){
String q = container.getQualifiedNameString();
if(!q.isEmpty())
ptn.append(q).append("::");
}else{
printDeclaration(ptn, (Declaration) container,
fullyQualified, unit);