本文整理了Java中org.eclipse.swt.widgets.Widget.checkWidget()
方法的一些代码示例,展示了Widget.checkWidget()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Widget.checkWidget()
方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Widget
类名称:Widget
方法名:checkWidget
[英]Throws an SWTException
if the receiver can not be accessed by the caller. This may include both checks on the state of the receiver and more generally on the entire execution context. This method should be called by widget implementors to enforce the standard SWT invariants.
Currently, it is an error to invoke any method (other than isDisposed()
) on a widget that has had its dispose()
method called. It is also an error to call widget methods from any thread that is different from the thread that created the widget.
In future releases of SWT, there may be more or fewer error checks and exceptions may be thrown for different reasons.
[中]如果呼叫方无法访问接收器,则抛出SWTException
。这可能包括对接收器状态的检查,以及更一般地对整个执行上下文的检查。这个方法应该由小部件实现者调用,以强制执行标准SWT不变量。
目前,在调用了dispose()
方法的小部件上调用任何方法(除了isDisposed()
)都是错误的。从与创建小部件的线程不同的任何线程调用小部件方法也是一个错误。
在SWT的未来版本中,可能会有更多或更少的错误检查,并且可能会出于不同的原因引发异常。
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x
/**
* Returns the receiver's style information.
* <p>
* Note that the value which is returned by this method <em>may
* not match</em> the value which was provided to the constructor
* when the receiver was created. This can occur when the underlying
* operating system does not support a particular combination of
* requested styles. For example, if the platform widget used to
* implement a particular SWT widget always has scroll bars, the
* result of calling this method would always have the
* <code>SWT.H_SCROLL</code> and <code>SWT.V_SCROLL</code> bits set.
* </p>
*
* @return the style bits
*
* @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>
*/
public int getStyle () {
checkWidget ();
return style;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
/**
* Returns the application defined widget data associated
* with the receiver, or null if it has not been set. The
* <em>widget data</em> is a single, unnamed field that is
* stored with every widget.
* <p>
* Applications may put arbitrary objects in this field. If
* the object stored in the widget data needs to be notified
* when the widget is disposed of, it is the application's
* responsibility to hook the Dispose event on the widget and
* do so.
* </p>
*
* @return the widget data
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - when the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - when called from the wrong thread</li>
* </ul>
*
* @see #setData(Object)
*/
public Object getData () {
checkWidget();
return (state & KEYED_DATA) != 0 ? ((Object []) data) [0] : data;
}
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
/**
* Returns the application defined widget data associated
* with the receiver, or null if it has not been set. The
* <em>widget data</em> is a single, unnamed field that is
* stored with every widget.
* <p>
* Applications may put arbitrary objects in this field. If
* the object stored in the widget data needs to be notified
* when the widget is disposed of, it is the application's
* responsibility to hook the Dispose event on the widget and
* do so.
* </p>
*
* @return the widget data
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - when the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - when called from the wrong thread</li>
* </ul>
*
* @see #setData(Object)
*/
public Object getData () {
checkWidget();
return (state & KEYED_DATA) != 0 ? ((Object []) data) [0] : data;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
/**
* Returns <code>true</code> if there are any listeners
* for the specified event type associated with the receiver,
* and <code>false</code> otherwise. The event type is one of
* the event constants defined in class <code>SWT</code>.
*
* @param eventType the type of event
* @return true if the event is hooked
*
* @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>
*
* @see SWT
*/
public boolean isListening (int eventType) {
checkWidget();
return hooks (eventType);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc
/**
* Returns <code>true</code> if there are any listeners
* for the specified event type associated with the receiver,
* and <code>false</code> otherwise. The event type is one of
* the event constants defined in class <code>SWT</code>.
*
* @param eventType the type of event
* @return true if the event is hooked
*
* @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>
*
* @see SWT
*/
public boolean isListening (int eventType) {
checkWidget ();
return hooks (eventType);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc
/**
* Returns <code>true</code> if there are any listeners
* for the specified event type associated with the receiver,
* and <code>false</code> otherwise. The event type is one of
* the event constants defined in class <code>SWT</code>.
*
* @param eventType the type of event
* @return true if the event is hooked
*
* @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>
*
* @see SWT
*/
public boolean isListening (int eventType) {
checkWidget ();
return hooks (eventType);
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
/**
* Returns <code>true</code> if there are any listeners
* for the specified event type associated with the receiver,
* and <code>false</code> otherwise. The event type is one of
* the event constants defined in class <code>SWT</code>.
*
* @param eventType the type of event
* @return true if the event is hooked
*
* @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>
*
* @see SWT
* @since 1.3
*/
public boolean isListening( int eventType ) {
checkWidget();
return eventTable == null ? false : eventTable.hooks( eventType );
}
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
/**
* Returns <code>true</code> if there are any listeners
* for the specified event type associated with the receiver,
* and <code>false</code> otherwise. The event type is one of
* the event constants defined in class <code>SWT</code>.
*
* @param eventType the type of event
* @return true if the event is hooked
*
* @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>
*
* @see SWT
*/
public boolean isListening (int eventType) {
checkWidget();
return hooks (eventType);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x
/**
* Returns <code>true</code> if there are any listeners
* for the specified event type associated with the receiver,
* and <code>false</code> otherwise. The event type is one of
* the event constants defined in class <code>SWT</code>.
*
* @param eventType the type of event
* @return true if the event is hooked
*
* @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>
*
* @see SWT
*/
public boolean isListening (int eventType) {
checkWidget ();
return hooks (eventType);
}
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
/**
* Removes the listener from the collection of listeners who will
* be notified when the widget is disposed.
*
* @param listener the listener which should no longer be notified
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
* </ul>
* @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>
*
* @see DisposeListener
* @see #addDisposeListener
*/
public void removeDisposeListener (DisposeListener listener) {
checkWidget();
if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
if (eventTable == null) return;
eventTable.unhook (SWT.Dispose, listener);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x
/**
* Removes the listener from the collection of listeners who will
* be notified when the widget is disposed.
*
* @param listener the listener which should no longer be notified
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
* </ul>
* @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>
*
* @see DisposeListener
* @see #addDisposeListener
*/
public void removeDisposeListener (DisposeListener listener) {
checkWidget ();
if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
if (eventTable == null) return;
eventTable.unhook (SWT.Dispose, listener);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc
/**
* Removes the listener from the collection of listeners who will
* be notified when the widget is disposed.
*
* @param listener the listener which should no longer be notified
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
* </ul>
* @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>
*
* @see DisposeListener
* @see #addDisposeListener
*/
public void removeDisposeListener (DisposeListener listener) {
checkWidget ();
if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
if (eventTable == null) return;
eventTable.unhook (SWT.Dispose, listener);
}
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
void checkParent (Widget parent) {
if (parent == null) error (SWT.ERROR_NULL_ARGUMENT);
if (parent.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT);
parent.checkWidget ();
parent.checkOpen ();
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x
/**
* Adds the listener to the collection of listeners who will
* be notified when the widget is disposed. When the widget is
* disposed, the listener is notified by sending it the
* <code>widgetDisposed()</code> message.
*
* @param listener the listener which should be notified when the receiver is disposed
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
* </ul>
* @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>
*
* @see DisposeListener
* @see #removeDisposeListener
*/
public void addDisposeListener (DisposeListener listener) {
checkWidget ();
if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
TypedListener typedListener = new TypedListener (listener);
addListener (SWT.Dispose, typedListener);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc
/**
* Adds the listener to the collection of listeners who will
* be notified when the widget is disposed. When the widget is
* disposed, the listener is notified by sending it the
* <code>widgetDisposed()</code> message.
*
* @param listener the listener which should be notified when the receiver is disposed
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
* </ul>
* @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>
*
* @see DisposeListener
* @see #removeDisposeListener
*/
public void addDisposeListener (DisposeListener listener) {
checkWidget ();
if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
TypedListener typedListener = new TypedListener (listener);
addListener (SWT.Dispose, typedListener);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x
/**
* Throws an exception if the specified widget can not be
* used as a parent for the receiver.
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
* <li>ERROR_INVALID_ARGUMENT - if the parent is disposed</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
* </ul>
*/
void checkParent (Widget parent) {
if (parent == null) error (SWT.ERROR_NULL_ARGUMENT);
if (parent.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT);
parent.checkWidget ();
parent.checkOpen ();
}
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
void checkParent (Widget parent) {
// A null parent is okay when the app menu bar is in use.
if (parent == null && Display.getDefault().appMenuBar == null) error (SWT.ERROR_NULL_ARGUMENT);
if (parent != null) {
if (parent.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT);
parent.checkWidget ();
parent.checkOpen ();
}
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
/**
* Throws an exception if the specified widget can not be
* used as a parent for the receiver.
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
* <li>ERROR_INVALID_ARGUMENT - if the parent is disposed</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
* </ul>
*/
void checkParent (Widget parent) {
if (parent == null) error (SWT.ERROR_NULL_ARGUMENT);
if (parent.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT);
parent.checkWidget ();
parent.checkOpened ();
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc
/**
* Throws an exception if the specified widget can not be
* used as a parent for the receiver.
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
* <li>ERROR_INVALID_ARGUMENT - if the parent is disposed</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
* </ul>
*/
void checkParent (Widget parent) {
if (parent == null) error (SWT.ERROR_NULL_ARGUMENT);
if (parent.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT);
parent.checkWidget ();
parent.checkOpen ();
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc
/**
* Throws an exception if the specified widget can not be
* used as a parent for the receiver.
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
* <li>ERROR_INVALID_ARGUMENT - if the parent is disposed</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
* </ul>
*/
void checkParent (Widget parent) {
if (parent == null) error (SWT.ERROR_NULL_ARGUMENT);
if (parent.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT);
parent.checkWidget ();
parent.checkOpen ();
}
内容来源于网络,如有侵权,请联系作者删除!