org.eclipse.swt.SWT.error()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(83)

本文整理了Java中org.eclipse.swt.SWT.error()方法的一些代码示例,展示了SWT.error()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SWT.error()方法的具体详情如下:
包路径:org.eclipse.swt.SWT
类名称:SWT
方法名:error

SWT.error介绍

[英]Throws an appropriate exception based on the passed in error code.
[中]

代码示例

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt

static ExpandBar checkNull( ExpandBar control ) {
 if( control == null ) {
  SWT.error( SWT.ERROR_NULL_ARGUMENT );
 }
 return control;
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt

public static int computeColorNr( int red, int green, int blue, int alpha ) {
 if(    red > 255 || red < 0
   || green > 255 || green < 0
   || blue > 255 || blue < 0
   || alpha > 255 || alpha < 0 )
 {
  SWT.error( SWT.ERROR_INVALID_ARGUMENT );
 }
 return red | green << 8 | blue << 16 | alpha << 24;
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt

static float[] checkTransform( float[] elements ) {
 if( elements == null ) {
  SWT.error( SWT.ERROR_NULL_ARGUMENT );
 }
 if( elements.length < 6 ) {
  SWT.error( SWT.ERROR_INVALID_ARGUMENT );
 }
 return elements;
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

void setLineWidthInPixels(int lineWidth) {
  if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
  if (data.lineWidth == lineWidth) return;
  data.lineWidth = lineWidth;
  data.state &= ~(LINE_WIDTH | DRAW_OFFSET);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

/**
 * Throws an appropriate exception based on the passed in error code.
 *
 * @param code the SWT error code
 */
public static void error (int code) {
  error (code, null);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

/**
* Sets the minimum width of the list.
*
* @param width the minimum width of the list
*/
public void setMinimumWidth (int width) {
  if (width < 0)
    SWT.error(SWT.ERROR_INVALID_ARGUMENT);

  minimumWidth = width;
}
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.text

@Override
public void replaceTextRange(int pos, int length, String text) {
  try {
    fDocument.replace(pos, length, text);
  } catch (BadLocationException x) {
    SWT.error(SWT.ERROR_INVALID_ARGUMENT);
  }
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt

public void setItem( int index, String string ) {
 if( string == null ) {
  SWT.error( SWT.ERROR_NULL_ARGUMENT );
 }
 checkIndex( index );
 items.set( index, string );
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt

/**
 * Returns <code>true</code> if the Transform represents the identity matrix and false otherwise.
 *
 * @return <code>true</code> if the receiver is an identity Transform, and <code>false</code>
 *         otherwise
 */
public boolean isIdentity() {
 if( isDisposed() ) {
  SWT.error( SWT.ERROR_GRAPHIC_DISPOSED );
 }
 return Arrays.equals( elements, IDENTITY_MATRIX );
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt

@Override
public void addBrowserNavigationListener( BrowserNavigationListener listener ) {
 if( listener == null ) {
  SWT.error( SWT.ERROR_NULL_ARGUMENT );
 }
 listeners.add( listener );
 if( listeners.size() == 1 ) {
  remoteObject.listen( PROP_NAVIGATION_LISTENER, true );
 }
}

代码示例来源:origin: org.eclipse.neoscada.utils/org.eclipse.scada.ui.blink

protected void checkDisplay ()
{
  if ( Display.getCurrent () != this.display )
  {
    SWT.error ( SWT.ERROR_THREAD_INVALID_ACCESS );
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

void init (FontData fd) {
  if (fd == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
  LOGFONT logFont = fd.data;
  int lfHeight = logFont.lfHeight;
  logFont.lfHeight = device.computePixels(fd.height);
  handle = OS.CreateFontIndirect(logFont);
  logFont.lfHeight = lfHeight;
  if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

/**
 * Read and return the next block or extension identifier from the file.
 */
int readID() {
  try {
    return inputStream.read();
  } catch (IOException e) {
    SWT.error(SWT.ERROR_IO, e);
  }
  return -1;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.text

@Override
public String getTextRange(int offset, int length) {
  try {
    return getDocumentForRead().get(offset, length);
  } catch (BadLocationException x) {
    SWT.error(SWT.ERROR_INVALID_ARGUMENT);
    return null;
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

void moveToInPixels(float x, float y) {
  if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
  Gdip.GraphicsPath_StartFigure(handle);
  currentPoint.X = startPoint.X = x;
  currentPoint.Y = startPoint.Y = y;
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt

public void add( String string, int index ) {
 if( string == null ) {
  SWT.error( SWT.ERROR_NULL_ARGUMENT );
 }
 if( index != getItemCount() ) {
  checkIndex( index );
 }
 items.add( index, string );
 adjustSelectionIdicesAfterAdd( index );
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

void fillRoundRectangleInPixels (int x, int y, int width, int height, int arcWidth, int arcHeight) {
  if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
  checkGC(FILL);
  if (data.gdipGraphics != 0) {
    fillRoundRectangleGdip(data.gdipGraphics, data.gdipBrush, x, y, width, height, arcWidth, arcHeight);
    return;
  }
  if ((data.style & SWT.MIRRORED) != 0) x--;
  OS.RoundRect(handle, x,y,x+width+1,y+height+1,arcWidth, arcHeight);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

void subtractInPixels (int x, int y, int width, int height) {
  if (width < 0 || height < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
  int /*long*/ rectRgn = OS.CreateRectRgn (x, y, x + width, y + height);
  OS.CombineRgn (handle, handle, rectRgn, OS.RGN_DIFF);
  OS.DeleteObject (rectRgn);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface

/**
 * Calculates the default font and returns the result.
 * This method creates a font that must be disposed.
 */
Font calculateDefaultFont() {
  Display current = Display.getCurrent();
  if (current == null) // can't do much without Display
    SWT.error(SWT.ERROR_THREAD_INVALID_ACCESS);
  return new Font(current, current.getSystemFont().getFontData());
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

/*public*/ FontData(String name, float height, int style) {
  if (name == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
  data = OS.IsUnicode ? (LOGFONT)new LOGFONTW() : new LOGFONTA();
  setName(name);
  setHeight(height);
  setStyle(style);
  // We set the charset field so that
  // wildcard searching will work properly
  // out of the box
  data.lfCharSet = (byte)OS.DEFAULT_CHARSET;
}

相关文章