Package org.eclipse.graphiti.mm.pictograms

Examples of org.eclipse.graphiti.mm.pictograms.PictogramElement


    return TYPE_TEXT;
  }

  @Override
  public boolean canDirectEdit(IDirectEditingContext context) {
    PictogramElement pe = context.getPictogramElement();
    Object bo = getBusinessObjectForPictogramElement(pe);
    GraphicsAlgorithm ga = context.getGraphicsAlgorithm();
    // support direct editing, if it is a EClass, and the user clicked
    // directly on the text and not somewhere else in the rectangle
    if (bo instanceof AbstractNode && ga instanceof Text) {
View Full Code Here


    return false;
  }

  public String getInitialValue(IDirectEditingContext context) {
    // return the current name of the EClass
    PictogramElement pe = context.getPictogramElement();
    //EClass eClass = (EClass) getBusinessObjectForPictogramElement(pe);
    AbstractNode node = (AbstractNode)getBusinessObjectForPictogramElement(pe);
    //return eClass.getName();
    return node.getDisplayText();
  }
View Full Code Here

    return null;
  }

  public void setValue(String value, IDirectEditingContext context) {
    // set the new name for the EClass
    PictogramElement pe = context.getPictogramElement();
    //EClass eClass = (EClass) getBusinessObjectForPictogramElement(pe);
    Object bo = getBusinessObjectForPictogramElement(pe);
    if (bo instanceof Endpoint) {
      Endpoint ep = (Endpoint)getBusinessObjectForPictogramElement(pe);
      ep.setUri(value);
View Full Code Here

    } else if (input instanceof AbstractNodeFacade) {
      AbstractNodeFacade facade = (AbstractNodeFacade) input;
      answer = facade.getAbstractNode();
    } else if (input instanceof ContainerShapeEditPart) {
      ContainerShapeEditPart editPart = (ContainerShapeEditPart) input;
      PictogramElement element = editPart.getPictogramElement();
      if (Activator.getDiagramEditor() != null) {
        if (element != null && element instanceof Diagram) {
          // route selected - this makes properties view work when route is
          // selected in the diagram view
          answer = Activator.getDiagramEditor().getSelectedRoute() != null ? Activator.getDiagramEditor().getSelectedRoute() : Activator.getDiagramEditor().getModel();       
View Full Code Here

          this.designEditor.setSelectedRoute((RouteSupport)node.getParent());                     
        }
      }
    }
   
    PictogramElement pe = designEditor.getFeatureProvider().getPictogramElementForBusinessObject(node);
    if (pe == null) {
      Activator.getLogger().debug("Warning could not find PictogramElement for highlight node: " + node);
      return;
    }
   
View Full Code Here

  }

  public IReason updateNeeded(IUpdateContext context) {
    // retrieve name from pictogram model
    String pictogramName = null;
    PictogramElement pictogramElement = context.getPictogramElement();
    if (pictogramElement instanceof ContainerShape) {
      ContainerShape cs = (ContainerShape) pictogramElement;
      for (Shape shape : cs.getChildren()) {
        if (shape.getGraphicsAlgorithm() instanceof Text) {
          Text text = (Text) shape.getGraphicsAlgorithm();
View Full Code Here

   * @see org.eclipse.graphiti.func.IUpdate#update(org.eclipse.graphiti.features.context.IUpdateContext)
   */
  public boolean update(IUpdateContext context) {
    // retrieve name from business model
    String businessName = null;
    PictogramElement pictogramElement = context.getPictogramElement();
    Object bo = getBusinessObjectForPictogramElement(pictogramElement);
    if (bo instanceof AbstractNode) {
      AbstractNode eClass = (AbstractNode) bo;
      businessName = DiagramUtils.filterFigureLabel(eClass.getDisplayText());
    }
View Full Code Here

  }

  @Override
  protected void doExecute() {
    CreateNodeConnectionFeature feature = new CreateNodeConnectionFeature(editor.getFeatureProvider(), aClass);
    PictogramElement selectedElement = editor.getFeatureProvider().getPictogramElementForBusinessObject(selectedNode);
    PictogramElement[] selectedElements;
    if (selectedElement != null) {
      selectedElements = new PictogramElement[] {selectedElement};
    } else {
      Activator.getLogger().debug("==== TODO - could not find PictogramElement for node " + selectedNode + " probably its that the RiderOutlinePage is out of sync with the Diagram model!");
View Full Code Here

  @Override
  public void preDelete(IDeleteContext context) {
    super.preDelete(context);

    // now delete the BO from our model
    PictogramElement pe = context.getPictogramElement();
    Object[] businessObjectsForPictogramElement = getAllBusinessObjectsForPictogramElement(pe);
    if (businessObjectsForPictogramElement != null &&
        businessObjectsForPictogramElement.length > 0) {
      Object bo = businessObjectsForPictogramElement[0];
      if (bo instanceof Flow) {
View Full Code Here

    addContext.setLocation(x, y);
    addContext.setTargetContainer(getDiagram());

    // execute the add to diagram action
    IAddFeature addFeature = getFeatureProvider().getAddFeature(addContext);
    PictogramElement newNode = null;
    if (addFeature.canAdd(addContext)) {
      newNode = addFeature.add(addContext);
      if (newNode != null) {
        RouteSupport selectedRoute = Activator.getDiagramEditor().getSelectedRoute();
        if (selectedRoute != null) {
          selectedRoute.addChild(node);
        }
      }
    }

    PictogramElement srcState  = null;
    PictogramElement destState = null;
    if (!firstNode) {
      CreateFlowFeature createFeature = new CreateFlowFeature(getFeatureProvider());
      CreateConnectionContext connectContext = new CreateConnectionContext();
      srcState = context.getPictogramElements()[0];
      destState = getFeatureProvider().getPictogramElementForBusinessObject(node);
      if (srcState == destState) {
        Activator.getLogger().warning("Should not be the same element for different nodes: " + context.getPictogramElements()[0].getLink().getBusinessObjects().get(0) + " and " + node);
      }
      connectContext.setSourcePictogramElement(srcState);
      connectContext.setTargetPictogramElement(destState);
      Anchor srcAnchor = DiagramUtils.getAnchor(srcState);
      Anchor destAnchor = DiagramUtils.getAnchor(destState);
      if (destAnchor != null) {
        connectContext.setSourceAnchor(srcAnchor);
        connectContext.setTargetAnchor(destAnchor);
        if (createFeature.canCreate(connectContext)) {
          createFeature.execute(connectContext);
        }
      }
    }
   
    final PictogramElement dState = destState;
    final PictogramElement nNode = newNode;
     
    Display.getDefault().asyncExec(new Runnable() {
      @Override
      public void run() {
        RiderDesignEditor ed = Activator.getDiagramEditor();
View Full Code Here

TOP

Related Classes of org.eclipse.graphiti.mm.pictograms.PictogramElement

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.