protected PictogramElement findPictogramElement(String id) { PictogramElement pictogramElement = null; if (id != null) { BaseElement be = bpmn2Editor.getModelHandler().findElement(id); List<PictogramElement> pes = Graphiti.getLinkService() .getPictogramElements(bpmn2Editor.getDiagramTypeProvider().getDiagram(), be); for (PictogramElement pe : pes) { if (pe instanceof ContainerShape) { pictogramElement = pe; } else if (pe instanceof FreeFormConnection) { pictogramElement = pe; } } } return pictogramElement; }
@Override protected void handlePostSelectionChanged(SelectionChangedEvent event) { ISelectionProvider parentProvider = getMultiPageEditor().getSite().getSelectionProvider(); // make sure the selected PictogramElement is still on the same Diagram as the // one currently being displayed - this event can happen after a page switch. Diagram currentDiagram = bpmn2Editor.getDiagramTypeProvider().getDiagram(); PictogramElement pe = BusinessObjectUtil.getPictogramElementForSelection(event.getSelection()); try { Diagram peDiagram = Graphiti.getPeService().getDiagramForPictogramElement(pe); if (currentDiagram != peDiagram) return; } catch (Exception e) { // if PictogramElements were deleted, there will be an NPE when searching for // the PEs parent diagram return; } if (parentProvider instanceof MultiPageSelectionProvider) { SelectionChangedEvent newEvent = getNewEvent(parentProvider, event); MultiPageSelectionProvider prov = (MultiPageSelectionProvider) parentProvider; prov.firePostSelectionChanged(newEvent); } }