private void handleMultipleClicks(MousePressedEvent e) {
   if (e.getClickCount() == 2) {
     inWordSelectionMode = true;
     model.setSelectionLocation(model.findWordsLeftEdge(model.getCaretLocation()));
     model.setCaretLocation(model.findWordsRightEdge(model.getCaretLocation()));
   } else if (e.getClickCount() == 3) {
     model.selectAll();
   }
 }
  public void processMousePressed(MousePressedEvent e) {
    final Panel panel = e.getRecipient();
    inWordSelectionMode = false;

    TextLocation location = model.getLocationAt(e.getLocation());
    model.startSelection(location);
    model.setCaretLocation(location, XOffsetStrategy.FITTING, YOffsetStrategy.FITTING);
    model.setCaretOn(true);

    handleMultipleClicks(e);

    panel.markAsDirty();
    panel.getStage().getKeyListener().focusOn(panel);

    lastClickTime = System.currentTimeMillis();
  }