Package org.eclipse.sapphire.ui.diagram

Examples of org.eclipse.sapphire.ui.diagram.ConnectionService


  {   
    if (target == null)
    {
      return false;
    }
    ConnectionService connService = this.diagramPart.service(ConnectionService.class);
    return connService.valid(this.source.getModelPart(), this.target.getModelPart(), this.connDef.getId().content());
  }
View Full Code Here


   *
   * @see org.eclipse.gef.commands.Command#execute()
   */
  public void execute()
  {
    ConnectionService connService = this.diagramPart.service(ConnectionService.class);
    DiagramConnectionPart connection = connService.connect(this.source.getModelPart(), this.target.getModelPart(),
        this.connDef.getId().content());
   
    // activate direct editing after object creation
    if (connection != null && connection.canEditLabel())
    {
View Full Code Here

      nodes.add(new DiagramNodeModel(this, nodePresentation));
    }
  }
 
  private void constructConnections() {
    ConnectionService connService = getSapphirePart().service(ConnectionService.class);
    for (DiagramConnectionPart connPart : connService.list())
    {
      addConnection(connPart);
    }
   
  }
View Full Code Here

    return false;
  }

  private boolean checkSourceReconnection() {
    DiagramConnectionPart connectionPart = this.connection.getModelPart();
    ConnectionService connService = connectionPart.nearest(SapphireDiagramEditorPagePart.class).service(ConnectionService.class);
    if (!connService.valid(newSource.getModelPart(), oldTarget.getModelPart(), connectionPart.getConnectionTypeId()))
      return false;

    return true;
  }
View Full Code Here

    return true;
  }

  private boolean checkTargetReconnection() {
    DiagramConnectionPart connectionPart = this.connection.getModelPart();
    ConnectionService connService = connectionPart.nearest(SapphireDiagramEditorPagePart.class).service(ConnectionService.class);
    if (!connService.valid(oldSource.getModelPart(), newTarget.getModelPart(), connectionPart.getConnectionTypeId()))
      return false;
       
    return true;
  }
View Full Code Here

        return layoutPersistentService;      
    }
       
    public static ConnectionService getConnectionService(SapphireDiagramEditorPagePart diagramPart)
    {
      ConnectionService connectionService =
          diagramPart.service(ConnectionService.class);
     
        return connectionService;      
    }
View Full Code Here

{
    @Override
    protected Object run( final Presentation context )
    {
        final SapphireDiagramEditorPagePart page = (SapphireDiagramEditorPagePart) getPart();
        ConnectionService connService = page.service(ConnectionService.class);
       
        int nodes = 0;
        int connections = 0;
        int bendpoints = 0;
       
        for( ISapphirePart selectedPart : page.getSelections() )
        {
            if( selectedPart instanceof DiagramNodePart )
            {
                nodes++;
            }
            else if( selectedPart instanceof DiagramConnectionPart )
            {
                connections++;
                bendpoints += ( (DiagramConnectionPart) selectedPart ).getBendpoints().size();
            }
            else if( selectedPart instanceof SapphireDiagramEditorPagePart )
            {
                nodes = page.getNodes().size();
               
                final List<DiagramConnectionPart> allConnections = connService.list();
               
                connections = allConnections.size();
               
                for( DiagramConnectionPart connection : allConnections )
                {
View Full Code Here

  {
      context( SapphireDiagramEditorPagePart.class ).setGridVisible(this.architecture.isShowGrid().content());
      context( SapphireDiagramEditorPagePart.class ).setShowGuides(this.architecture.isShowGuides().content());
   
    ElementList<Component> components = this.architecture.getComponents();
    ConnectionService connService = context( SapphireDiagramEditorPagePart.class ).service(ConnectionService.class);
    for (Component component : components)
    {
      DiagramNodePart nodePart = context( SapphireDiagramEditorPagePart.class ).getDiagramNodePart(component);
      if (nodePart != null)
      {
        DiagramNodeBounds bounds = null;
        bounds = new DiagramNodeBounds(component.getPosition().getX().content(),
            component.getPosition().getY().content(), -1, -1,
            false, false);
        nodePart.setNodeBounds(bounds);         
       
        // load the embedded connection layout
        ElementList<ComponentDependency> dependencies = component.getDependencies();
       
        for (ComponentDependency dependency : dependencies)
        {
          DiagramConnectionPart connPart = getConnectionPart(connService, dependency);
          if (connPart != null)
          {           
            ElementList<ConnectionBendpoint> bendpoints = dependency.getConnectionBendpoints();
            if (bendpoints.size() > 0)
            {
              int index = 0;
              for (ConnectionBendpoint bendpoint : bendpoints)
              {
                connPart.addBendpoint(index++, bendpoint.getX().content(),
                    bendpoint.getY().content());
              }             
            }
          }
        }       
      }
    }
   
    // Listen on existing connection parts
    for (DiagramConnectionPart connPart : connService.list())
    {
      connPart.attach(this.connectionPartListener);
    }
   
  }
View Full Code Here

    nodePart.setNodeBounds(nodeBounds);
  }
 
  private void handleConnectionBendpointChange(ComponentDependency componentDependency)
  {
    ConnectionService connService = context(SapphireDiagramEditorPagePart.class).service(ConnectionService.class);
    DiagramConnectionPart connPart = getConnectionPart(connService, componentDependency);
    if (connPart != null)
    {
      List<Point> bendpoints = new ArrayList<Point>();
      for (ConnectionBendpoint bendpoint : componentDependency.getConnectionBendpoints())
View Full Code Here

      {
        writeComponentBounds(component, nodePart);
      }
    }
    SapphireDiagramEditorPagePart diagramPart = context( SapphireDiagramEditorPagePart.class );
    ConnectionService connService = diagramPart.service(ConnectionService.class);
    for (DiagramConnectionPart connPart : connService.list())
    {
      ComponentDependency dependency = (ComponentDependency)connPart.getLocalModelElement();
      if (!dependency.disposed())
      {
        writeDependencyBendPoints(dependency, connPart);
View Full Code Here

TOP

Related Classes of org.eclipse.sapphire.ui.diagram.ConnectionService

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.