if (database != null) {
OutlineElement[] elements = database.findTopLevelElements(replace);
for (int i = 0; i < elements.length; i++) {
if(VhdlInstanceCompletionProposal.canHandle(elements[i])) {
matchList.add(new VhdlInstanceCompletionProposal(doc,
elements[i], offset, length));
}
}
//look into packages
elements = database.findTopLevelElements("");
for (int i = 0; i < elements.length; i++) {
if(elements[i] instanceof PackageDeclElement){
OutlineElement[] subPackageElements=elements[i].getChildren();
for(int j=0; j< subPackageElements.length; j++){
if(VhdlInstanceCompletionProposal.canHandle(subPackageElements[j]) &&
subPackageElements[j].getName().toLowerCase().startsWith(replace.toLowerCase())){
matchList.add(new VhdlInstanceCompletionProposal(doc,
subPackageElements[j], offset, length));
}
}
}
}