List Elements of Diagram

Can somebody explain where I have to start if I want to show a list of
the elements in a Diagram.

For example suppose I want to list the classes of a class diagram.

From the examples I can only see how to show names of (by mouse) selected elements.
I can reproduce that.

I was looking in the area of the children of IDiagramUIModel, but no success up till now.

Any help would be appreciated.


Hi Dave

Maybe following code snippet gives you an idea how to do it:

Iterator diagramIterator = ApplicationManager.instance().getProjectManager().getProject().diagramIterator();
IDiagramUIModel diagram;
while (diagramIterator.hasNext()) {
    Object object =;
    if(object instanceof IDiagramUIModel)){
		diagram = (IDiagramUIModel) object;
		IDiagramElement[] allElements = diagram.toDiagramElementArray(); // all diagram elements to an array
		//IDiagramElement[] tasks = diagram.toDiagramElementArray(IModelElementFactory.MODEL_TYPE_BP_TASK); // only BPMN gateways
		//IDiagramElement[] subprocs = diagram.toDiagramElementArray(IModelElementFactory.MODEL_TYPE_BP_SUB_PROCESS); // only BPMN sub processes
		//IDiagramElement[] startEvents = diagram.toDiagramElementArray(IModelElementFactory.MODEL_TYPE_BP_START_EVENT); // only BPMN start events
		//IDiagramElement[] interEvents = diagram.toDiagramElementArray(IModelElementFactory.MODEL_TYPE_BP_INTERMEDIATE_EVENT); // only BPMN interm. events
		//IDiagramElement[] endEvents = diagram.toDiagramElementArray(IModelElementFactory.MODEL_TYPE_BP_END_EVENT); // only BPMN end events
		ApplicationManager.instance().getViewManager().showMessage("Child element listing of the "+diagram.getName()+ " diagram:");
		// do something with the elements, e.g. list them
		for (IDiagramElement diagramElement : allElements){
			ApplicationManager.instance().getViewManager().showMessage("Element name:");
			ApplicationManager.instance().getViewManager().showMessage("Element documentation:");

Kind regards