Examples of SapphireActionGroup


Examples of org.eclipse.sapphire.ui.SapphireActionGroup

    Point loc = bounds.getLocation();
    Point botRight = bounds.getBottomRight();
    contextButtonPadData.getPadLocation().set(loc.x, loc.y,
        botRight.x - loc.x, botRight.y - loc.y);
       
    SapphireActionGroup actionGroup = null;
    if (editParts.size() == 1)
    {
      ShapeEditPart shapeEditPart = (ShapeEditPart)editParts.get(0);
      if (shapeEditPart instanceof DiagramNodeEditPart)
      {
        DiagramNodePart nodePart = nodeEditPart.getCastedModel().getModelPart();
        actionGroup = nodePart.getActions(SapphireActionSystem.CONTEXT_DIAGRAM_NODE);
      }
      else
      {
        ShapePart shapePart = (ShapePart)((ShapeModel)shapeEditPart.getModel()).getSapphirePart();
        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
    List<SapphireAction> actions = new ArrayList<SapphireAction>(originalActions.size());
    for (SapphireAction action : originalActions)
    {
View Full Code Here

Examples of org.eclipse.sapphire.ui.SapphireActionGroup

 
  private void configureDiagramHeading()
  {
    decorateHeading();
   
        final SapphireActionGroup actions = this.part.getActions( SapphireActionSystem.CONTEXT_DIAGRAM_HEADER );
        if (actions != null && !actions.isEmpty())
        {
          final SapphireActionPresentationManager actionPresentationManager = new SapphireActionPresentationManager(this.diagramPresentation, actions);
          final SapphireToolBarManagerActionPresentation actionPresentation = new SapphireToolBarManagerActionPresentation( actionPresentationManager );
          actionPresentation.setToolBarManager( this.header.getToolBarManager() );
          actionPresentation.render();
View Full Code Here

Examples of org.eclipse.sapphire.ui.SapphireActionGroup

        decorator.addEditorControl( toolbarComposite );
        decorator.addEditorControl( toolbar );
       
        final Table mainTable = (Table) super.createContents( tableComposite, true );
       
        final SapphireActionGroup actions = getActions();
        final SapphireAction moveRightAction = actions.getAction( SapphireActionSystem.ACTION_MOVE_RIGHT );
        final SapphireActionHandler moveRightActionHandler = createMoveRightActionHandler();
        moveRightActionHandler.init( moveRightAction, null );
        moveRightAction.addHandler( moveRightActionHandler );
       
        final SapphireToolBarActionPresentation actionsPresentation = new SapphireToolBarActionPresentation( getActionPresentationManager() );
View Full Code Here

Examples of org.eclipse.sapphire.ui.SapphireActionGroup

 
  @Override
  public boolean keyPressed(KeyEvent event)
  {
    final SapphireActionPresentationManager manager = getManager();
    final SapphireActionGroup localGroupOfActions = manager.getActionGroup();
       
    if (!(this.sapphirePart instanceof DiagramConnectionPart) ||
        (((DiagramConnectionPart)this.sapphirePart).removable()))
    {
      if( handleKeyEvent( event, manager, localGroupOfActions, false ) )
          {
              return true;
          }
      if (this.hiddenActions != null)
      {
        if( handleKeyEvent( event, getHiddenManager(), this.hiddenActions, false ) )
            {
                return true;
            }
      }
    }   
    if (this.sapphireParts.size() == 1)
    {
          ISapphirePart part = this.sapphirePart.parent();
         
          while( part != null )
          {
              final String mainActionContext = part.getMainActionContext();
             
              if( mainActionContext != null )
              {
                  final SapphireActionGroup groupOfActions = part.getActions( mainActionContext );
                 
                  if( handleKeyEvent( event, getManager(), groupOfActions, true ) )
                  {
                      return true;
                  }
View Full Code Here

Examples of org.eclipse.sapphire.ui.SapphireActionGroup

        final boolean isLongString = property.definition().hasAnnotation( LongString.class );
        final boolean isDeprecated = property.definition().hasAnnotation( Deprecated.class );
        final boolean isReadOnly = ( property.definition().isReadOnly() || part.getRenderingHint( PropertyEditorDef.HINT_READ_ONLY, false ) );
        final boolean isSensitiveData = property.definition().hasAnnotation( SensitiveData.class );
       
        final SapphireActionGroup actions = getActions();
        final SapphireActionHandler jumpActionHandler = actions.getAction( ACTION_JUMP ).getFirstActiveHandler();

        final SapphireToolBarActionPresentation toolBarActionsPresentation = new SapphireToolBarActionPresentation( getActionPresentationManager() );
        toolBarActionsPresentation.addFilter( createFilterByActionId( ACTION_ASSIST ) );
        toolBarActionsPresentation.addFilter( createFilterByActionId( ACTION_JUMP ) );
       
        actions.addFilter
        (
            new SapphireActionHandlerFilter()
            {
                @Override
                public boolean check( final SapphireActionHandler handler )
                {
                    final String actionId = handler.getAction().getId();
                   
                    if( actionId.equals( ACTION_BROWSE ) && ( isReadOnly || suppressBrowseAction ) )
                    {
                        return false;
                    }
                   
                    return true;
                }
            }
        );
       
        final boolean isActionsToolBarNeeded = toolBarActionsPresentation.hasActions();
        final boolean isBrowseOnly = part.getRenderingHint( PropertyEditorDef.HINT_BROWSE_ONLY, false );
       
        final Composite textFieldParent = createMainComposite
        (
            parent,
            new CreateMainCompositeDelegate( part )
            {
                @Override
                public boolean canScaleVertically()
                {
                    return isLongString;
                }
            }
        );
       
        addControl( textFieldParent );

        int textFieldParentColumns = 1;
        if( isActionsToolBarNeeded ) textFieldParentColumns++;
        if( isDeprecated ) textFieldParentColumns++;
       
        textFieldParent.setLayout( glayout( textFieldParentColumns, 0, 0, 0, 0 ) );
       
        final Composite nestedComposite = new Composite( textFieldParent, SWT.NONE );
        nestedComposite.setLayoutData( isLongString ? gdfill() : gdvalign( gdhfill(), SWT.CENTER ) );
        nestedComposite.setLayout( glspacing( glayout( 2, 0, 0 ), 2 ) );
       
        addControl( nestedComposite );
       
        final PropertyEditorAssistDecorator decorator = createDecorator( nestedComposite );
       
        decorator.control().setLayoutData( gdvalign( gd(), SWT.TOP ) );
        decorator.addEditorControl( nestedComposite );
       
        final int style
            = SWT.BORDER |
              ( isLongString ? SWT.MULTI | SWT.WRAP | SWT.V_SCROLL : SWT.NONE ) |
              ( ( isReadOnly || isBrowseOnly ) ? SWT.READ_ONLY : SWT.NONE ) |
              ( isSensitiveData ? SWT.PASSWORD : SWT.NONE );
       
        this.textField = new Text( nestedComposite, style );
        this.textField.setLayoutData( gdfill() );
        decorator.addEditorControl( this.textField, true );
       
        final Serialization serialization = property.definition().getAnnotation( Serialization.class );

        final TextOverlayPainter.Controller textOverlayPainterController = new TextOverlayPainter.Controller()
        {
            @Override
            public boolean isHyperlinkEnabled()
            {
                return ( jumpActionHandler == null ? false : jumpActionHandler.isEnabled() );
            }

            @Override
            public void handleHyperlinkEvent()
            {
                if( jumpActionHandler != null )
                {
                    jumpActionHandler.execute( TextFieldPropertyEditorPresentation.this );
                }
            }

            @Override
            public String overlay()
            {
                String def = property.disposed() ? null : property.getDefaultText();
               
                if( def != null && isSensitiveData )
                {
                    final StringBuilder buf = new StringBuilder();
                   
                    for( int i = 0, n = def.length(); i < n; i++ )
                    {
                        buf.append( "\u25CF" );
                    }
                   
                    def = buf.toString();
                }
               
                if( def == null && serialization != null )
                {
                    def = serialization.primary();
                }
               
                return def;
            }
        };
           
        TextOverlayPainter.install( this.textField, textOverlayPainterController );
       
        if( isBrowseOnly || isReadOnly )
        {
            final Color bgcolor = new Color( this.textField.getDisplay(), 245, 245, 245 );
            this.textField.setBackground( bgcolor );
           
            this.textField.addDisposeListener
            (
                new DisposeListener()
                {
                    public void widgetDisposed( final DisposeEvent event )
                    {
                        bgcolor.dispose();
                    }
                }
            );
        }
       
        final List<Control> relatedControls = new ArrayList<Control>();
        this.textField.setData( RELATED_CONTROLS, relatedControls );
       
        final Listener actionHandlerListener = new Listener()
        {
            @Override
            public void handle( final Event event )
            {
                if( event instanceof PostExecuteEvent )
                {
                    if( ! TextFieldPropertyEditorPresentation.this.textField.isDisposed() )
                    {
                        TextFieldPropertyEditorPresentation.this.textField.setFocus();
                        TextFieldPropertyEditorPresentation.this.textField.setSelection( 0, TextFieldPropertyEditorPresentation.this.textField.getText().length() );
                    }
                }
            }
        };
       
        for( SapphireAction action : actions.getActions() )
        {
            if( ! action.getId().equals( ACTION_ASSIST ) )
            {
                for( SapphireActionHandler handler : action.getActiveHandlers() )
                {
View Full Code Here

Examples of org.eclipse.sapphire.ui.SapphireActionGroup

        }
    }
   
    private void handleKeyEvent( final Event event )
    {
        final SapphireActionGroup localGroupOfActions = getManager().getActionGroup();

        if( handleKeyEvent( event, localGroupOfActions, false ) )
        {
            return;
        }
       
        // Account for propagated key bindings. Start the search with this part's
        // main action context and continue up the parts hierarchy.
       
        ISapphirePart part = localGroupOfActions.getPart();
       
        while( part != null )
        {
            final String mainActionContext = part.getMainActionContext();
           
            if( mainActionContext != null )
            {
                final SapphireActionGroup groupOfActions = part.getActions( mainActionContext );
               
                if( handleKeyEvent( event, groupOfActions, true ) )
                {
                    return;
                }
View Full Code Here

Examples of org.eclipse.sapphire.ui.SapphireActionGroup

        {
            this.actions = new HashMap<String,SapphireActionGroup>();
           
            for( String ctxt : getActionContexts() )
            {
                final SapphireActionGroup actionsForContext = new SapphireActionGroup( this.part, ctxt );
                this.actions.put( ctxt.toLowerCase(), actionsForContext );
            }
        }
       
        return this.actions.get( context.toLowerCase() );
View Full Code Here

Examples of org.eclipse.sapphire.ui.SapphireActionGroup

                if( style == null || ( style == Style.CHECKBOX && allPossibleTypesCount != 1 ) )
                {
                    style = defaultStyle;
                }
               
                final SapphireActionGroup actions = part.getActions();
                final SapphireActionPresentationManager actionPresentationManager = new SapphireActionPresentationManager( WithPresentation.this, actions );
                final SapphireKeyboardActionPresentation actionPresentationKeyboard = new SapphireKeyboardActionPresentation( actionPresentationManager );
               
                final boolean showLabel = ( part.label() != null );
View Full Code Here

Examples of org.eclipse.sapphire.ui.SapphireActionGroup

        this.addText.addHyperlinkListener(this.addTextHyperlinkAdapter);
    }
   
    private void addToolbar(final TextBinding binding, final PropertyEditorPart editor) {
        final PropertyEditorPart part = part();
        final SapphireActionGroup parentActions = new SapphireActionGroup(part, part.getActionContext());

        final SapphireAction deleteAction = parentActions.getAction( ACTION_DELETE );
        deleteAction.setGroup(null);
        final DeleteActionHandler deleteActionHandler = new DeleteActionHandler(binding);
        deleteActionHandler.init( deleteAction, null );
        deleteAction.addHandler( deleteActionHandler );
       
        final SapphireActionGroup actions = editor.getActions();
        actions.addAction(deleteAction);
       
        final SapphireActionHandler jumpActionHandler = actions.getAction( ACTION_JUMP ).getFirstActiveHandler();
        addJumpOverlay(jumpActionHandler, binding);

        final SapphireActionHandlerFilter assistFilter = SapphireActionSystem.createFilterByActionId( ACTION_ASSIST );
        final SapphireActionHandlerFilter jumpFilter = SapphireActionSystem.createFilterByActionId( ACTION_JUMP );
        actions.addFilter(assistFilter);
        actions.addFilter(jumpFilter);

        final SapphireActionPresentationManager actionPresentationManager = new SapphireActionPresentationManager( this, actions );
        final SapphireToolBarActionPresentation toolBarActionsPresentation = new SapphireToolBarActionPresentation( actionPresentationManager );
        final SapphireKeyboardActionPresentation actionPresentationKeyboard = new SapphireKeyboardActionPresentation( actionPresentationManager );
        binding.setActionPresentationKeyboard(actionPresentationKeyboard);

        final ToolBar toolbar = new ToolBar( this.textComposite, SWT.FLAT | SWT.HORIZONTAL );
        toolbar.setLayoutData( gdhindent( gdvfill(), 2) );
        toolBarActionsPresentation.setToolBar( toolbar );
        toolBarActionsPresentation.render();
       
        addControl(toolbar);
       
        toolbar.addDisposeListener(new DisposeListener() {
            public void widgetDisposed(DisposeEvent e) {
                deleteAction.removeHandler(deleteActionHandler);
                actionPresentationKeyboard.dispose();
            }
        });

        binding.setToolbar(toolbar);
        binding.setDeleteActionHandler(deleteActionHandler);
       
        actions.removeFilter(assistFilter);
        actions.removeFilter(jumpFilter);
    }
View Full Code Here

Examples of org.eclipse.sapphire.ui.SapphireActionGroup

    public void render()
    {
        final ActuatorPart part = part();
        final ActuatorDef def = part.definition();
       
        final SapphireActionGroup actions = part.getActions();
        this.actionPresentationManager = new SapphireActionPresentationManager( this, actions );
        final SapphireKeyboardActionPresentation keyboardActionPresentation = new SapphireKeyboardActionPresentation( this.actionPresentationManager );
       
        final HorizontalAlignment hAlign = def.getHorizontalAlignment().content();
        final int hAlignCode = ( hAlign == HorizontalAlignment.LEFT ? SWT.LEFT : ( hAlign == HorizontalAlignment.RIGHT ? SWT.RIGHT : SWT.CENTER ) );
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.