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


Java Display.isDisposed方法代碼示例

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


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

示例1: runEventLoop

import org.eclipse.swt.widgets.Display; //導入方法依賴的package包/類
private void runEventLoop(Shell loopShell) {
	Display display;
	if (getShell() == null) {
		display = Display.getCurrent();
	} else {
		display = loopShell.getDisplay();
	}

	while (loopShell != null && !loopShell.isDisposed()) {
		try {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		} catch (Throwable e) {
			EclipseUtil.logError("UI problems on dispatch",e);
		}
	}
	if (!display.isDisposed()) {
		display.update();
	}
}
 
開發者ID:de-jcup,項目名稱:eclipse-batch-editor,代碼行數:22,代碼來源:AbstractQuickDialog.java

示例2: 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

示例3: 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

示例4: showError

import org.eclipse.swt.widgets.Display; //導入方法依賴的package包/類
private void showError ( final IStatus status )
{
    if ( !status.matches ( IStatus.ERROR ) )
    {
        return;
    }

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

            @Override
            public void run ()
            {
                if ( !display.isDisposed () )
                {
                    ErrorDialog.openError ( PlatformUI.getWorkbench ().getActiveWorkbenchWindow ().getShell (), "Connection error", "Connection failed", status, IStatus.ERROR );
                }
            }
        } );
    }
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:24,代碼來源:ConnectionManager.java

示例5: setStyle

import org.eclipse.swt.widgets.Display; //導入方法依賴的package包/類
@Override
public void setStyle ( final Style style )
{
    final Display display = Display.getDefault ();
    if ( display.isDisposed () )
    {
        return;
    }

    Display.getDefault ().asyncExec ( new Runnable () {

        @Override
        public void run ()
        {
            if ( display.isDisposed () )
            {
                return;
            }
            performSetStyle ( style );
        }
    } );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:23,代碼來源:StyleBlinker.java

示例6: triggerDataUpdate

import org.eclipse.swt.widgets.Display; //導入方法依賴的package包/類
@Override
public void triggerDataUpdate ()
{
    final Display display = getDisplay ();
    if ( display.isDisposed () )
    {
        return;
    }

    getDisplay ().asyncExec ( new Runnable () {
        @Override
        public void run ()
        {
            if ( display.isDisposed () )
            {
                return;
            }

            updateState ();
        }
    } );

}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:24,代碼來源:BlockControlImage.java

示例7: 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

示例8: 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

示例9: 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

示例10: getInstance

import org.eclipse.swt.widgets.Display; //導入方法依賴的package包/類
public static KeyInstanceManager getInstance ( final Display display )
{
    if ( display == null )
    {
        SWT.error ( SWT.ERROR_NULL_ARGUMENT );
    }

    if ( Display.getCurrent () != display )
    {
        SWT.error ( SWT.ERROR_THREAD_INVALID_ACCESS );
    }

    if ( display.isDisposed () )
    {
        SWT.error ( SWT.ERROR_DEVICE_DISPOSED );
    }

    KeyInstanceManager mgr = instanceMap.get ( display );
    if ( mgr != null )
    {
        return mgr;
    }

    mgr = new KeyInstanceManager ( display );
    instanceMap.put ( display, mgr );

    display.disposeExec ( new Runnable () {

        @Override
        public void run ()
        {
            disposeDisplay ( display );
        }
    } );

    return mgr;
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:38,代碼來源:KeyInstanceManager.java

示例11: checkDisplay

import org.eclipse.swt.widgets.Display; //導入方法依賴的package包/類
public static boolean checkDisplay(Observer<?> observer, Display display) {
	if (null == display) {
		observer.onError(new NullPointerException("The given widget was null"));
		return false;
	} else if (display.isDisposed()) {
		observer.onError(new IllegalStateException("The given widget is diposed"));
		return false;
	} else if (!(Thread.currentThread().equals(display.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

示例12: 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

示例13: update

import org.eclipse.swt.widgets.Display; //導入方法依賴的package包/類
private void update(CopyOnWriteList<UIUpdatable> updateables, boolean is_visible ) {
	long start = 0;
	Map<UIUpdatable, Long> mapTimeMap = DEBUG_TIMER ? new HashMap<UIUpdatable, Long>() : null;

	Display display = Utils.getDisplay();
	if (display == null || display.isDisposed()) {
		return;
	}

	for ( UIUpdatable updateable: updateables ){
		try {
			if (DEBUG_TIMER) {
				start = SystemTime.getCurrentTime();
			}
			if ( updateable instanceof UIUpdatableAlways ){
				((UIUpdatableAlways)updateable).updateUI(is_visible);
			}else{
				updateable.updateUI();
			}

			if (DEBUG_TIMER) {
				long diff = SystemTime.getCurrentTime() - start;
				if (diff > 0) {
					mapTimeMap.put(updateable, new Long(diff));
				}
			}
		} catch (Throwable t) {
			Logger.log(new LogEvent(LOGID,
					"Error while trying to update UI Element "
							+ updateable.getUpdateUIName(), t));
		}
	}
	if (DEBUG_TIMER) {
		makeDebugToolTip(mapTimeMap);
	}
}
 
開發者ID:BiglySoftware,項目名稱:BiglyBT,代碼行數:37,代碼來源:UIUpdaterSWT.java

示例14: selectNetworks

import org.eclipse.swt.widgets.Display; //導入方法依賴的package包/類
@Override
public String[]
selectNetworks(
	final String	description,
	final String[]	tracker_networks )
{
	final Display	display = Utils.getDisplay();

	if ( display.isDisposed()){

		return( null );
	}

	final AESemaphore	sem = new AESemaphore("NetworkClassifier");

	final classifierDialog[]	dialog = new classifierDialog[1];

	try{
		Utils.execSWTThread(
			new AERunnable()
			{
				@Override
				public void
				runSupport()
				{
					dialog[0] = new classifierDialog( sem, display, description, tracker_networks );
				}
			});
	}catch( Throwable e ){

		Debug.printStackTrace( e );

		return( null );
	}

	sem.reserve();

	return( dialog[0].getSelection());
}
 
開發者ID:BiglySoftware,項目名稱:BiglyBT,代碼行數:40,代碼來源:SWTNetworkSelection.java


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