protected void setItemText(MMenuItem model, MenuItem item) {
   String text = model.getLocalizedLabel();
   if (model instanceof MHandledItem) {
     MHandledItem handledItem = (MHandledItem) model;
     IEclipseContext context = getContext(model);
     EBindingService bs = (EBindingService) context.get(EBindingService.class.getName());
     ParameterizedCommand cmd = handledItem.getWbCommand();
     if (cmd != null && (text == null || text.length() == 0)) {
       try {
         text = cmd.getName();
       } catch (NotDefinedException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
       }
     }
     TriggerSequence sequence = bs.getBestSequenceFor(handledItem.getWbCommand());
     if (sequence != null) {
       text = text + '\t' + sequence.format();
     }
     item.setText(text == null ? handledItem.getCommand().getElementId() : text);
   } else {
     super.setItemText(model, item);
   }
 }
  /*
   * (non-Javadoc)
   *
   * @see
   * org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer#hookControllerLogic
   * (org.eclipse.e4.ui.model.application.MUIElement)
   */
  @Override
  public void hookControllerLogic(MUIElement me) {
    // If the item is a CHECK or RADIO update the model's state to match
    super.hookControllerLogic(me);

    // 'Execute' the operation if possible
    if (me instanceof MHandledItem) {
      final MHandledItem item = (MHandledItem) me;
      final IEclipseContext lclContext = getContext(me);
      MenuItem mi = (MenuItem) me.getWidget();
      mi.addListener(
          SWT.Selection,
          new Listener() {
            public void handleEvent(Event e) {
              EHandlerService service =
                  (EHandlerService) lclContext.get(EHandlerService.class.getName());
              ParameterizedCommand cmd = item.getWbCommand();
              if (cmd == null) {
                return;
              }
              final IEclipseContext staticContext =
                  EclipseContextFactory.create(HMI_STATIC_CONTEXT);
              if (e != null) {
                staticContext.set(Event.class, e);
              }
              ContributionsAnalyzer.populateModelInterfaces(
                  item, staticContext, item.getClass().getInterfaces());
              try {
                service.executeHandler(cmd, staticContext);
              } finally {
                staticContext.dispose();
              }
            }
          });
    }
  }