本文整理了Java中org.eclipse.swt.graphics.Rectangle.isEmpty
方法的一些代码示例,展示了Rectangle.isEmpty
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Rectangle.isEmpty
方法的具体详情如下:
包路径:org.eclipse.swt.graphics.Rectangle
类名称:Rectangle
方法名:isEmpty
[英]Returns true
if the receiver does not cover any area in the (x, y) coordinate plane, and false
if the receiver does cover some area in the plane.
A rectangle is considered to cover area in the (x, y) coordinate plane if both its width and height are non-zero.
[中]如果接收器未覆盖(x,y)坐标平面中的任何区域,则返回true
,如果接收器覆盖平面中的某些区域,则返回false
。
如果矩形的宽度和高度都不为零,则认为它在(x,y)坐标平面中覆盖面积。
代码示例来源:origin: org.eclipse/org.eclipse.compare
public int getViewportHeight() {
StyledText te= getTextWidget();
Rectangle clArea= te.getClientArea();
if (!clArea.isEmpty())
return clArea.height;
return 0;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.text
/**
* Returns the number of lines that can fully fit into the viewport. This is computed by
* dividing the widget's client area height by the widget's line height. The result is only
* accurate if the widget does not use variable line heights - for that reason, clients should
* not use this method any longer and use the client area height of the text widget to find out
* how much content fits into it.
*
* @return the view port height in lines
* @deprecated as of 3.2
*/
@Deprecated
protected int getVisibleLinesInViewport() {
if (fTextWidget != null) {
Rectangle clArea= fTextWidget.getClientArea();
if (!clArea.isEmpty())
return clArea.height / fTextWidget.getLineHeight();
}
return -1;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text
/**
* Returns the number of lines that can fully fit into the viewport. This is computed by
* dividing the widget's client area height by the widget's line height. The result is only
* accurate if the widget does not use variable line heights - for that reason, clients should
* not use this method any longer and use the client area height of the text widget to find out
* how much content fits into it.
*
* @return the view port height in lines
* @deprecated as of 3.2
*/
@Deprecated
protected int getVisibleLinesInViewport() {
if (fTextWidget != null) {
Rectangle clArea= fTextWidget.getClientArea();
if (!clArea.isEmpty())
return clArea.height / fTextWidget.getLineHeight();
}
return -1;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x
/**
* Returns <code>true</code> if any text in the widget is selected,
* and <code>false</code> otherwise.
*
* @return the text selection state
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @since 3.103
*/
public boolean isTextSelected() {
checkWidget();
if (blockSelection && blockXLocation != -1) {
Rectangle rect = getBlockSelectionPosition();
return !rect.isEmpty();
}
return selection.y != selection.x;
}
/**
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc
/**
* Returns <code>true</code> if any text in the widget is selected,
* and <code>false</code> otherwise.
*
* @return the text selection state
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @since 3.103
*/
public boolean isTextSelected() {
checkWidget();
if (blockSelection && blockXLocation != -1) {
Rectangle rect = getBlockSelectionPosition();
return !rect.isEmpty();
}
return selection.y != selection.x;
}
/**
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
/**
* Returns <code>true</code> if any text in the widget is selected,
* and <code>false</code> otherwise.
*
* @return the text selection state
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @since 3.103
*/
public boolean isTextSelected() {
checkWidget();
if (blockSelection && blockXLocation != -1) {
Rectangle rect = getBlockSelectionPosition();
return !rect.isEmpty();
}
return selection.y != selection.x;
}
/**
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc
/**
* Returns <code>true</code> if any text in the widget is selected,
* and <code>false</code> otherwise.
*
* @return the text selection state
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @since 3.103
*/
public boolean isTextSelected() {
checkWidget();
if (blockSelection && blockXLocation != -1) {
Rectangle rect = getBlockSelectionPosition();
return !rect.isEmpty();
}
return selection.y != selection.x;
}
/**
代码示例来源:origin: org.eclipse/org.eclipse.compare
public int getViewportLines() {
StyledText te= getTextWidget();
Rectangle clArea= te.getClientArea();
if (!clArea.isEmpty())
return clArea.height / te.getLineHeight();
return 0;
}
代码示例来源:origin: org.eclipse/org.eclipse.compare
private static void reveal(MergeSourceViewer v, Position p) {
if (v != null && p != null) {
StyledText st= v.getTextWidget();
if (st != null) {
Rectangle r= st.getClientArea();
if (!r.isEmpty()) // workaround for #7320: Next diff scrolls when going into current diff
v.revealRange(p.offset, p.length);
}
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.compare
public int getViewportHeight() {
StyledText te= getSourceViewer().getTextWidget();
Rectangle clArea= te.getClientArea();
if (!clArea.isEmpty())
return clArea.height;
return 0;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text
/**
* Returns the number of lines in the view port.
*
* @param textWidget the styled text widget
* @return the number of lines visible in the view port <code>-1</code> if there's no client
* area
* @deprecated this method should not be used - it relies on the widget using a uniform line
* height
*/
@Deprecated
static int getVisibleLinesInViewport(StyledText textWidget) {
if (textWidget != null) {
Rectangle clArea= textWidget.getClientArea();
if (!clArea.isEmpty()) {
int firstPixel= 0;
int lastPixel= clArea.height - 1; // XXX: what about margins? don't take trims as they include scrollbars
int first= JFaceTextUtil.getLineIndex(textWidget, firstPixel);
int last= JFaceTextUtil.getLineIndex(textWidget, lastPixel);
return last - first;
}
}
return -1;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.text
/**
* Returns the number of lines in the view port.
*
* @param textWidget the styled text widget
* @return the number of lines visible in the view port <code>-1</code> if there's no client
* area
* @deprecated this method should not be used - it relies on the widget using a uniform line
* height
*/
@Deprecated
static int getVisibleLinesInViewport(StyledText textWidget) {
if (textWidget != null) {
Rectangle clArea= textWidget.getClientArea();
if (!clArea.isEmpty()) {
int firstPixel= 0;
int lastPixel= clArea.height - 1; // XXX: what about margins? don't take trims as they include scrollbars
int first= JFaceTextUtil.getLineIndex(textWidget, firstPixel);
int last= JFaceTextUtil.getLineIndex(textWidget, lastPixel);
return last - first;
}
}
return -1;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.compare
public int getViewportLines() {
StyledText te= getSourceViewer().getTextWidget();
Rectangle clArea= te.getClientArea();
if (!clArea.isEmpty())
return clArea.height / te.getLineHeight();
return 0;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.compare
private static void reveal(MergeSourceViewer v, Position p) {
if (v != null && p != null) {
StyledText st= v.getSourceViewer().getTextWidget();
if (st != null) {
Rectangle r= st.getClientArea();
if (!r.isEmpty()) // workaround for #7320: Next diff scrolls when going into current diff
v.getSourceViewer().revealRange(p.offset, p.length);
}
}
}
代码示例来源:origin: BiglySoftware/BiglyBT
public void invokeSWTPaintListeners(GC gc) {
if (getBounds().isEmpty()) {
return;
}
if (tableColumn != null) {
Object[] swtPaintListeners = tableColumn.getCellOtherListeners("SWTPaint");
if (swtPaintListeners != null) {
for (int i = 0; i < swtPaintListeners.length; i++) {
try {
TableCellSWTPaintListener l = (TableCellSWTPaintListener) swtPaintListeners[i];
l.cellPaint(gc, this);
} catch (Throwable e) {
Debug.printStackTrace(e);
}
}
}
}
if (cellSWTPaintListeners == null) {
return;
}
for (int i = 0; i < cellSWTPaintListeners.size(); i++) {
try {
TableCellSWTPaintListener l = (TableCellSWTPaintListener) (cellSWTPaintListeners.get(i));
l.cellPaint(gc, this);
} catch (Throwable e) {
Debug.printStackTrace(e);
}
}
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text
@Override
protected void computeInformation() {
IRegion region= fHover.getHoverRegion(fTextViewer, -1);
if (region == null) {
setInformation(null, null);
return;
}
Rectangle area= JFaceTextUtil.computeArea(region, fTextViewer);
if (area == null || area.isEmpty()) {
setInformation(null, null);
return;
}
Object information= fHover.getHoverInfo2(fTextViewer, region);
setCustomInformationControlCreator(fHover.getHoverControlCreator());
setInformation(information, area);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.text
@Override
protected void computeInformation() {
IRegion region= fHover.getHoverRegion(fTextViewer, -1);
if (region == null) {
setInformation(null, null);
return;
}
Rectangle area= JFaceTextUtil.computeArea(region, fTextViewer);
if (area == null || area.isEmpty()) {
setInformation(null, null);
return;
}
Object information= fHover.getHoverInfo2(fTextViewer, region);
setCustomInformationControlCreator(fHover.getHoverControlCreator());
setInformation(information, area);
}
代码示例来源:origin: BiglySoftware/BiglyBT
@Override
public Image getBackgroundImage() {
if (bounds == null || bounds.isEmpty()) {
return null;
}
Image image = new Image(Display.getDefault(), bounds.width
- (marginWidth * 2), bounds.height - (marginHeight * 2));
GC gc = new GC(image);
gc.setForeground(getBackgroundSWT());
gc.setBackground(getBackgroundSWT());
gc.fillRectangle(0, 0, bounds.width, bounds.height);
gc.dispose();
return image;
}
代码示例来源:origin: BiglySoftware/BiglyBT
/**
* @param image
* @param bounds
* @param text
*/
public static void obfuscateArea(Image image, Rectangle bounds, String text) {
if (bounds.isEmpty())
return;
if (text == null || text.length() == 0) {
obfuscateArea(image, bounds);
return;
}
GC gc = new GC(image);
try {
Device device = image.getDevice();
gc.setBackground(Colors.getSystemColor(device, SWT.COLOR_WHITE));
gc.setForeground(Colors.getSystemColor(device, SWT.COLOR_RED));
gc.fillRectangle(bounds);
gc.drawRectangle(bounds);
Utils.setClipping(gc, bounds);
gc.drawText(text, bounds.x + 2, bounds.y + 1);
} finally {
gc.dispose();
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc
result[0] = 0;
Rectangle rect = browser.getClientArea ();
if (rect.isEmpty ()) {
rect.width = 1;
rect.height = 1;
内容来源于网络,如有侵权,请联系作者删除!