private void updateToolItem(ToolItem ti, String attName, Object newValue) {
   boolean showText =
       PrefUtil.getAPIPreferenceStore()
           .getBoolean(IWorkbenchPreferenceConstants.SHOW_TEXT_ON_PERSPECTIVE_BAR);
   if (showText && UIEvents.UILabel.LABEL.equals(attName)) {
     String newName = (String) newValue;
     ti.setText(newName);
   } else if (UIEvents.UILabel.TOOLTIP.equals(attName)) {
     String newTTip = (String) newValue;
     ti.setToolTipText(newTTip);
   }
 }
        public void handleEvent(Event event) {
          // Ensure that this event is for a MMenuItem
          if (!(event.getProperty(UIEvents.EventTags.ELEMENT) instanceof MMenuItem)) return;

          MMenuItem itemModel = (MMenuItem) event.getProperty(UIEvents.EventTags.ELEMENT);

          IContributionItem ici = getContribution(itemModel);
          if (ici == null) {
            return;
          }

          String attName = (String) event.getProperty(UIEvents.EventTags.ATTNAME);
          if (UIEvents.UILabel.LABEL.equals(attName)) {
            ici.update();
          } else if (UIEvents.UILabel.ICONURI.equals(attName)) {
            ici.update();
          }
        }