* Find a Graphiti feature for given shape and generate necessary diagram elements.
*
* @param shape
*/
private void createShape(BPMNShape shape) {
BaseElement bpmnElement = shape.getBpmnElement();
if (shape.getChoreographyActivityShape() != null) {
// FIXME: we currently generate participant bands automatically
return;
}
IAddFeature addFeature = featureProvider.getAddFeature(new AddContext(new AreaContext(), bpmnElement));
if (addFeature == null) {
Activator.logStatus(new Status(IStatus.WARNING, Activator.PLUGIN_ID, "Element not supported: "
+ bpmnElement.eClass().getName()));
return;
}
AddContext context = new AddContext();
context.putProperty(IMPORT_PROPERTY, true);
context.setNewObject(bpmnElement);
context.setSize((int) shape.getBounds().getWidth(), (int) shape.getBounds().getHeight());
if (bpmnElement instanceof Lane) {
handleLane(bpmnElement, context, shape);
} else if (bpmnElement instanceof FlowNode) {
handleFlowNode((FlowNode) bpmnElement, context, shape);
} else {
context.setTargetContainer(diagram);
context.setLocation((int) shape.getBounds().getX(), (int) shape.getBounds().getY());
}
if (addFeature.canAdd(context)) {
PictogramElement newContainer = addFeature.add(context);
featureProvider.link(newContainer, new Object[] { bpmnElement, shape });
if (bpmnElement instanceof Participant) {
elements.put(((Participant) bpmnElement).getProcessRef(), newContainer);
}
elements.put(bpmnElement, newContainer);
handleEvents(bpmnElement, newContainer);
}
ModelUtil.addID(bpmnElement);
String id = bpmnElement.getId();
if (shape.getId() == null)
shape.setId(id);
if (!bpmnElement.eAdapters().contains(liveValidationContentAdapter)) {
bpmnElement.eAdapters().add(liveValidationContentAdapter);
}
}