Package org.eclipse.graphiti.mm.pictograms

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


   *
   * @return CompoundDirectedGraph that can be layouted
   */
  private CompoundDirectedGraph mapDiagramToGraph() {
    Map<AnchorContainer, Node> shapeToNode = new HashMap<AnchorContainer, Node>();
    Diagram d = getDiagram();
    CompoundDirectedGraph dg = new CompoundDirectedGraph();
    EdgeList edgeList = new EdgeList();
    NodeList nodeList = new NodeList();
    EList<Shape> children = d.getChildren();
    for (Shape shape : children) {
      Node node = new Node();
      GraphicsAlgorithm ga = shape.getGraphicsAlgorithm();
      node.x = ga.getX();
      node.y = ga.getY();
      node.width = ga.getWidth();
      node.height = ga.getHeight();
      node.data = shape;
      shapeToNode.put(shape, node);
      nodeList.add(node);
    }
    EList<Connection> connections = d.getConnections();
    for (Connection connection : connections) {
     
      //Be wary about broken connections
      AnchorContainer source = null;
      if (connection.getStart() != null) {
View Full Code Here


   */
  public PictogramElement add(IAddContext context) {

    LocalVariableStatement addedVar =
        (LocalVariableStatement) context.getNewObject();
    Diagram targetDiagram = (Diagram) context.getTargetContainer();

    // CONTAINER SHAPE WITH ROUNDED RECTANGLE
    IPeCreateService peCreateService = Graphiti.getPeCreateService();
    ContainerShape containerShape =
        peCreateService.createContainerShape(targetDiagram, true);
View Full Code Here

  }


  private CompoundDirectedGraph mapDiagramToGraph() {
    Map<AnchorContainer, Node> shapeToNode = new HashMap<AnchorContainer, Node>();
    Diagram d = getDiagram();
    CompoundDirectedGraph dg = new CompoundDirectedGraph();
    EdgeList edgeList = new EdgeList();
    NodeList nodeList = new NodeList();
    EList<Shape> children = d.getChildren();
    for (Shape shape : children) {
      Node node = new Node();
      GraphicsAlgorithm ga = shape.getGraphicsAlgorithm();
      node.x = ga.getX();
      node.y = ga.getY();
      node.width = ga.getWidth();
      node.height = ga.getHeight();
      node.data = shape;
      shapeToNode.put(shape, node);
      nodeList.add(node);
    }
    EList<Connection> connections = d.getConnections();
    for (Connection connection : connections) {
      AnchorContainer source = connection.getStart().getParent();
      AnchorContainer target = connection.getEnd().getParent();
      Edge edge = new Edge(shapeToNode.get(source), shapeToNode.get(target));
      edge.data = connection;
View Full Code Here

    //        return;
    //      }
    //    }
    // if we have no pictogramLinks -> no
    // references to bo's -> don't handle change events
    Diagram diagram = getDiagramTypeProvider().getDiagram();
    if (diagram != null) {
      if (diagram.getPictogramLinks().size() == 0) {
        return;
      }
    }

    // Compute changed BOs.
View Full Code Here

  }

  public void paste(IPasteContext context) {
    // we already verified, that we paste directly in the diagram
    PictogramElement[] pes = context.getPictogramElements();
    Diagram diagram = (Diagram) pes[0];
    // get the EClasses from the clipboard without copying them
    // (only copy the pictogram element, not the business object)
    // then create new pictogram elements using the add feature
    Object[] objects = getFromClipboard();
    for (Object object : objects) {
View Full Code Here

    }
  }

  protected static synchronized TransactionalEditingDomain createEditingDomain(RiderDesignEditor designEditor) {
    TransactionalEditingDomain editingDomain = designEditor.getEditingDomain();
    Diagram diagram = designEditor.getDiagram();
    if (diagram == null) {
      return null;
    }
    if (editingDomain == null) {
      IDiagramBehavior diagramBehavior = designEditor.getDiagramTypeProvider().getDiagramBehavior();
      if (diagramBehavior != null) {
        editingDomain = diagramBehavior.getEditingDomain();
      }
    }
    if (editingDomain == null) {
      ResourceSet resourceSet = null;
      Resource eResource = diagram.eResource();
      if (eResource != null) {
        resourceSet = eResource.getResourceSet();
      }
      if (resourceSet == null) {
        resourceSet = new ResourceSetImpl();
View Full Code Here

  @Override
  public Object[] create(ICreateContext context) {
    AbstractNode node = createNode();

    RouteSupport selectedRoute = Activator.getDiagramEditor().getSelectedRoute();
    Diagram diagram = getDiagram();

    if (selectedRoute != null) {
      selectedRoute.addChild(node);
    } else {
      Activator.getLogger().warning("Warning! Could not find currently selectedNode, so can't associate this node with the route!: " + node);
View Full Code Here

   */
  @Override
  public PictogramElement add(IAddContext context) {
    final AbstractNode addedClass = (AbstractNode) context.getNewObject();
    //    final EClass addedClass = (EClass) context.getNewObject();
    final Diagram targetDiagram = (Diagram) context.getTargetContainer();

    // CONTAINER SHAPE WITH ROUNDED RECTANGLE
    final IPeCreateService peCreateService = Graphiti.getPeCreateService();
    final ContainerShape containerShape = peCreateService.createContainerShape(targetDiagram, true);

View Full Code Here

      if (graphicalViewer != null
          && graphicalViewer.getEditPartRegistry() != null) {
        ScalableFreeformRootEditPart rootEditPart = (ScalableFreeformRootEditPart) graphicalViewer.getEditPartRegistry().get(LayerManager.ID);
        IFigure gridFigure = ((LayerManager) rootEditPart).getLayer(LayerConstants.GRID_LAYER);
        IColorConstant cc = StyleUtil.getColorConstant(PreferenceManager.getInstance().loadPreferenceAsString(PreferencesConstants.EDITOR_GRID_COLOR));
        Diagram diagram = designEditor.getDiagram();
        if (cc != null && diagram != null) {
          GraphicsAlgorithm ga = diagram.getGraphicsAlgorithm();
          if (ga != null){
            ga.setForeground(GraphitiUi.getGaService().manageColor(diagram, cc));
            gridFigure.repaint();
            gridFigure.revalidate();
            designEditor.getDiagramBehavior().refreshContent();
View Full Code Here

  public DiagramEditorInput createDiagram(boolean openEditor) throws CoreException {
    if (diagramFolder != null && !diagramFolder.exists()) {
      diagramFolder.create(false, true, null);
    }

    final Diagram diagram = Graphiti.getPeCreateService().createDiagram("BPMN2",
        diagramFile.getFullPath().removeFileExtension().lastSegment(), true);
    uri = URI.createPlatformResourceURI(diagramFile.getFullPath().toString(), true);

    TransactionalEditingDomain domain = FileService.createEmfFileForDiagram(uri, diagram);

    String providerId = GraphitiUi.getExtensionManager().getDiagramTypeProviderId(diagram.getDiagramTypeId());
    final DiagramEditorInput editorInput = new Bpmn2DiagramEditorInput(EcoreUtil.getURI(diagram), domain,
        providerId);

    if (openEditor) {
      openEditor(editorInput);
View Full Code Here

TOP

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

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.