/** @param context */
 public void updateVisibility(IEclipseContext context) {
   ExpressionContext exprContext = new ExpressionContext(context);
   updateIsVisible(exprContext);
   HashSet<ToolBarContributionRecord> recentlyUpdated = new HashSet<ToolBarContributionRecord>();
   recentlyUpdated.add(this);
   for (MToolBarElement item : generatedElements) {
     boolean currentVisibility = computeVisibility(recentlyUpdated, item, exprContext);
     if (item.isVisible() != currentVisibility) {
       item.setVisible(currentVisibility);
     }
   }
 }
  public boolean mergeIntoModel() {
    int idx = getIndex(toolbarModel, toolbarContribution.getPositionInParent());
    if (idx == -1) {
      return false;
    }

    final List<MToolBarElement> copyElements = new ArrayList<MToolBarElement>();
    for (MToolBarElement item : toolbarContribution.getChildren()) {
      MToolBarElement copy = (MToolBarElement) EcoreUtil.copy((EObject) item);
      copyElements.add(copy);
    }

    for (MToolBarElement copy : copyElements) {
      // if a visibleWhen clause is defined, the item should not be
      // visible until the clause has been evaluated and returned 'true'
      copy.setVisible(!anyVisibleWhen());
      generatedElements.add(copy);
      toolbarModel.getChildren().add(idx++, copy);
    }
    return true;
  }