Examples of ModelHandler


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

  }

  @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

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

    }

    @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

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

      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

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

    return top.anchor;
  }

  public static void reConnect(BPMNShape shape, Diagram diagram) {
    try {
      ModelHandler handler = ModelHandler.getInstance(diagram);
      for (BPMNEdge bpmnEdge : handler.getAll(BPMNEdge.class)) {
        DiagramElement sourceElement = bpmnEdge.getSourceElement();
        DiagramElement targetElement = bpmnEdge.getTargetElement();
        if (sourceElement != null && targetElement != null) {
          boolean sourceMatches = sourceElement.getId().equals(shape.getId());
          boolean targetMatches = targetElement.getId().equals(shape.getId());
View Full Code Here

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

    }
  }

  public static void updateDIEdge(Diagram diagram, Connection connection, Class clazz) {
    try {
      ModelHandler modelHandler = ModelHandlerLocator.getModelHandler(connection.getLink().getBusinessObjects()
          .get(0).eResource());

      EObject be = BusinessObjectUtil.getFirstElementOfType(connection, clazz);
      BPMNEdge edge = (BPMNEdge) modelHandler.findDIElement(diagram, (BaseElement) be);
      Point point = DcFactory.eINSTANCE.createPoint();

      List<Point> waypoint = edge.getWaypoint();
      waypoint.clear();
View Full Code Here

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

  @Override
  public Connection create(ICreateConnectionContext context) {
    try {
      A source = getSourceBo(context);
      B target = getTargetBo(context);
      ModelHandler mh = ModelHandler.getInstance(getDiagram());
      AddConnectionContext addContext = new AddConnectionContext(context.getSourceAnchor(),
          context.getTargetAnchor());
      BaseElement flow = createFlow(mh, source, target);
//      flow.setId(EcoreUtil.generateUUID());
      addContext.setNewObject(flow);
View Full Code Here

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

      if (source == null || target == null) {
        return true;
      }
      boolean different = false;
      try {
        ModelHandler handler = ModelHandler.getInstance(getDiagram());
        Participant sourceParticipant = handler.getParticipant(source);
        Participant targetParticipant = handler.getParticipant(target);
        different = !sourceParticipant.equals(targetParticipant);
      } catch (IOException e) {
        Activator.logError(e);
      }
      return different;
View Full Code Here

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

  @Override
  public Object[] create(ICreateContext context) {
    BoundaryEvent event = null;
    try {
      Activity activity = (Activity) getBusinessObjectForPictogramElement(context.getTargetContainer());
      ModelHandler handler = ModelHandler.getInstance(getDiagram());
      event = ModelHandler.FACTORY.createBoundaryEvent();
//      event.setId(EcoreUtil.generateUUID());
      event.setAttachedToRef(activity);
      event.setName("Boundary event");
      event.setCancelActivity(true); // by default is interrupting
      Object bo = getBusinessObjectForPictogramElement(context.getTargetContainer());
      if (bo instanceof FlowElementsContainer) {
        bo = getBusinessObjectForPictogramElement((PictogramElement) context.getTargetContainer().eContainer());
      }
      handler.addFlowElement(bo, event);
    } catch (IOException e) {
      Activator.logError(e);
    }
    addGraphicalRepresentation(context, event);
    ModelUtil.setID(event);
View Full Code Here

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

  public void selectionChanged(IWorkbenchPart part, ISelection selection) {

    if (part instanceof BPMN2Editor) {
      editor = (BPMN2Editor) part;
      try {
        ModelHandler modelHandler = ModelHandlerLocator.getModelHandler(editor.getDiagramTypeProvider()
            .getDiagram().eResource());
        contentProvider.updateModel(modelHandler);
        viewer.refresh(true);
      } catch (IOException e) {
        e.printStackTrace();
View Full Code Here

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

  public void removeBendpoint(IRemoveBendpointContext context) {
      super.removeBendpoint(context);
      try {
      FreeFormConnection connection = context.getConnection();
      BaseElement element = (BaseElement) BusinessObjectUtil.getFirstElementOfType(connection, BaseElement.class);
      ModelHandler modelHandler = ModelHandlerLocator.getModelHandler(getDiagram().eResource());
      BPMNEdge edge = (BPMNEdge) modelHandler.findDIElement(getDiagram(), element);
      edge.getWaypoint().remove(context.getBendpointIndex() + 1);
    } catch (Exception e) {
      Activator.logError(e);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.