本文整理汇总了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);
}
}
示例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();
}
}
}
示例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
)
);
}
示例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;
}
示例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;
}
示例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;
}
}
}
示例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);
}
示例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;
}
示例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);
}