public void mouseClicked(@NotNull EditorMouseEvent event) { if (!VimPlugin.isEnabled()) return; if (event.getArea() == EditorMouseEventArea.EDITING_AREA) { VimPlugin.getMotion().processMouseClick(event.getEditor(), event.getMouseEvent()); } else if (event.getArea() != EditorMouseEventArea.ANNOTATIONS_AREA && event.getArea() != EditorMouseEventArea.FOLDING_OUTLINE_AREA) { VimPlugin.getMotion() .processLineSelection(event.getEditor(), event.getMouseEvent().getButton() == MouseEvent.BUTTON3); } }
@Nullable EditorEx editorEx = e.getEditor() instanceof EditorEx ? ((EditorEx) e.getEditor()) : null; if (editorEx != null) { @NotNull VisualPosition visualPosition = editorEx.xyToVisualPosition(e.getMouseEvent().getPoint()); int offset = editorEx.logicalPositionToOffset(editorEx.visualToLogicalPosition(visualPosition)); try { .convertPoint((Component) e.getMouseEvent().getSource(), e.getMouseEvent().getPoint(), editorEx.getComponent().getRootPane().getLayeredPane()); controller.showTooltip(editorEx, p, new DocumentFragmentTooltipRenderer(range), controller.cancelTooltip(FOLDING_TOOLTIP_GROUP, e.getMouseEvent(), true);
public int getEditorCharOffsetAndRemoveTokenHighlighters(EditorMouseEvent e) { if ( e.getArea()!=EditorMouseEventArea.EDITING_AREA ) { return -1; } MouseEvent mouseEvent=e.getMouseEvent(); Editor editor=e.getEditor(); int offset = MyActionUtils.getMouseOffset(mouseEvent, editor); // System.out.println("offset="+offset); if ( offset >= editor.getDocument().getTextLength() ) { return -1; } // Mouse has moved so make sure we don't show any token information tooltips InputPanel.clearTokenInfoHighlighters(e.getEditor()); return offset; }
@Override public void mouseClicked(EditorMouseEvent e) { final int offset = getEditorCharOffsetAndRemoveTokenHighlighters(e); if ( offset<0 ) return; final Editor editor=e.getEditor(); if ( inputPanel.previewState==null ) { return; } if ( e.getMouseEvent().getButton()==MouseEvent.BUTTON3 ) { // right click rightClick(e, inputPanel.previewState, editor, offset); return; } MouseEvent mouseEvent=e.getMouseEvent(); if ( mouseEvent.isControlDown() ) { inputPanel.setCursorToGrammarElement(e.getEditor().getProject(), inputPanel.previewState, offset); inputPanel.setCursorToHierarchyViewElement(offset); } else if ( mouseEvent.isAltDown() ) { inputPanel.setCursorToGrammarRule(e.getEditor().getProject(), inputPanel.previewState, offset); } else { inputPanel.setCursorToHierarchyViewElement(offset); } InputPanel.clearDecisionEventHighlighters(editor); }
@Override public void mouseMoved(EditorMouseEvent e){ int offset = getEditorCharOffsetAndRemoveTokenHighlighters(e); if ( offset<0 ) return; Editor editor=e.getEditor(); if ( inputPanel.previewState==null ) { return; } MouseEvent mouseEvent=e.getMouseEvent(); InputPanel.clearTokenInfoHighlighters(e.getEditor()); if ( mouseEvent.isControlDown() && inputPanel.previewState.parsingResult!=null ) { inputPanel.showTokenInfoUponCtrlKey(editor, inputPanel.previewState, offset); } else if ( mouseEvent.isAltDown() && inputPanel.previewState.parsingResult!=null ) { inputPanel.showParseRegion(e, editor, inputPanel.previewState, offset); } else { // just moving around, show any errors or hints InputPanel.showTooltips(e, editor, inputPanel.previewState, offset); } }
@Nullable EditorEx editorEx = e.getEditor() instanceof EditorEx ? ((EditorEx) e.getEditor()) : null; if (editorEx != null) { @NotNull VisualPosition visualPosition = editorEx.xyToVisualPosition(e.getMouseEvent().getPoint()); int offset = editorEx.logicalPositionToOffset(editorEx.visualToLogicalPosition(visualPosition)); try {