当前位置: 首页>>代码示例>>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;未经允许,请勿转载。