Java 类com.intellij.util.ui.GeometryUtil 实例源码

项目:intellij-ce-playground    文件:DebuggerTreeBase.java   
public MouseEvent createTooltipEvent(MouseEvent candidate) {
  TreePath path = null;

  if (candidate != null) {
    final Point treePoint = SwingUtilities.convertPoint(candidate.getComponent(), candidate.getPoint(), this);
    if (GeometryUtil.isWithin(new Rectangle(0, 0, getWidth(), getHeight()), treePoint)) {
      path = getPathForLocation(treePoint.x, treePoint.y);
    }
  }

  if (path == null) {
    if (isFocusOwner()) {
      path = getSelectionPath();
    }
  }

  if (path == null) return null;

  final int row = getRowForPath(path);
  if (row == -1) return null;

  final Rectangle bounds = getRowBounds(row);

  return new MouseEvent(this, MouseEvent.MOUSE_MOVED, System.currentTimeMillis(), 0, bounds.x,
                        bounds.y + bounds.height - bounds.height / 4, 0, false);
}
项目:intellij-ce-playground    文件:DnDManagerImpl.java   
private void showHighlighter(final Component parent, final DnDEvent aEvent, final Rectangle bounds, final int aType) {
  final JLayeredPane layeredPane = getLayeredPane(parent);
  if (layeredPane == null) {
    return;
  }

  if (isEventBeingHighlighted(aEvent)) {
    if (GeometryUtil.isWithin(myLastHighlightedRec, aEvent.getPointOn(layeredPane))) {
      return;
    }
  }

  final Rectangle rectangle = SwingUtilities.convertRectangle(parent, bounds, layeredPane);
  setLastHighlightedEvent((DnDEvent)((DnDEventImpl)aEvent).clone(), rectangle);

  Highlighters.hide();

  Highlighters.show(aType, layeredPane, rectangle, aEvent);

  if (isMessageProvided(aEvent)) {
    queueTooltip(aEvent, layeredPane, rectangle);
  }
  else {
    Highlighters.hide(DnDEvent.DropTargetHighlightingType.TEXT | DnDEvent.DropTargetHighlightingType.ERROR_TEXT);
  }
}
项目:tools-idea    文件:DebuggerTreeBase.java   
public MouseEvent createTooltipEvent(MouseEvent candidate) {
  TreePath path = null;

  if (candidate != null) {
    final Point treePoint = SwingUtilities.convertPoint(candidate.getComponent(), candidate.getPoint(), this);
    if (GeometryUtil.isWithin(new Rectangle(0, 0, getWidth(), getHeight()), treePoint)) {
      path = getPathForLocation(treePoint.x, treePoint.y);
    }
  }

  if (path == null) {
    if (isFocusOwner()) {
      path = getSelectionPath();
    }
  }

  if (path == null) return null;

  final int row = getRowForPath(path);
  if (row == -1) return null;

  final Rectangle bounds = getRowBounds(row);

  return new MouseEvent(this, MouseEvent.MOUSE_MOVED, System.currentTimeMillis(), 0, bounds.x,
                        bounds.y + bounds.height - bounds.height / 4, 0, false);
}
项目:tools-idea    文件:DnDManagerImpl.java   
private void showHighlighter(final Component parent, final DnDEvent aEvent, final Rectangle bounds, final int aType) {
  final JLayeredPane layeredPane = getLayeredPane(parent);
  if (layeredPane == null) {
    return;
  }

  if (isEventBeingHighlighted(aEvent)) {
    if (GeometryUtil.isWithin(myLastHighlightedRec, aEvent.getPointOn(layeredPane))) {
      return;
    }
  }

  final Rectangle rectangle = SwingUtilities.convertRectangle(parent, bounds, layeredPane);
  setLastHighlightedEvent((DnDEvent)((DnDEventImpl)aEvent).clone(), rectangle);

  Highlighters.hide();

  Highlighters.show(aType, layeredPane, rectangle, aEvent);

  if (isMessageProvided(aEvent)) {
    queueTooltip(aEvent, layeredPane, rectangle);
  }
  else {
    Highlighters.hide(DnDEvent.DropTargetHighlightingType.TEXT | DnDEvent.DropTargetHighlightingType.ERROR_TEXT);
  }
}
项目:consulo    文件:DnDManagerImpl.java   
private void showHighlighter(final Component parent, final DnDEvent aEvent, final Rectangle bounds, final int aType) {
  final JLayeredPane layeredPane = getLayeredPane(parent);
  if (layeredPane == null) {
    return;
  }

  if (isEventBeingHighlighted(aEvent)) {
    if (GeometryUtil.isWithin(myLastHighlightedRec, aEvent.getPointOn(layeredPane))) {
      return;
    }
  }

  final Rectangle rectangle = SwingUtilities.convertRectangle(parent, bounds, layeredPane);
  setLastHighlightedEvent((DnDEvent)((DnDEventImpl)aEvent).clone(), rectangle);

  Highlighters.hide();

  Highlighters.show(aType, layeredPane, rectangle, aEvent);

  if (isMessageProvided(aEvent)) {
    queueTooltip(aEvent, layeredPane, rectangle);
  }
  else {
    Highlighters.hide(DnDEvent.DropTargetHighlightingType.TEXT | DnDEvent.DropTargetHighlightingType.ERROR_TEXT);
  }
}
项目:consulo-java    文件:DebuggerTreeBase.java   
public MouseEvent createTooltipEvent(MouseEvent candidate) {
  TreePath path = null;

  if (candidate != null) {
    final Point treePoint = SwingUtilities.convertPoint(candidate.getComponent(), candidate.getPoint(), this);
    if (GeometryUtil.isWithin(new Rectangle(0, 0, getWidth(), getHeight()), treePoint)) {
      path = getPathForLocation(treePoint.x, treePoint.y);
    }
  }

  if (path == null) {
    if (isFocusOwner()) {
      path = getSelectionPath();
    }
  }

  if (path == null) return null;

  final int row = getRowForPath(path);
  if (row == -1) return null;

  final Rectangle bounds = getRowBounds(row);

  return new MouseEvent(this, MouseEvent.MOUSE_MOVED, System.currentTimeMillis(), 0, bounds.x,
                        bounds.y + bounds.height - bounds.height / 4, 0, false);
}