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); } }
public void mouseDragged(@NotNull EditorMouseEvent event) { if (!VimPlugin.isEnabled()) return; if (event.getArea() == EditorMouseEventArea.EDITING_AREA || event.getArea() != EditorMouseEventArea.ANNOTATIONS_AREA) { if (dragEditor == null) { if (event.getArea() == EditorMouseEventArea.EDITING_AREA) { mode = CommandState.SubMode.VISUAL_CHARACTER; } else if (event.getArea() != EditorMouseEventArea.ANNOTATIONS_AREA) { mode = CommandState.SubMode.VISUAL_LINE; } startOff = event.getEditor().getSelectionModel().getSelectionStart(); endOff = event.getEditor().getSelectionModel().getSelectionEnd(); } dragEditor = event.getEditor(); } }
@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); } }
@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); }
public void mouseEnteredGrammarEditorEvent(VirtualFile vfile, EditorMouseEvent e) { // clear grammar highlighters related to decision info InputPanel.removeHighlighters(e.getEditor(), ProfilerPanel.DECISION_INFO_KEY); }
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 mouseExited(EditorMouseEvent e) { InputPanel.clearTokenInfoHighlighters(e.getEditor()); }
@Override public void mouseMoved(EditorMouseEvent e) { if (!DumbService.isDumb(myProject) && e.getArea() == EditorMouseEventArea.EDITING_AREA) { @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);
@Override public void mouseClicked(EditorMouseEvent e) { Document doc = e.getEditor().getDocument(); VirtualFile vfile = FileDocumentManager.getInstance().getFile(doc); if ( vfile!=null && vfile.getName().endsWith(".g4") ) { mouseEnteredGrammarEditorEvent(vfile, e); } } }
@Override public void mouseClicked(EditorMouseEvent e) { if (e.getArea() == EditorMouseEventArea.EDITING_AREA) { @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 {