當前位置: 首頁>>代碼示例>>Java>>正文


Java Widget.isDisposed方法代碼示例

本文整理匯總了Java中org.eclipse.swt.widgets.Widget.isDisposed方法的典型用法代碼示例。如果您正苦於以下問題:Java Widget.isDisposed方法的具體用法?Java Widget.isDisposed怎麽用?Java Widget.isDisposed使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.swt.widgets.Widget的用法示例。


在下文中一共展示了Widget.isDisposed方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: checkWidget

import org.eclipse.swt.widgets.Widget; //導入方法依賴的package包/類
public static boolean checkWidget(Observer<?> observer, Widget widget) {
	if (null == widget) {
		observer.onError(new NullPointerException("The given widget was null"));
		return false;
	} else if (widget.isDisposed()) {
		observer.onError(new IllegalStateException("The given widget is diposed"));
		return false;
	} else if (!(Thread.currentThread().equals(widget.getDisplay().getThread()))) {
		observer.onError(new IllegalStateException(
				"Expected to be called on the main thread but was " + Thread.currentThread().getName()));
		return false;
	}
	return true;
}
 
開發者ID:SimonScholz,項目名稱:RxSWT,代碼行數:15,代碼來源:Preconditions.java

示例2: subInvoke

import org.eclipse.swt.widgets.Widget; //導入方法依賴的package包/類
@Override
protected Object subInvoke(Object proxy, Method method, Object[] args) throws Throwable {

    Display currentDisplay = Display.getCurrent();
    Display widgetDisplay = null;

    Widget widget = getWidget();
    if (widget != null) {
        if (widget.isDisposed()) {
            // System.err.println("ERROR:  Invoking: " + method.getName() + " on Widget: " + widget +
            // " which is disposed.");
            return null;
        }
        widgetDisplay = widget.getDisplay();
    }

    if (currentDisplay == null && widgetDisplay == null) {
        // The current thread is not a UI thread but no widget display was provided so...
        return baseInvoke(proxy, method, args);
    }
    else if (currentDisplay != null && (widgetDisplay == null || currentDisplay == widgetDisplay)) {
        // Current thread is the widget's UI thread (or at least *a* UI thread).
        return baseInvoke(proxy, method, args);
    }
    else {
        // Current thread is not the widget's UI thread.

        IBaseInvokeRunnable runnable = createBaseInvokeRunnable(proxy, method, args);

        if (isAsync()) {
            widgetDisplay.asyncExec(runnable);
            return null;
        }

        widgetDisplay.syncExec(runnable);
        Throwable error = runnable.getError();
        if (error != null) {
            throw error;
        }
        return runnable.getResult();
    }
}
 
開發者ID:baloise,項目名稱:eZooKeeper,代碼行數:43,代碼來源:SwtThreadSafeDelegatingInvocationHandler.java

示例3: dispose

import org.eclipse.swt.widgets.Widget; //導入方法依賴的package包/類
/**
 * Disposes the widget argument. Has no effect if the widget argument is either {@code null} or already
 * {@link Widget#isDisposed() disposed}.
 *
 * @param widget
 *            the widget to dispose. Optional, can be {@code null}.
 */
public static void dispose(final Widget widget) {
	if (null != widget && !widget.isDisposed()) {
		widget.dispose();
	}
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:13,代碼來源:UIUtils.java


注:本文中的org.eclipse.swt.widgets.Widget.isDisposed方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。