Examples of SapphireDiagramEditor


Examples of org.eclipse.sapphire.ui.swt.gef.SapphireDiagramEditor

{
  @Override
  protected Object run( final Presentation context )
  {
    DiagramPresentation diagramPresentation = (DiagramPresentation)context;
    SapphireDiagramEditor diagramEditor = diagramPresentation.getConfigurationManager().getDiagramEditor();
    new HorizontalGraphLayout().layout(diagramEditor);
   
    return null;
  }
View Full Code Here

Examples of org.eclipse.sapphire.ui.swt.gef.SapphireDiagramEditor

  @Override
  protected Object run( final Presentation context )
  {
    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)
        {
View Full Code Here

Examples of org.eclipse.sapphire.ui.swt.gef.SapphireDiagramEditor

{
  @Override
  protected Object run( final Presentation context )
  {
    DiagramPresentation diagramPresentation = (DiagramPresentation)context;
    SapphireDiagramEditor diagramEditor = diagramPresentation.getConfigurationManager().getDiagramEditor();
    new VerticalGraphLayout().layout(diagramEditor);
   
    return null;
  }
View Full Code Here

Examples of org.eclipse.sapphire.ui.swt.gef.SapphireDiagramEditor

 
  @Override
  protected Object run(Presentation context)
  {
        DiagramNodePresentation nodePresentation = (DiagramNodePresentation)context;
        SapphireDiagramEditor diagramEditor = nodePresentation.getConfigurationManager().getDiagramEditor();

        if( diagramEditor != null )
        {
          GraphicalEditPart sourceEditPart = diagramEditor.getGraphicalEditPart(nodePresentation.part());
        DefaultEditDomain editDomain = diagramEditor.getEditDomain();
        DiagramNodeConnectionCreationTool connectionTool = new DiagramNodeConnectionCreationTool();
        connectionTool.setEditDomain(editDomain);
        editDomain.setActiveTool(connectionTool);
       
        connectionTool.continueConnection(sourceEditPart, diagramEditor, connectionDef);
View Full Code Here

Examples of org.eclipse.sapphire.ui.swt.gef.SapphireDiagramEditor

    @Override
    protected Object run( final Presentation context )
    {
        DiagramPresentation diagramPresentation = (DiagramPresentation)context;
        SapphireDiagramEditor diagramEditor = diagramPresentation.getConfigurationManager().getDiagramEditor();

        if( diagramEditor != null )
        {
            final FileDialog dialog = new FileDialog( diagramEditor.getSite().getShell(), SWT.SAVE );
            final IEditorInput editorInput = diagramEditor.getPart().adapt( IEditorInput.class );
            final StringBuilder initialFileName = new StringBuilder();
           
            if( editorInput == null )
            {
                initialFileName.append( defaultFileName.text() );
            }
            else
            {
                if( editorInput instanceof IFileEditorInput )
                {
                    dialog.setFilterPath( ( (IFileEditorInput) editorInput ).getFile().getParent().getLocation().toOSString() );
                }
               
                final String editorInputName = editorInput.getName();
                final int editorInputLastDot = editorInputName.lastIndexOf( '.' );
               
                if( editorInputLastDot == -1 )
                {
                    initialFileName.append( editorInputName );
                }
                else
                {
                    initialFileName.append( editorInputName.substring( 0, editorInputLastDot ) );
                }
            }
           
            initialFileName.append( ".png" );

            dialog.setFileName( initialFileName.toString() );

            dialog.setFilterExtensions( new String[] { "*.png" } );

            dialog.setText( saveAsImageMessage.text() );

            dialog.setOverwrite( true );

            String filePath = dialog.open();

            if( filePath == null )
            {
                return null;
            }

            GraphicalViewer graphicalViewer = (GraphicalViewer) diagramEditor.getAdapter( GraphicalViewer.class );

            ScalableFreeformRootEditPart rootEditPart
                = (ScalableFreeformRootEditPart) graphicalViewer.getRootEditPart();

            IFigure figure = rootEditPart.getLayer( LayerConstants.PRINTABLE_LAYERS );
View Full Code Here

Examples of org.eclipse.sapphire.ui.swt.gef.SapphireDiagramEditor

{
    @Override
    protected Object run( final Presentation context )
    {
        final DiagramPresentation diagramPresentation = (DiagramPresentation) context;
        final SapphireDiagramEditor diagramEditor = diagramPresentation.getConfigurationManager().getDiagramEditor();

        ( new PrintAction( diagramEditor ) ).run();

        return null;
    }
View Full Code Here

Examples of org.eclipse.sapphire.ui.swt.gef.SapphireDiagramEditor

  private void moveBendpoints() {
    DiagramNodeBounds bounds = node.getModelPart().getNodeBounds();
    int deltaX = this.rectangle.x - bounds.getX();
    int deltaY = this.rectangle.y - bounds.getY();
    if (deltaX != 0 || deltaY != 0) {
      SapphireDiagramEditor editor = node.getDiagramModel().getSapphireDiagramEditor();
      List<DiagramConnectionModel> srcConnections = node.getSourceConnections();
      for (GraphicalEditPart part : editor.getSelectedEditParts()) {
        if (part instanceof DiagramNodeEditPart) {
          DiagramNodeModel otherNode = ((DiagramNodeEditPart)part).getCastedModel();
          List<DiagramConnectionModel> targetConnections = otherNode.getTargetConnections();
          for (DiagramConnectionModel conn : targetConnections) {
            if (srcConnections.contains(conn)) {
View Full Code Here

Examples of org.eclipse.sapphire.ui.swt.gef.SapphireDiagramEditor

   * @param color
   *            The IColorConstant for which to return the SWT color.
   * @return The adjusted SWT color for the given IColorConstant.
   */
  private Color getAdjustedColor(org.eclipse.sapphire.Color color) {
    SapphireDiagramEditor editor = getContextButtonPad().getEditor();
    if (!isEnabled()) {
      int disabledAdjustment = 80;
      int r = Math.min(255, color.red() + disabledAdjustment);
      int g = Math.min(255, color.green() + disabledAdjustment);
      int b = Math.min(255, color.blue() + disabledAdjustment);
      color = new org.eclipse.sapphire.Color(r, g, b);
    }
    Color swtColor = editor.getResourceCache().getColor(color);
    return swtColor;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.