protected Task createFlowElement(ICreateContext context) { Task task = ModelHandler.FACTORY.createTask(); task.setName("Email Task"); ArrayList<EStructuralFeature> attributes = Bpmn2Preferences.getAttributes(task.eClass()); for (EStructuralFeature eStructuralFeature : attributes) { if (eStructuralFeature.getName().equals("taskName")) task.eSet(eStructuralFeature, "email"); } return task; }
private void modifyModelStructure(IMoveShapeContext context) { Lane movedLane = getMovedLane(context); Participant sourceParticipant = (Participant) getBusinessObjectForPictogramElement(context.getSourceContainer()); Participant internalParticipant = null; try { ModelHandler handler = ModelHandler.getInstance(getDiagram()); internalParticipant = handler.getInternalParticipant(); handler.moveLane(movedLane, internalParticipant); } catch (IOException e) { Activator.logError(e); } LaneSet laneSet = null; for (LaneSet set : sourceParticipant.getProcessRef().getLaneSets()) { if (set.getLanes().contains(movedLane)) { laneSet = set; break; } } if (laneSet != null) { laneSet.getLanes().remove(movedLane); if (laneSet.getLanes().isEmpty()) { sourceParticipant.getProcessRef().getLaneSets().remove(laneSet); } Process process = internalParticipant.getProcessRef(); if (process.getLaneSets().isEmpty()) { LaneSet createLaneSet = ModelHandler.FACTORY.createLaneSet(); // createLaneSet.setId(EcoreUtil.generateUUID()); process.getLaneSets().add(createLaneSet); ModelUtil.setID(createLaneSet); } process.getLaneSets().get(0).getLanes().add(movedLane); } }