Package org.eclipse.sapphire.ui.diagram.editor

Examples of org.eclipse.sapphire.ui.diagram.editor.SapphireDiagramEditorPagePart


        actionGroup = shapePart.getActions(SapphireActionSystem.CONTEXT_DIAGRAM_NODE_SHAPE);
      }
    }
    else
    {
      SapphireDiagramEditorPagePart pagePart = getEditor().getPart();
      actionGroup = pagePart.getActions(SapphireActionSystem.CONTEXT_DIAGRAM_MULTIPLE_PARTS);
    }
    
    List<SapphireAction> originalActions = actionGroup.getActions();   
   
    // Filter out the "default" action and actions without active handlers
View Full Code Here


       
        this.editor = editor;
        this.element = element;
        this.definition = definition;

        this.part = new SapphireDiagramEditorPagePart();
    this.part.init( editor, this.element, this.definition.resolve(), Collections.<String, String> emptyMap() );
    this.part.initialize();
       
        final String partName = this.definition.resolve().getPageName().localized( CapitalizationType.TITLE_STYLE, false );
        setPartName( partName );
View Full Code Here

  {
        final ListFactory<SapphireActionHandler> handlers = ListFactory.start();
        if (getPart() instanceof DiagramNodePart)
        {
          DiagramNodePart nodePart = (DiagramNodePart)getPart();
          SapphireDiagramEditorPagePart pagePart = nodePart.nearest(SapphireDiagramEditorPagePart.class);
          List<IDiagramConnectionDef> connectionDefs = pagePart.possibleConnectionDefs(nodePart);
          for (IDiagramConnectionDef connDef : connectionDefs)
          {
            NodeCreateConnectionActionHandler handler = new NodeCreateConnectionActionHandler(connDef);
            handlers.add(handler);
          }
View Full Code Here

    if (tooltip != null)
    {
      setToolTip(tooltip);
    }
   
    SapphireDiagramEditorPagePart pagePart = action.getPart().nearest(SapphireDiagramEditorPagePart.class);
    List<SapphireDiagramEditorPagePart.ConnectionPalette> conns = pagePart.getConnectionPalettes();
    ImageData connImage = null;
    for (SapphireDiagramEditorPagePart.ConnectionPalette conn : conns)
    {
      if (conn.getConnectionDef() == this.connectionDef)
      {
View Full Code Here

  @Override
  public void execute()
  {   
    // Invoke "Sapphire.Add" action
    SapphireDiagramEditorPagePart editorPart = this.nodeTemplate.getDiagramEditorPart();
    SapphireAction addAction = editorPart.getAction(SapphireActionSystem.ACTION_ADD);
    if (addAction != null)
    {
      List<SapphireActionHandler> addHandlers = addAction.getActiveHandlers();
      for (SapphireActionHandler handler : addHandlers)
      {
        DiagramNodeAddActionHandler nodeAddHandler = (DiagramNodeAddActionHandler)handler;
        if (nodeAddHandler.getNodeTemplate().equals(this.nodeTemplate))
        {
          editorPart.setMouseLocation(this.location.x, this.location.y);
          nodeAddHandler.execute(this.diagramPresentation);
          break;
        }
      }
    }
View Full Code Here

public final class ShowStatisticsActionHandler extends SapphireActionHandler
{
    @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();
               
View Full Code Here

    {
      refreshDirtyState();
  }
   
    private void handleDiagramPageEvent(DiagramPageEvent event) {
      SapphireDiagramEditorPagePart diagramPart = (SapphireDiagramEditorPagePart)event.part();
      switch(event.getDiagramPageEventType()) {
        case GridStateChange:
          setGridVisible(diagramPart.isGridVisible());
          break;
        case GuideStateChange:
          setGuidesVisible(diagramPart.isShowGuides());
          break;
        case DiagramSave:
        doSave();
          break;
        default:
View Full Code Here

      if (!component.disposed())
      {
        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())
      {
View Full Code Here

            }
        }
       
        if( ! locations.isEmpty() )
        {
            final SapphireDiagramEditorPagePart diagram = context( SapphireDiagramEditorPagePart.class );
            final Map map = context( Map.class );
           
            final Point initialDropPosition = context.position();
           
            int x = initialDropPosition.getX();
            int y = initialDropPosition.getY();
           
            for( String locationName : locations )
            {
                if( ! map.hasLocation( locationName ) )
                {
                    final Location location = map.getLocations().insert();
                    location.setName( locationName );
                   
                    final DiagramNodePart locationNodePart = diagram.getDiagramNodePart(location);
                    locationNodePart.setNodeBounds( x, y );
                   
                    x += 50;
                    y += 50;
                }
View Full Code Here

        public boolean applicable( final ServiceContext context )
        {
          ISapphirePart part = context.find(ISapphirePart.class);
          if (part instanceof SapphireDiagramEditorPagePart)
          {
            SapphireDiagramEditorPagePart diagramPagePart = (SapphireDiagramEditorPagePart)part;
            DiagramEditorPageDef pageDef = diagramPagePart.getPageDef();
            if (pageDef.getLayoutPersistence().content() == LayoutPersistence.WORKSPACE)
            {
              return true;
            }
          }
View Full Code Here

TOP

Related Classes of org.eclipse.sapphire.ui.diagram.editor.SapphireDiagramEditorPagePart

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.