code: public void removeItem(ContextMenuItem contextMenuItem) {
  
          if (!hasMenuItem(contextMenuItem)) {
              return;
          }
  
          if (contextMenuItem.isRootItem()) {
              getState().getRootItems().remove(contextMenuItem.m_state);
          } else {
              ContextMenuItem parent = contextMenuItem.getParent();
              parent.m_state.getChildren().remove(contextMenuItem.m_state);
          }
  
          Set<ContextMenuItem> children = contextMenuItem.getAllChildren();
  
          m_items.remove(contextMenuItem.m_state.getId());
  
          for (ContextMenuItem child : children) {
              m_items.remove(child.m_state.getId());
          }
  
          markAsDirty();
      }
docs: Removes given context menu item from the context menu. The given item can
  be a root item or leaf item or anything in between. If given given is not
  found from the context menu structure, this method has no effect.<p>
  
  @param contextMenuItem the menu item