Java Code Examples for org.eclipse.swt.widgets.Display#disposeExec()

The following examples show how to use org.eclipse.swt.widgets.Display#disposeExec() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
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;
}
 
Example 2
Source Project: swt-bling   File: FontLoader.java    License: MIT License 5 votes vote down vote up
/**
 * Creates an instance of FontLoader with the specified Display
 *
 * @param display
 */
public FontLoader(Display display) {
  this.display = display;

  // Dispose all cached font resources on exit and clean up extracted files if possible
  if (display != null && !display.isDisposed()) {
    display.disposeExec(new Runnable() {
      @Override
      public void run() {
        deleteExtractedFiles();
      }
    });
  }
}