當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。