当前位置: 首页>>代码示例>>Java>>正文


Java RelativePoint.getPoint方法代码示例

本文整理汇总了Java中com.intellij.ui.awt.RelativePoint.getPoint方法的典型用法代码示例。如果您正苦于以下问题:Java RelativePoint.getPoint方法的具体用法?Java RelativePoint.getPoint怎么用?Java RelativePoint.getPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.ui.awt.RelativePoint的用法示例。


在下文中一共展示了RelativePoint.getPoint方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: calcAnnotationExtraSize

import com.intellij.ui.awt.RelativePoint; //导入方法依赖的package包/类
private void calcAnnotationExtraSize() {
  myTextAnnotationExtraSize = 0;
  if (!myEditor.isInDistractionFreeMode() || isMirrored()) return;

  Window frame = SwingUtilities.getWindowAncestor(myEditor.getComponent());
  if (frame == null) return;

  EditorSettings settings = myEditor.getSettings();
  int rightMargin = settings.getRightMargin(myEditor.getProject());
  if (rightMargin <= 0) return;

  JComponent editorComponent = myEditor.getComponent();
  RelativePoint point = new RelativePoint(editorComponent, new Point(0, 0));
  Point editorLocationInWindow = point.getPoint(frame);

  int editorLocationX = (int)editorLocationInWindow.getX();
  int rightMarginX = rightMargin * EditorUtil.getSpaceWidth(Font.PLAIN, myEditor) + editorLocationX;

  int width = editorLocationX + editorComponent.getWidth();
  if (rightMarginX < width && editorLocationX < width - rightMarginX) {
    int centeredSize = (width - rightMarginX - editorLocationX) / 2 - (getLineMarkerAreaWidth() + getLineNumberAreaWidth());
    myTextAnnotationExtraSize = Math.max(0, centeredSize - myTextAnnotationGuttersSize);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:EditorGutterComponentImpl.java

示例2: setLocation

import com.intellij.ui.awt.RelativePoint; //导入方法依赖的package包/类
@Override
public void setLocation(@NotNull RelativePoint point) {
  if (isRealPopup()) {
    myPopup.setLocation(point.getScreenPoint());
  }
  else {
    if (myCurrentIdeTooltip != null) {
      Point screenPoint = point.getScreenPoint();
      if (!screenPoint.equals(new RelativePoint(myCurrentIdeTooltip.getComponent(), myCurrentIdeTooltip.getPoint()).getScreenPoint())) {
        myCurrentIdeTooltip.setPoint(point.getPoint());
        myCurrentIdeTooltip.setComponent(point.getComponent());
        IdeTooltipManager.getInstance().show(myCurrentIdeTooltip, true, false);
      }
    }
    else {
      Point targetPoint = point.getPoint(myComponent.getParent());
      myComponent.setLocation(targetPoint);

      myComponent.revalidate();
      myComponent.repaint();
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:LightweightHint.java

示例3: actionPerformed

import com.intellij.ui.awt.RelativePoint; //导入方法依赖的package包/类
public void actionPerformed(AnActionEvent e) {
  final RelativePoint relPoint = JBPopupFactory.getInstance().guessBestPopupLocation(e.getDataContext());

  KeyboardFocusManager focusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
  Component focusOwner = focusManager.getFocusOwner();

  Point popupMenuPoint = relPoint.getPoint(focusOwner);

  final Editor editor = e.getData(CommonDataKeys.EDITOR);
  int coord = editor != null
              ? Math.max(0, popupMenuPoint.y - 1) //To avoid cursor jump to the line below. http://www.jetbrains.net/jira/browse/IDEADEV-10644
              : popupMenuPoint.y;

  focusOwner.dispatchEvent(
    new MouseEvent(
      focusOwner,
      MouseEvent.MOUSE_PRESSED,
      System.currentTimeMillis(), 0,
      popupMenuPoint.x,
      coord,
      1,
      true
    )
  );
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:ShowPopupMenuAction.java

示例4: getTabsAt

import com.intellij.ui.awt.RelativePoint; //导入方法依赖的package包/类
@Nullable
JBTabs getTabsAt(RelativePoint point) {
  Point thisPoint = point.getPoint(this);
  Component c = SwingUtilities.getDeepestComponentAt(this, thisPoint.x, thisPoint.y);
  while (c != null) {
    if (c instanceof JBTabs) {
      return (JBTabs)c;
    }
    c = c.getParent();
  }

  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:EditorsSplitters.java

示例5: update

import com.intellij.ui.awt.RelativePoint; //导入方法依赖的package包/类
@Override
public boolean update(DnDEvent aEvent) {
  aEvent.hideHighlighter();
  aEvent.setDropPossible(false, "");

  Object attached = aEvent.getAttachedObject();
  if (!(attached instanceof ChangeListDragBean)) return false;

  final ChangeListDragBean dragBean = (ChangeListDragBean)attached;
  if (dragBean.getSourceComponent() != ChangesListView.this) return false;
  dragBean.setTargetNode(null);

  RelativePoint dropPoint = aEvent.getRelativePoint();
  Point onTree = dropPoint.getPoint(ChangesListView.this);
  final TreePath dropPath = getPathForLocation(onTree.x, onTree.y);

  if (dropPath == null) return false;

  ChangesBrowserNode dropNode = (ChangesBrowserNode)dropPath.getLastPathComponent();
  while(!((ChangesBrowserNode) dropNode.getParent()).isRoot()) {
    dropNode = (ChangesBrowserNode)dropNode.getParent();
  }

  if (!dropNode.canAcceptDrop(dragBean)) {
    return false;
  }

  final Rectangle tableCellRect = getPathBounds(new TreePath(dropNode.getPath()));
  if (fitsInBounds(tableCellRect)) {
    aEvent.setHighlighting(new RelativeRectangle(ChangesListView.this, tableCellRect), DnDEvent.DropTargetHighlightingType.RECTANGLE);
  }

  aEvent.setDropPossible(true);
  dragBean.setTargetNode(dropNode);

  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:38,代码来源:ChangesListView.java

示例6: processDropOver

import com.intellij.ui.awt.RelativePoint; //导入方法依赖的package包/类
@Override
public void processDropOver(TabInfo over, RelativePoint relativePoint) {
  final Point point = relativePoint.getPoint(getComponent());
  myShowDropLocation = shouldAddToGlobal(point);
  super.processDropOver(over, relativePoint);
  for (Map.Entry<TabInfo, TabLabel> entry : myInfo2Label.entrySet()) {
    final TabLabel label = entry.getValue();
    if (label.getBounds().contains(point) && myDropInfo != entry.getKey()) {
      select(entry.getKey(), false);
      break;
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:JBRunnerTabs.java

示例7: add

import com.intellij.ui.awt.RelativePoint; //导入方法依赖的package包/类
@Override
public void add(@NotNull DockableContent dockable, RelativePoint dropTarget) {
  final DockableGrid dockableGrid = (DockableGrid)dockable;
  final RunnerContentUi prev = dockableGrid.getRunnerUi();

  saveUiState();

  final List<Content> contents = dockableGrid.getContents();
  final boolean wasRestoring = myOriginal != null && myOriginal.isStateBeingRestored();
  setStateIsBeingRestored(true, this);
  try {
    final Point point = dropTarget != null ? dropTarget.getPoint(myComponent) : null;
    boolean hadGrid = !myTabs.shouldAddToGlobal(point);

    for (Content content : contents) {
      final View view = getStateFor(content);
      if (view.isMinimizedInGrid()) continue;
      prev.myManager.removeContent(content, false);
      myManager.removeContent(content, false);
      if (hadGrid && !wasRestoring) {
        view.assignTab(getTabFor(getSelectedGrid()));
        view.setPlaceInGrid(calcPlaceInGrid(point, myComponent.getSize()));
      }
      else if (contents.size() == 1 && !wasRestoring) {
        view.assignTab(null);
        view.setPlaceInGrid(myLayoutSettings.getDefaultGridPlace(content));
      }
      view.setWindow(myWindow);
      myManager.addContent(content);
    }
  } finally {
    setStateIsBeingRestored(false, this);
  }

  saveUiState();

  updateTabsUI(true);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:RunnerContentUi.java

示例8: getTabsAt

import com.intellij.ui.awt.RelativePoint; //导入方法依赖的package包/类
@Nullable
private JBTabs getTabsAt(DockableContent content, RelativePoint point) {
  if (content instanceof DockableGrid) {
    final Point p = point.getPoint(getComponent());
    Component c = SwingUtilities.getDeepestComponentAt(getComponent(), p.x, p.y);
    while (c != null) {
      if (c instanceof JBRunnerTabs) {
        return (JBTabs)c;
      }
      c = c.getParent();
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:RunnerContentUi.java

示例9: showTextBelow

import com.intellij.ui.awt.RelativePoint; //导入方法依赖的package包/类
public static void showTextBelow(JComponent component, String text) {
  final RelativePoint calloutPoint = RelativePoint.getSouthWestOf(component);
  calloutPoint.getPoint().x += 5;
  Callout.showText(calloutPoint, Callout.SOUTH_EAST, text);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:Callout.java


注:本文中的com.intellij.ui.awt.RelativePoint.getPoint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。