parentObject instanceof SubProcess || parentObject instanceof Lane);
}
@Override
public Object[] create(ICreateContext context) {
AlfrescoUserTask newUserTask = new AlfrescoUserTask();
newUserTask.setId(getNextId(newUserTask));
newUserTask.setName("Alfresco User Task");
List<String> formTypes = PreferencesUtil.getStringArray(Preferences.ALFRESCO_FORMTYPES_USERTASK);
if (formTypes.size() > 0) {
newUserTask.setFormKey(formTypes.get(0));
}
Object parentObject = getBusinessObjectForPictogramElement(context.getTargetContainer());
if (parentObject instanceof SubProcess) {
((SubProcess) parentObject).addFlowElement(newUserTask);
} else if (parentObject instanceof Lane) {
final Lane lane = (Lane) parentObject;
lane.getFlowReferences().add(newUserTask.getId());
lane.getParentProcess().addFlowElement(newUserTask);
} else {
Bpmn2MemoryModel model = ModelHandler.getModel(EcoreUtil.getURI(getDiagram()));
if (model.getBpmnModel().getMainProcess() == null) {