private boolean rebuildCommonActions() {
    boolean hasToolbarContent = false;
    for (Map.Entry<GridImpl, TopToolbarWrappers> entry : myCommonActionsPlaceholder.entrySet()) {
      Wrapper forePlaceHolder = entry.getValue().fore;
      Wrapper leftPlaceHolder = entry.getValue().left;
      Wrapper middlePlaceHolder = entry.getValue().middle;
      Wrapper rightPlaceHolder = entry.getValue().right;

      TopToolbarContextActions topToolbarContextActions = myContextActions.get(entry.getKey());

      DefaultActionGroup leftGroupToBuild = new DefaultActionGroupWithDelegate(myTopLeftActions);
      if (topLeftActionsVisible) {
        leftGroupToBuild.addAll(myTopLeftActions);
      }
      final AnAction[] leftActions = leftGroupToBuild.getChildren(ActionManager.getInstance());

      if (topToolbarContextActions == null ||
          !Arrays.equals(leftActions, topToolbarContextActions.left) ||
          (myTopLeftActionsBefore && forePlaceHolder.getTargetComponent() == forePlaceHolder) ||
          (!myTopLeftActionsBefore && leftPlaceHolder.getTargetComponent() == leftPlaceHolder)) {
        if (myTopLeftActionsBefore) {
          leftPlaceHolder.setContent(null);
          setActions(forePlaceHolder, myTopLeftActionsPlace, leftGroupToBuild, false);
          setForeToolbarBorder(forePlaceHolder.getTargetComponent());
        }
        else {
          forePlaceHolder.setContent(null);
          setActions(leftPlaceHolder, myTopLeftActionsPlace, leftGroupToBuild, true);
        }
      }

      DefaultActionGroup middleGroupToBuild = new DefaultActionGroup();
      middleGroupToBuild.addAll(myTopMiddleActions);
      final AnAction[] middleActions = middleGroupToBuild.getChildren(ActionManager.getInstance());

      if (topToolbarContextActions == null || !Arrays.equals(middleActions, topToolbarContextActions.middle)) {
        setActions(middlePlaceHolder, myTopMiddleActionsPlace, middleGroupToBuild, true);
      }

      DefaultActionGroup rightGroupToBuild = new DefaultActionGroup();
      rightGroupToBuild.addAll(myTopRightActions);
      final AnAction[] rightActions = rightGroupToBuild.getChildren(ActionManager.getInstance());

      if (topToolbarContextActions == null || !Arrays.equals(rightActions, topToolbarContextActions.right)) {
        setActions(rightPlaceHolder, myTopRightActionsPlace, rightGroupToBuild, true);
      }

      myContextActions.put(entry.getKey(), new TopToolbarContextActions(leftActions, middleActions, rightActions));

      if (leftGroupToBuild.getChildrenCount() > 0 || rightGroupToBuild.getChildrenCount() > 0) {
        hasToolbarContent = true;
      }
    }

    return hasToolbarContent;
  }
private boolean rebuildCommonActions()