void (@NotNull final MouseEvent e) { myLastMousePressedLocation = xyToLogicalPosition(e.getPoint()); myCaretStateBeforeLastPress = isToggleCaretEvent(e) ? myCaretModel.getCaretsAndSelections() : Collections.<CaretState>emptyList(); myCurrentDragIsSubstantial = false; clearDraggedRange(); mySelectionTweaked = false; myMousePressedEvent = e; EditorMouseEvent event = new EditorMouseEvent(EditorImpl.this, e, getMouseEventArea(e)); myExpectedCaretOffset = logicalPositionToOffset(myLastMousePressedLocation); try { for (EditorMouseListener mouseListener : myMouseListeners) { mouseListener.mousePressed(event); } } finally { myExpectedCaretOffset = -1; } if (event.getArea() == EditorMouseEventArea.LINE_MARKERS_AREA) { myDragOnGutterSelectionStartLine = EditorUtil.yPositionToLogicalLine(EditorImpl.this, e); } // On some systems (for example on Linux) popup trigger is MOUSE_PRESSED event. // But this trigger is always consumed by popup handler. In that case we have to // also move caret. if (event.isConsumed() && !(event.getMouseEvent().isPopupTrigger() || event.getArea() == EditorMouseEventArea.EDITING_AREA)) { return; } if (myCommandProcessor != null) { Runnable runnable = new Runnable() { @Override public void run() { if (processMousePressed(e) && myProject != null && !myProject.isDefault()) { IdeDocumentHistory.getInstance(myProject).includeCurrentCommandAsNavigation(); } } }; myCommandProcessor .executeCommand(myProject, runnable, "", DocCommandGroupId.noneGroupId(getDocument()), UndoConfirmationPolicy.DEFAULT, getDocument()); } else { processMousePressed(e); } }