code: public void updateButtonVisibilty(CmsInlineEntityWidget inlineWidget) {
  
          int minOccurrence = 0;
          int maxOccurrence = 0;
          if (isChoiceHandler()) {
              minOccurrence = 0;
              maxOccurrence = getEntityType().getChoiceMaxOccurrence();
          } else {
              minOccurrence = getEntityType().getAttributeMinOccurrence(m_attributeName);
              maxOccurrence = getEntityType().getAttributeMaxOccurrence(m_attributeName);
          }
          CmsEntityAttribute attribute = m_entity.getAttribute(m_attributeName);
          boolean mayHaveMore = (maxOccurrence > minOccurrence)
              && ((((attribute == null) && (!getAttributeType().isSimpleType() || (inlineWidget != null)))
                  || ((attribute != null) && (attribute.getValueCount() < maxOccurrence))));
          boolean needsRemove = false;
          boolean needsSort = false;
          if ((isChoiceHandler() || !getEntityType().isChoice()) && m_entity.hasAttribute(m_attributeName)) {
              int valueCount = m_entity.getAttribute(m_attributeName).getValueCount();
              needsRemove = (maxOccurrence > minOccurrence) && (valueCount > minOccurrence);
              needsSort = !isSingleValueHandler() && (valueCount > 1);
          }
          if (inlineWidget != null) {
              boolean mayEdit = (attribute != null) && (attribute.getValueCount() > inlineWidget.getAttributeIndex());
              inlineWidget.updateButtonVisibility(mayEdit, mayHaveMore, needsRemove, needsSort);
          } else {
              for (CmsAttributeValueView value : m_attributeValueViews) {
                  value.updateButtonVisibility(mayHaveMore, needsRemove, needsSort);
              }
          }
      }
docs: Updates the add, remove and sort button visibility on the given inline widget or all registered attribute value views.<p>
  
  @param inlineWidget the inline widget