本文整理了Java中org.eclipse.jface.util.Util.getClosestMonitor()
方法的一些代码示例,展示了Util.getClosestMonitor()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.getClosestMonitor()
方法的具体详情如下:
包路径:org.eclipse.jface.util.Util
类名称:Util
方法名:getClosestMonitor
[英]Returns the monitor whose client area contains the given point. If no monitor contains the point, returns the monitor that is closest to the point. If this is ever made public, it should be moved into a separate utility class.
[中]返回其客户端区域包含给定点的监视器。如果没有监视器包含该点,则返回最接近该点的监视器。如果这是公开的,它应该被转移到一个单独的实用程序类中。
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench
/**
* This method was copy/pasted from JFace.
*/
private Rectangle getConstrainedShellBounds(Display display, Rectangle preferredSize) {
Rectangle result = new Rectangle(preferredSize.x, preferredSize.y, preferredSize.width,
preferredSize.height);
Point topLeft = new Point(preferredSize.x, preferredSize.y);
Monitor mon = Util.getClosestMonitor(display, topLeft);
Rectangle bounds = mon.getClientArea();
if (result.height > bounds.height) {
result.height = bounds.height;
}
if (result.width > bounds.width) {
result.width = bounds.width;
}
result.x = Math.max(bounds.x, Math.min(result.x, bounds.x + bounds.width - result.width));
result.y = Math.max(bounds.y, Math.min(result.y, bounds.y + bounds.height - result.height));
return result;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface
preferredSize.width, preferredSize.height);
Monitor mon = Util.getClosestMonitor(getShell().getDisplay(), Geometry
.centerPoint(result));
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.text
/**
* Crops the given bounds such that they lie completely on the closest monitor.
*
* @param bounds shell bounds to crop
* @since 3.4
*/
void cropToClosestMonitor(Rectangle bounds) {
Rectangle monitorBounds= Util.getClosestMonitor(fSubjectControl.getDisplay(), Geometry.centerPoint(bounds)).getClientArea();
bounds.intersect(monitorBounds);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.text
/**
* Gets the closest monitor given an anchor and the subject area.
*
* @param area the subject area
* @param anchor the anchor
* @return the monitor closest to the edge of <code>area</code> defined by
* <code>anchor</code>
* @since 3.3
*/
private Monitor getClosestMonitor(Rectangle area, Anchor anchor) {
Point center;
if (ANCHOR_GLOBAL == anchor)
center= Geometry.centerPoint(area);
else
center= Geometry.centerPoint(Geometry.getExtrudedEdge(area, 0, anchor.getSWTFlag()));
return Util.getClosestMonitor(fSubjectControl.getDisplay(), center);
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
pt= fParentComposite.toDisplay(pt);
Rectangle monitor= Util.getClosestMonitor(shell.getDisplay(), pt).getClientArea();
int overlap= (pt.x + width) - (monitor.x + monitor.width);
if (overlap > 0)
代码示例来源:origin: org.eclipse.platform/org.eclipse.debug.ui
pt= fParentComposite.toDisplay(pt);
Rectangle monitor = Util.getClosestMonitor(shell.getDisplay(), pt).getClientArea();
int overlap= (pt.x + width) - (monitor.x + monitor.width);
if (overlap > 0) {
代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.workbench.renderers.swt
Monitor closestMonitor = Util.getClosestMonitor(display, Geometry.centerPoint(modelBounds));
Rectangle displayBounds = closestMonitor.getClientArea();
if (!modelBounds.intersects(displayBounds)) {
内容来源于网络,如有侵权,请联系作者删除!