*/
protected EObject selectExistingElement(IAdaptable host, Collection types) {
if (types.isEmpty()) {
return null;
}
IGraphicalEditPart editPart = (IGraphicalEditPart) host
.getAdapter(IGraphicalEditPart.class);
if (editPart == null) {
return null;
}
Diagram diagram = (Diagram) editPart.getRoot().getContents().getModel();
HashSet<EObject> elements = new HashSet<EObject>();
for (Iterator<EObject> it = diagram.getElement().eAllContents(); it
.hasNext();) {
EObject element = it.next();
if (isApplicableElement(element, types)) {