Java Code Examples for com.intellij.openapi.editor.event.EditorMouseEventArea#LINE_NUMBERS_AREA

The following examples show how to use com.intellij.openapi.editor.event.EditorMouseEventArea#LINE_NUMBERS_AREA . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EditorGutterComponentImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nullable
EditorMouseEventArea getEditorMouseAreaByOffset(int offset) {
  if (isLineNumbersShown() && offset < getLineNumberAreaOffset() + getLineNumberAreaWidth()) {
    return EditorMouseEventArea.LINE_NUMBERS_AREA;
  }

  if (isAnnotationsShown() && offset < getAnnotationsAreaOffset() + getAnnotationsAreaWidth()) {
    return EditorMouseEventArea.ANNOTATIONS_AREA;
  }

  if (isLineMarkersShown() && offset < getFoldingAreaOffset()) {
    return EditorMouseEventArea.LINE_MARKERS_AREA;
  }

  if (isFoldingOutlineShown() && offset < getFoldingAreaOffset() + getFoldingAreaWidth()) {
    return EditorMouseEventArea.FOLDING_OUTLINE_AREA;
  }

  return null;
}
 
Example 2
Source File: EditorPerfDecorations.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void mouseEntered(EditorMouseEvent e) {
  final EditorMouseEventArea area = e.getArea();
  if (!hoveredOverLineMarkerArea &&
      area == EditorMouseEventArea.LINE_MARKERS_AREA ||
      area == EditorMouseEventArea.FOLDING_OUTLINE_AREA ||
      area == EditorMouseEventArea.LINE_NUMBERS_AREA) {
    // Hover is over the gutter area.
    setHoverState(true);
  }
}
 
Example 3
Source File: EditorPerfDecorations.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void mouseEntered(EditorMouseEvent e) {
  final EditorMouseEventArea area = e.getArea();
  if (!hoveredOverLineMarkerArea &&
      area == EditorMouseEventArea.LINE_MARKERS_AREA ||
      area == EditorMouseEventArea.FOLDING_OUTLINE_AREA ||
      area == EditorMouseEventArea.LINE_NUMBERS_AREA) {
    // Hover is over the gutter area.
    setHoverState(true);
  }
}
 
Example 4
Source File: OpenInEditorWithMouseAction.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void update(@Nonnull AnActionEvent e) {
  InputEvent inputEvent = e.getInputEvent();
  if (!(inputEvent instanceof MouseEvent)) {
    e.getPresentation().setEnabledAndVisible(false);
    return;
  }

  if (e.getProject() == null) {
    e.getPresentation().setEnabledAndVisible(false);
    return;
  }

  if (e.getData(OpenInEditorAction.KEY) == null) {
    e.getPresentation().setEnabledAndVisible(false);
    return;
  }

  Component component = inputEvent.getComponent();
  if (component == null) {
    e.getPresentation().setEnabledAndVisible(false);
    return;
  }

  Point point = ((MouseEvent)inputEvent).getPoint();
  Component componentAt = SwingUtilities.getDeepestComponentAt(component, point.x, point.y);
  if (!(componentAt instanceof EditorGutterComponentEx)) {
    e.getPresentation().setEnabledAndVisible(false);
    return;
  }

  Editor editor = getEditor(componentAt);
  if (editor == null) {
    e.getPresentation().setEnabledAndVisible(false);
    return;
  }

  MouseEvent convertedEvent = SwingUtilities.convertMouseEvent(inputEvent.getComponent(), (MouseEvent)inputEvent, componentAt);
  EditorMouseEventArea area = editor.getMouseEventArea(convertedEvent);
  if (area != EditorMouseEventArea.LINE_NUMBERS_AREA) {
    e.getPresentation().setEnabledAndVisible(false);
    return;
  }

  e.getPresentation().setEnabledAndVisible(true);
}
 
Example 5
Source File: DiffSideView.java    From consulo with Apache License 2.0 4 votes vote down vote up
private static boolean isInMyArea(EditorMouseEvent e) {
  return e.getArea() == EditorMouseEventArea.LINE_NUMBERS_AREA;
}