Use com.nomagic.magicdraw.uml.ElementIcon utility class for retrieving element icon. It also provides methods for retrieving icons by element metatype, stereotype and etc.
Element element = ...; //get element icon ResizableIcon icon = ElementIcon.getIcon(element); //get UML Package icon ResizableIcon packageIcon = ElementIcon.getIconByClassType(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Package.class);