Every com.nomagic.magicdraw.uml.symbols.PresentationElement can access selected elements or change their own selection status.

Collecting selected presentation elements in a diagram

    Project project = ; 
    DiagramPresentationElement diagram = project.getActiveDiagram(); 
    List<PresentationElement> selected = diagram.getSelected();

Selecting element in a diagram

    presentationElement.setSelected(true);

Presentation element selection events page describes selection change events