*/
public void mouseClicked(EditorMouseEvent e) {
double mx = e.getX(), my = e.getY();
// this is a pretty ugly cast, it is needed in order to use the getLabel()
// method which is not a base DiagramElement method
UmlDiagramElement previousSelected = (UmlDiagramElement)
currentSelection.getElement();
UmlDiagramElement element = (UmlDiagramElement)
editor.getDiagram().getChildAt(mx, my);
if (element != NullElement.getInstance() && previousSelected == element) {
editor.editLabel(element.getLabelAt(mx, my));
} else if (editor.getDiagram().getLabelAt(mx, my) != null) {
// Edit the diagram name
editor.editLabel(editor.getDiagram().getLabelAt(mx, my));
} else {
currentSelection = element.getSelection(editor);
}
editor.repaint();
notifyListeners();
}