Java 类com.intellij.openapi.editor.event.EditorMouseAdapter 实例源码

项目:review-board-idea-plugin    文件:CommentsDiffTool.java   
@Override
public void show(DiffRequest request) {
    final FrameWrapper frameWrapper = new FrameWrapper(request.getProject(), request.getGroupKey());
    final DiffPanelImpl diffPanel = createDiffPanelImpl(request, frameWrapper.getFrame(), frameWrapper);
    final Editor editor = diffPanel.getEditor2();
    updateHighLights(editor);

    editor.addEditorMouseListener(new EditorMouseAdapter() {
        @Override
        public void mouseClicked(EditorMouseEvent e) {
            if (e.getArea() != null && e.getArea().equals(EditorMouseEventArea.LINE_MARKERS_AREA)) {
                final Point locationOnScreen = e.getMouseEvent().getLocationOnScreen();
                final int lineNumber = EditorUtil.yPositionToLogicalLine(editor, e.getMouseEvent()) + 1;
                showCommentsView(locationOnScreen, lineNumber, editor);
            }
        }
    });

    DiffUtil.initDiffFrame(request.getProject(), frameWrapper, diffPanel, diffPanel.getComponent());
    frameWrapper.setTitle(request.getWindowTitle());
    frameWrapper.show();
}