IDiagramGraphicalViewer viewer = (IDiagramGraphicalViewer) diagramPart
.getViewer();
final int intialNumOfEditParts = editPartCollector.size();
if (element instanceof View) { // support notation element lookup
EditPart editPart = (EditPart) viewer.getEditPartRegistry().get(
element);
if (editPart != null) {
editPartCollector.add(editPart);
return 1;
}
}
String elementID = EMFCoreUtil.getProxyID(element);
List associatedParts = viewer.findEditPartsForElement(elementID,
IGraphicalEditPart.class);
// perform the possible hierarchy disjoint -> take the top-most parts only
for (Iterator editPartIt = associatedParts.iterator(); editPartIt
.hasNext();) {
EditPart nextPart = (EditPart) editPartIt.next();
EditPart parentPart = nextPart.getParent();
while (parentPart != null && !associatedParts.contains(parentPart)) {
parentPart = parentPart.getParent();
}
if (parentPart == null) {
editPartCollector.add(nextPart);
}
}