Package org.eclipse.bpmn2.modeler.core

Examples of org.eclipse.bpmn2.modeler.core.ModelHandler


    }

  }

  protected void createDIEdge(Connection connection, BaseElement conElement, BPMNEdge edge) throws IOException {
    ModelHandler modelHandler = ModelHandlerLocator.getModelHandler(getDiagram().eResource());
    if (edge == null) {
      EList<EObject> businessObjects = Graphiti.getLinkService().getLinkForPictogramElement(getDiagram())
          .getBusinessObjects();
      for (EObject eObject : businessObjects) {
        if (eObject instanceof BPMNDiagram) {
          BPMNDiagram bpmnDiagram = (BPMNDiagram) eObject;

          edge = BpmnDiFactory.eINSTANCE.createBPMNEdge();
//          edge.setId(EcoreUtil.generateUUID());
          edge.setBpmnElement(conElement);

          if (conElement instanceof Association) {
            edge.setSourceElement(modelHandler.findDIElement(getDiagram(),
                ((Association) conElement).getSourceRef()));
            edge.setTargetElement(modelHandler.findDIElement(getDiagram(),
                ((Association) conElement).getTargetRef()));
          } else if (conElement instanceof MessageFlow) {
            edge.setSourceElement(modelHandler.findDIElement(getDiagram(),
                (BaseElement) ((MessageFlow) conElement).getSourceRef()));
            edge.setTargetElement(modelHandler.findDIElement(getDiagram(),
                (BaseElement) ((MessageFlow) conElement).getTargetRef()));
          } else if (conElement instanceof SequenceFlow) {
            edge.setSourceElement(modelHandler.findDIElement(getDiagram(),
                ((SequenceFlow) conElement).getSourceRef()));
            edge.setTargetElement(modelHandler.findDIElement(getDiagram(),
                ((SequenceFlow) conElement).getTargetRef()));
          }

          ILocation sourceLoc = Graphiti.getPeService().getLocationRelativeToDiagram(connection.getStart());
          ILocation targetLoc = Graphiti.getPeService().getLocationRelativeToDiagram(connection.getEnd());
View Full Code Here


  @Override
  public Object[] create(ICreateContext context) {
    BaseElement element = null;
    try {
      ModelHandler handler = ModelHandlerLocator.getModelHandler(getDiagram().eResource());
      element = add(context.getTargetContainer(), handler);
    } catch (IOException e) {
      Activator.logError(e);
    }
    addGraphicalRepresentation(context, element);
View Full Code Here

  @Override
    public Object[] create(ICreateContext context) {
    RootElement element = null;
   
    try {
      ModelHandler handler = ModelHandlerLocator.getModelHandler(getDiagram().eResource());
      element = createRootElement();
//      element.setId(EcoreUtil.generateUUID());
      handler.addRootElement(element);
    } catch (IOException e) {
      Activator.logError(e);
    }

    addGraphicalRepresentation(context, element);
View Full Code Here

  @Override
  public Object[] create(ICreateContext context) {
    T element = null;
    try {
      ModelHandler handler = ModelHandler.getInstance(getDiagram());
      element = createFlowElement(context);
//      element.setId(EcoreUtil.generateUUID());
      if (FeatureSupport.isTargetLane(context) && element instanceof FlowNode) {
        ((FlowNode) element).getLanes().add(
            (Lane) getBusinessObjectForPictogramElement(context.getTargetContainer()));
      }

      handler.addFlowElement(getBusinessObjectForPictogramElement(context.getTargetContainer()), element);
    } catch (IOException e) {
      Activator.logError(e);
    }
    addGraphicalRepresentation(context, element);
    ModelUtil.setID(element);
View Full Code Here

  private void modifyModelStructure(IMoveShapeContext context) {
    Lane parentLane = (Lane) getBusinessObjectForPictogramElement(context.getSourceContainer());
    Lane movedLane = (Lane) getBusinessObjectForPictogramElement(context.getShape());
    parentLane.getChildLaneSet().getLanes().remove(movedLane);
    try {
      ModelHandler mh = ModelHandler.getInstance(getDiagram());
      mh.laneToTop(movedLane);
    } catch (IOException e) {
      Activator.logError(e);
    }
  }
View Full Code Here

  @Override
  public Object[] create(ICreateContext context) {
    Artifact artifact = null;
    try {
      ModelHandler handler = ModelHandler.getInstance(getDiagram());
      artifact = createArtifact(context);
      handler.addArtifact(FeatureSupport.getTargetParticipant(context, handler), artifact);
    } catch (IOException e) {
      Activator.logError(e);
    }
    addGraphicalRepresentation(context, artifact);
    return new Object[] { artifact };
View Full Code Here

    if (!(getBusinessObjectForPictogramElement(context.getShape()) instanceof FlowNode)) {
      return false;
    }

    try {
      ModelHandler handler = ModelHandler.getInstance(getDiagram());

      algorithmContainer = getAlgorithmContainer(context);

      if (algorithmContainer.isEmpty()) {
        return onMoveAlgorithmNotFound(context);
View Full Code Here

  }

  @Override
  protected void postMoveShape(IMoveShapeContext context) {
    try {
      ModelHandler handler = ModelHandler.getInstance(getDiagram());
      Object[] node = getAllBusinessObjectsForPictogramElement(context.getShape());
      for (Object object : node) {
        if (object instanceof FlowNode && !algorithmContainer.isEmpty()) {
          algorithmContainer.move(((FlowNode) object), getSourceBo(context, handler),
              getTargetBo(context, handler));
View Full Code Here

    }

    @Override
    public void move(FlowNode node, Object source, Object target) {
      try {
        ModelHandler handler = ModelHandler.getInstance(getDiagram());
        handler.moveFlowNode(node, source, target);
      } catch (IOException e) {
        Activator.logError(e);
      }
    }
View Full Code Here

      targetLane.setChildLaneSet(createLaneSet);
      ModelUtil.setID(createLaneSet);
    }

    try {
      ModelHandler handler = ModelHandler.getInstance(getDiagram());
      Participant sourceParticipant = handler.getParticipant(sourceLane);
      Participant targetParticipant = handler.getParticipant(targetLane);
      if (!sourceParticipant.equals(targetParticipant)) {
        handler.moveLane(movedLane, sourceParticipant, targetParticipant);
      }
    } catch (IOException e) {
      Activator.logError(e);
    }
View Full Code Here

TOP

Related Classes of org.eclipse.bpmn2.modeler.core.ModelHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.