code: @SuppressWarnings("unchecked")
      public static <T> void defaultHandleContextMenuForMultiselect(
          Table table,
          CmsContextMenu menu,
          ItemClickEvent event,
          List<I_CmsSimpleContextMenuEntry<Collection<T>>> entries) {
  
          if (!event.isCtrlKey() && !event.isShiftKey()) {
              if (event.getButton().equals(MouseButton.RIGHT)) {
                  Collection<T> oldValue = ((Collection<T>)table.getValue());
                  if (oldValue.isEmpty() || !oldValue.contains(event.getItemId())) {
                      table.setValue(new HashSet<Object>(Arrays.asList(event.getItemId())));
                  }
                  Collection<T> selection = (Collection<T>)table.getValue();
                  menu.setEntries(entries, selection);
                  menu.openForTable(event, table);
              }
          }
  
      }
docs: Simple context menu handler for multi-select tables.
  
  @param table the table
  @param menu the table's context menu
  @param event the click event
  @param entries the context menu entries