Package org.eclipse.sapphire.ui.swt.gef.model

Examples of org.eclipse.sapphire.ui.swt.gef.model.DiagramModel


  }

  public DiagramPagePresentation getPresentation()
  {
    if (getModel() instanceof DiagramModel) {
      DiagramModel diagramModel = (DiagramModel)getModel();
      return diagramModel.getPresentation();
    }
    return null;
  }
View Full Code Here


  protected void configureGraphicalViewer()
  {
    super.configureGraphicalViewer();
    GraphicalViewer viewer = getGraphicalViewer();   
        this.diagramPresentation = new DiagramPagePresentation(this.part, this.configManager, viewer.getControl().getShell());
        this.diagramModel = new DiagramModel(this.diagramPresentation);   
           
    viewer.setEditPartFactory(new SapphireDiagramEditorEditPartFactory(getConfigurationManager()));
   
    viewer.setRootEditPart(new ScalableFreeformRootEditPart()
    {
View Full Code Here

    DiagramPresentation presentation = (DiagramPresentation)context;
    SapphireDiagramEditor diagramEditor = presentation.getConfigurationManager().getDiagramEditor();
    if (diagramEditor != null)
    {
      List<ISapphirePart> parts = diagramEditor.getSelectedParts();
      DiagramModel model = diagramEditor.getDiagramModel();
      if (parts.size() == 1)
      {
        ISapphirePart part = parts.get(0);
        if (part instanceof DiagramNodePart)
        {
          model.handleDirectEditing((DiagramNodePart)part);
        }
        else if (part instanceof ShapePart)
        {
          model.handleDirectEditing((ShapePart)part);
//          DiagramNodePart nodePart = part.nearest(DiagramNodePart.class);
//         
//          DiagramNodeModel nodeModel = model.getDiagramNodeModel(nodePart);
//          ShapeModel shapeModel = ShapeModelUtil.getChildShapeModel(nodeModel.getShapeModel(), (ShapePart)part);
//          shapeModel.handleDirectEditing((ShapePart)part);
        }
        else if (part instanceof DiagramConnectionPart && (((DiagramConnectionPart)part).removable()))
        {
          model.handleDirectEditing((DiagramConnectionPart)part);
        }
      }
    }
    return null;
  }
View Full Code Here

      }     
    }
    else if (request.getNewObjectType() == ISelection.class) {
      // DND from project explorer
      ISelection selection = (ISelection)request.getNewObject();
      DiagramModel diagramModel = (DiagramModel)getHost().getModel();
      cmd = new DndObjectCommand(diagramModel, selection, pt);
    }
    return cmd;
  }
View Full Code Here

  }
 
  @SuppressWarnings("unchecked")
  private DirectedGraph mapDiagramToGraph(final SapphireDiagramEditor diagramEditor)
  {
    DiagramModel diagramModel = diagramEditor.getDiagramModel();
    Map<DiagramNodeModel, Node> shapeToNode = new HashMap<DiagramNodeModel, Node>();
    DirectedGraph dg = new DirectedGraph();
    dg.setDirection(getGraphDirection());
    EdgeList edgeList = new EdgeList();
    NodeList nodeList = new NodeList();
    List<DiagramNodeModel> children = diagramModel.getNodes();
    for (DiagramNodeModel child : children)
    {
      Node node = new Node();
      Rectangle bounds = child.getShapePresentation().getFigure().getBounds();//child.getNodeBounds();
      node.x = bounds.x;
      node.y = bounds.y;
      node.width = bounds.width;
      node.height = bounds.height;
      node.data = child;
      shapeToNode.put(child, node);
      nodeList.add(node);
    }
    List<DiagramConnectionModel> connections = diagramModel.getConnections();
    for (DiagramConnectionModel connection : connections)
    {
      DiagramNodeModel sourceNode = connection.getSourceNode();
      DiagramNodeModel targetNode = connection.getTargetNode();
      if (sourceNode != targetNode)
View Full Code Here

TOP

Related Classes of org.eclipse.sapphire.ui.swt.gef.model.DiagramModel

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.