本文整理了Java中org.eclipse.jface.util.Geometry.moveInside()
方法的一些代码示例,展示了Geometry.moveInside()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Geometry.moveInside()
方法的具体详情如下:
包路径:org.eclipse.jface.util.Geometry
类名称:Geometry
方法名:moveInside
[英]Repositions the 'inner' rectangle to lie completely within the bounds of the 'outer' rectangle if possible. One use for this is to ensure that, when setting a control's bounds, that they will always lie within its parent's client area (to avoid clipping).
[中]如果可能,重新定位“内部”矩形,使其完全位于“外部”矩形的边界内。这样做的一个用途是确保在设置控件的边界时,它们始终位于其父控件的客户端区域内(以避免剪切)。
代码示例来源:origin: pentaho/pentaho-kettle
/**
* @param constrainee
* @param container
*/
private void constrainRectangleToContainer( Rectangle constrainee, Rectangle container ) {
Point originalSize = Geometry.getSize( constrainee );
Point containerSize = Geometry.getSize( container );
Point oversize = Geometry.subtract( originalSize, containerSize );
if ( oversize.x > 0 ) {
constrainee.width = originalSize.x - oversize.x;
}
if ( oversize.y > 0 ) {
constrainee.height = originalSize.y - oversize.y;
}
// Detect if the dialog was positioned outside the container
Geometry.moveInside( constrainee, container );
}
代码示例来源:origin: org.eclipse.xtext/ui
protected Point computePopupLocation() {
if (popup == null || popup.isDisposed())
return null;
LinkedPosition position = renameLinkedMode.getCurrentLinkedPosition();
if (position == null)
return null;
ISourceViewer viewer = editor.getInternalSourceViewer();
ITextViewerExtension5 viewer5 = (ITextViewerExtension5) viewer;
int widgetOffset = viewer5.modelOffset2WidgetOffset(position.offset);
StyledText textWidget = viewer.getTextWidget();
Point pos = textWidget.getLocationAtOffset(widgetOffset);
Point pSize = getExtent();
pSize.y += HAH + 1;
pos.x -= HAO;
pos.y += textWidget.getLineHeight(widgetOffset);
Point dPos = textWidget.toDisplay(pos);
Rectangle displayBounds = textWidget.getDisplay().getClientArea();
Rectangle dPopupRect = Geometry.createRectangle(dPos, pSize);
Geometry.moveInside(dPopupRect, displayBounds);
return new Point(dPopupRect.x, dPopupRect.y);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.text
/**
* Determines the graphical area covered by the given text region.
*
* @param region the region whose graphical extend must be computed
* @return the graphical extend of the given region
*/
private Rectangle computeArea(IRegion region) {
int start= 0;
int end= 0;
IRegion widgetRegion= modelRange2WidgetRange(region);
if (widgetRegion != null) {
start= widgetRegion.getOffset();
end= widgetRegion.getOffset() + widgetRegion.getLength();
}
StyledText styledText= fTextViewer.getTextWidget();
Rectangle bounds;
if (end > 0 && start < end)
bounds= styledText.getTextBounds(start, end - 1);
else {
Point loc= styledText.getLocationAtOffset(start);
bounds= new Rectangle(loc.x, loc.y, 0, styledText.getLineHeight(start));
}
Rectangle clientArea= styledText.getClientArea();
Geometry.moveInside(bounds, clientArea);
return bounds;
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
Rectangle displayBounds= textWidget.getDisplay().getClientArea();
Rectangle dPopupRect= Geometry.createRectangle(dPos, pSize);
Geometry.moveInside(dPopupRect, displayBounds);
return new Point(dPopupRect.x, dPopupRect.y);
Rectangle displayBounds= textWidget.getDisplay().getClientArea();
Rectangle dPopupRect= Geometry.createRectangle(dPos, pSize);
Geometry.moveInside(dPopupRect, displayBounds);
return new Point(dPopupRect.x, dPopupRect.y);
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text
/**
* Determines the graphical area covered by the given text region.
*
* @param region the region whose graphical extend must be computed
* @return the graphical extend of the given region
*/
private Rectangle computeArea(IRegion region) {
int start= 0;
int end= 0;
IRegion widgetRegion= modelRange2WidgetRange(region);
if (widgetRegion != null) {
start= widgetRegion.getOffset();
end= widgetRegion.getOffset() + widgetRegion.getLength();
}
StyledText styledText= fTextViewer.getTextWidget();
Rectangle bounds;
if (end > 0 && start < end)
bounds= styledText.getTextBounds(start, end - 1);
else {
Point loc= styledText.getLocationAtOffset(start);
bounds= new Rectangle(loc.x, loc.y, 0, styledText.getLineHeight(start));
}
Rectangle clientArea= styledText.getClientArea();
Geometry.moveInside(bounds, clientArea);
return bounds;
}
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
Rectangle displayBounds= textWidget.getDisplay().getClientArea();
Rectangle dPopupRect= Geometry.createRectangle(dPos, pSize);
Geometry.moveInside(dPopupRect, displayBounds);
return new Point(dPopupRect.x, dPopupRect.y);
Rectangle displayBounds= textWidget.getDisplay().getClientArea();
Rectangle dPopupRect= Geometry.createRectangle(dPos, pSize);
Geometry.moveInside(dPopupRect, displayBounds);
return new Point(dPopupRect.x, dPopupRect.y);
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
Rectangle displayBounds= textWidget.getDisplay().getClientArea();
Rectangle dPopupRect= Geometry.createRectangle(dPos, pSize);
Geometry.moveInside(dPopupRect, displayBounds);
return new Point(dPopupRect.x, dPopupRect.y);
Rectangle displayBounds= textWidget.getDisplay().getClientArea();
Rectangle dPopupRect= Geometry.createRectangle(dPos, pSize);
Geometry.moveInside(dPopupRect, displayBounds);
return new Point(dPopupRect.x, dPopupRect.y);
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.text
Monitor monitor= getClosestMonitor(display, caret);
Rectangle bounds= monitor.getClientArea();
Geometry.moveInside(caret, bounds);
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text
Monitor monitor= getClosestMonitor(display, caret);
Rectangle bounds= monitor.getClientArea();
Geometry.moveInside(caret, bounds);
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench
Geometry.moveInside(bb,cr);
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.text
Monitor monitor= getClosestMonitor(display, caret);
Rectangle bounds= monitor.getClientArea();
Geometry.moveInside(caret, bounds);
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text
Monitor monitor= getClosestMonitor(display, caret);
Rectangle bounds= monitor.getClientArea();
Geometry.moveInside(caret, bounds);
代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.workbench.renderers.swt
Rectangle displayBounds = closestMonitor.getClientArea();
if (!modelBounds.intersects(displayBounds)) {
Geometry.moveInside(modelBounds, displayBounds);
内容来源于网络,如有侵权,请联系作者删除!