@Override
    public void mouseClicked(MouseEvent e) {
      Point point = e.getPoint();
      int index = list.locationToIndex(point);
      if (index != -1) {
        Rectangle cellBounds = list.getCellBounds(index, index);
        if (!cellBounds.contains(point) && (InputEvent.CTRL_DOWN_MASK & e.getModifiersEx()) != InputEvent.CTRL_DOWN_MASK) {
          index = -1;
          list.clearSelection();
        }
      }
      if (index != -1) {
        if (MouseEvent.BUTTON1 == e.getButton() && e.getClickCount() == 2) {
          // Double click
          list.setSelectedIndex(index);
          VirtualFile selected = list.getSelectedValue();
          if (selected != null) {
            if (selected.isDirectory()) {
              thumbnailView.setRoot(selected);
            }
            else {
              FileEditorManager fileEditorManager = FileEditorManager.getInstance(thumbnailView.getProject());
              fileEditorManager.openFile(selected, true);
            }
            e.consume();
          }
        }
        if (MouseEvent.BUTTON3 == e.getButton() && e.getClickCount() == 1) {
          // Ensure that we have selection
          if ((InputEvent.CTRL_DOWN_MASK & e.getModifiersEx()) != InputEvent.CTRL_DOWN_MASK) {
            // Ctrl is not pressed
            list.setSelectedIndex(index);
          }
          else {
            // Ctrl is pressed
            list.getSelectionModel().addSelectionInterval(index, index);
          }
          // Single right click
          ActionManager actionManager = ActionManager.getInstance();
          ActionGroup actionGroup = (ActionGroup)actionManager.getAction(ThumbnailViewActions.GROUP_POPUP);
          ActionPopupMenu menu = actionManager.createActionPopupMenu(ThumbnailViewActions.ACTION_PLACE, actionGroup);
          JPopupMenu popupMenu = menu.getComponent();
          popupMenu.pack();
          JBPopupMenu.showByEvent(e, popupMenu);
          e.consume();
        }
      }
    }
@Override
    public void mouseClicked(MouseEvent e)