Q: How can I display context menu for diagram elements when they are clicked with right mouse button?

A: Implement DiagramListener.nodeClicked (or linkClicked for links) and show a JMenuPopup, for example:

public void nodeClicked(NodeEvent e)
	final DiagramNode node = e.getNode();
	if (e.getMouseButton() == MouseEvent.BUTTON3)
		JPopupMenu menu = new JPopupMenu();
		menu.add("Delete").addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent actionEvent)
		Point p = diagramView.docToDevice(e.getMousePosition());
		menu.show(diagramView, p.x, p.y);