// //////////////////////////////////////////////////////////////////////
  // MENU
  // //////////////////////////////////////////////////////////////////////
  public void getMenu(Menu menu) {
    if (parentFolder == null) {
      return;
    }

    if (getActivity() instanceof MainActivity) {
      getMenu(alfSession, menu, parentFolder);

      if (hasDocument()) {
        displayMenuItem =
            menu.add(
                Menu.NONE,
                MenuActionItem.MENU_DISPLAY_GALLERY,
                Menu.FIRST + MenuActionItem.MENU_DISPLAY_GALLERY,
                R.string.display_gallery);
        displayMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
      }
    } else if (getActivity() instanceof PublicDispatcherActivity) {
      Permissions permission =
          alfSession.getServiceRegistry().getDocumentFolderService().getPermissions(parentFolder);

      if (permission.canAddChildren()) {
        MenuItem mi =
            menu.add(
                Menu.NONE,
                MenuActionItem.MENU_CREATE_FOLDER,
                Menu.FIRST + MenuActionItem.MENU_CREATE_FOLDER,
                R.string.folder_create);
        mi.setIcon(R.drawable.ic_add_folder);
        mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
      }
    }

    // Uncomment for enabling view switcher
    /*
     * displayMenuItem = menu.add(Menu.NONE,
     * MenuActionItem.MENU_DISPLAY_ITEMS, Menu.FIRST +
     * MenuActionItem.MENU_DISPLAY_ITEMS, R.string.display_views); switch
     * (displayMode) { case DISPLAY_LIST:
     * displayMenuItem.setIcon(R.drawable.ic_action_list); break; case
     * DISPLAY_LIST_LARGE:
     * displayMenuItem.setIcon(R.drawable.ic_action_tiles_small); break;
     * case DISPLAY_GRID:
     * displayMenuItem.setIcon(R.drawable.ic_action_list_2); break; default:
     * break; }
     * displayMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
     */
  }
 public static void getMenu(AlfrescoSession session, Menu menu, Folder parentFolder) {
   getMenu(session, menu, parentFolder, false);
 }
 // //////////////////////////////////////////////////////////////////////
 // MENU
 // //////////////////////////////////////////////////////////////////////
 public void getMenu(Menu menu) {
   getMenu(alfSession, menu, parentFolder);
 }