当前位置: 首页>>代码示例>>Java>>正文


Java Display.asyncExec方法代码示例

本文整理汇总了Java中org.eclipse.swt.widgets.Display.asyncExec方法的典型用法代码示例。如果您正苦于以下问题:Java Display.asyncExec方法的具体用法?Java Display.asyncExec怎么用?Java Display.asyncExec使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.swt.widgets.Display的用法示例。


在下文中一共展示了Display.asyncExec方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: triggerErrorLabel

import org.eclipse.swt.widgets.Display; //导入方法依赖的package包/类
private void triggerErrorLabel ( final String string )
{
    final Display d = this.errorLabel.getDisplay ();
    if ( !d.isDisposed () )
    {
        d.asyncExec ( new Runnable () {

            @Override
            public void run ()
            {
                if ( !GeneratorView.this.errorLabel.isDisposed () )
                {
                    GeneratorView.this.errorLabel.setText ( string );
                }
            }
        } );
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:19,代码来源:GeneratorView.java

示例2: notifyError

import org.eclipse.swt.widgets.Display; //导入方法依赖的package包/类
/**
 * Notify error using message box (thread safe).
 * @param message The message to display
 * @param error The error that occurred
 */
public void notifyError ( final String message, final Throwable error )
{
    final Display display = getWorkbench ().getDisplay ();

    if ( !display.isDisposed () )
    {
        display.asyncExec ( new Runnable () {

            @Override
            public void run ()
            {
                final Shell shell = getWorkbench ().getActiveWorkbenchWindow ().getShell ();
                logger.debug ( "Shell disposed: {}", shell.isDisposed () );
                if ( !shell.isDisposed () )
                {
                    final IStatus status = new OperationStatus ( IStatus.ERROR, PLUGIN_ID, 0, message + ":" + error.getMessage (), error );
                    ErrorDialog.openError ( shell, null, message, status );
                }
            }
        } );
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:28,代码来源:Activator.java

示例3: handleSetResult

import org.eclipse.swt.widgets.Display; //导入方法依赖的package包/类
protected void handleSetResult ( final FactoryInformation factory, final String connectionUri )
{
    final Display display = getSite ().getShell ().getDisplay ();
    if ( !display.isDisposed () )
    {
        display.asyncExec ( new Runnable () {

            @Override
            public void run ()
            {
                if ( !display.isDisposed () )
                {
                    setResult ( factory, connectionUri );
                }
            }
        } );
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:19,代码来源:FactoryEditor.java

示例4: messageBoxWithoutReturnCode

import org.eclipse.swt.widgets.Display; //导入方法依赖的package包/类
private static void messageBoxWithoutReturnCode(final String message, int options) {
	final Display display = getDisplay();
	
	Runnable runnable = new Runnable() {
		public void run() {
			try {
				messageBox(null, message, SWT.OK | SWT.ICON_INFORMATION);
			}
			catch (Exception e){
				ConvertigoPlugin.logException(e, "Error while trying to open message box");
			}
		};
	};
	
	if (display.getThread() != Thread.currentThread()) {
		display.asyncExec(runnable);		
	} else {
		display.syncExec(runnable);
	}
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:21,代码来源:ConvertigoPlugin.java

示例5: asyncRefreshCommonViewer

import org.eclipse.swt.widgets.Display; //导入方法依赖的package包/类
private void asyncRefreshCommonViewer(final ProjectExplorer explorer, final boolean resetInput) {

		// do deferred initialization
		this.getWorkingSetManagers().stream()
				.filter(m -> (m instanceof IDeferredInitializer))
				.map(m -> (IDeferredInitializer) m)
				.filter(m -> m.isInitializationRequired())
				.forEach(m -> {
					m.lateInit();
				});

		final CommonViewer viewer = explorer.getCommonViewer();
		final Display d = getDisplay();
		if (!d.isDisposed()) {
			if (resetInput) {
				d.asyncExec(() -> {
					if (!viewer.getTree().isDisposed())
						viewer.setInput(viewer.getInput());
				});
			} else {
				d.asyncExec(() -> {
					if (!viewer.getTree().isDisposed())
						viewer.refresh(true);
				});
			}
		}
	}
 
开发者ID:eclipse,项目名称:n4js,代码行数:28,代码来源:WorkingSetManagerBrokerImpl.java

示例6: stopEclipseUI

import org.eclipse.swt.widgets.Display; //导入方法依赖的package包/类
/**
 * Stop Eclipse UI.
 */
private void stopEclipseUI() {
	
	if (PlatformUI.isWorkbenchRunning()==false) return;
	
	final IWorkbench workbench = PlatformUI.getWorkbench();
	final Display display = workbench.getDisplay();
	display.asyncExec(new Runnable() {
		public void run() {
			if (!display.isDisposed()) {
				workbench.close();
			}
		}
	});
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:18,代码来源:PlugInApplication.java

示例7: fireChangeEvent

import org.eclipse.swt.widgets.Display; //导入方法依赖的package包/类
protected final void fireChangeEvent ( final Collection<?> changes )
{

    final LabelProviderChangedEvent event = new LabelProviderChangedEvent ( ViewerLabelProvider.this, changes.toArray () );
    final ILabelProviderListener[] listenerArray = ViewerLabelProvider.this.listeners.toArray ( new ILabelProviderListener[ViewerLabelProvider.this.listeners.size ()] );

    final Display display = getDisplay ();
    if ( !display.isDisposed () )
    {
        display.asyncExec ( new Runnable () {

            public void run ()
            {
                for ( final ILabelProviderListener listener : listenerArray )
                {
                    try
                    {
                        listener.labelProviderChanged ( event );
                    }
                    catch ( final Exception e )
                    {
                        Policy.getLog ().log ( new Status ( IStatus.ERROR, Policy.JFACE_DATABINDING, e.getLocalizedMessage (), e ) );
                    }
                }

            }
        } );

    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:31,代码来源:ViewerLabelProvider.java

示例8: slow

import org.eclipse.swt.widgets.Display; //导入方法依赖的package包/类
public static void slow(SWTAsync t) {
    t.logTimeStats = false;
    if (inDisplayThread()) {
        t.run();
    } else {
        Display d2 = Application.display;
        d2.asyncExec(t);
    }
}
 
开发者ID:openaudible,项目名称:openaudible,代码行数:10,代码来源:SWTAsync.java

示例9: ConfirmationDialogFuture

import org.eclipse.swt.widgets.Display; //导入方法依赖的package包/类
public ConfirmationDialogFuture ( final Display display, final Shell parentShell, final Callback[] callbacks, final String dialogTitle )
{
    display.asyncExec ( new Runnable () {

        @Override
        public void run ()
        {
            openDialog ( display, parentShell, callbacks, dialogTitle );
        }
    } );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:12,代码来源:ConfirmationDialogFuture.java

示例10: setTextLabel

import org.eclipse.swt.widgets.Display; //导入方法依赖的package包/类
public void setTextLabel(String text) {
	final Display display = getParentShell().getDisplay();
	final String labelText = text;
	display.asyncExec(new Runnable() {
		public void run() {
			if (!labelProgression.isDisposed())
				labelProgression.setText(labelText);
		}
	});
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:11,代码来源:ProjectDeployDialog.java

示例11: run

import org.eclipse.swt.widgets.Display; //导入方法依赖的package包/类
public static void run(Display d, SWTAsync t) {
    if (inDisplayThread()) {
        t.run();
    } else {
        d.asyncExec(t);
    }
}
 
开发者ID:openaudible,项目名称:openaudible,代码行数:8,代码来源:SWTAsync.java

示例12: resolvedAction

import org.eclipse.swt.widgets.Display; //导入方法依赖的package包/类
private Consumer<QuickAccessElement> resolvedAction(Display display, PersistedWorkingSet<QuickAccessElement> historyStore) {
	return (item) -> {
		display.asyncExec(item::execute);
		historyStore.addToHistory(item);
		historyStore.save();
	};
}
 
开发者ID:dakaraphi,项目名称:eclipse-plugin-commander,代码行数:8,代码来源:CommanderHandler.java

示例13: exec

import org.eclipse.swt.widgets.Display; //导入方法依赖的package包/类
public static void exec(Display d, Runnable r) {
    try {
        d.asyncExec(r);
    } catch (SWTException ex) {
        if (ex.code != SWT.ERROR_WIDGET_DISPOSED) {
            throw ex;
        }
        // do nothing: UI is already dead
    }
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:11,代码来源:UiSync.java

示例14: openChat

import org.eclipse.swt.widgets.Display; //导入方法依赖的package包/类
@Override
public void
openChat(
	final ChatInstance chat )
{
	final Display display = Display.getDefault();

	if ( display.isDisposed()){

		return;
	}

	display.asyncExec(
		new Runnable()
		{
			@Override
			public void
			run()
			{
				if ( display.isDisposed()){

					return;
				}

				BuddyPluginViewBetaChat.createChatWindow( BuddyPluginView.this, plugin, chat );
			}
		});
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:29,代码来源:BuddyPluginView.java

示例15: subInvoke

import org.eclipse.swt.widgets.Display; //导入方法依赖的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


注:本文中的org.eclipse.swt.widgets.Display.asyncExec方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。