final Display display; if (shell == null || shell.isDisposed()) { shell = getParentShell();
/** * Get an <code>Image</code> from the provide SWT image constant. * * @param imageID * the SWT image constant * @return image the image */ private Image getSWTImage(final int imageID) { Shell shell = getShell(); final Display display; if (shell == null || shell.isDisposed()) { shell = getParentShell(); } if (shell == null || shell.isDisposed()) { display = Display.getCurrent(); // The dialog should be always instantiated in UI thread. // However it was possible to instantiate it in other threads // (the code worked in most cases) so the assertion covers // only the failing scenario. See bug 107082 for details. Assert.isNotNull(display, "The dialog should be created in UI thread"); //$NON-NLS-1$ } else { display = shell.getDisplay(); } final Image[] image = new Image[1]; display.syncExec(() -> image[0] = display.getSystemImage(imageID)); return image[0]; }
/** * Get an <code>Image</code> from the provide SWT image constant. * * @param imageID * the SWT image constant * @return image the image */ private Image getSWTImage(final int imageID) { Shell shell = getShell(); final Display display; if (shell == null || shell.isDisposed()) { shell = getParentShell(); } if (shell == null || shell.isDisposed()) { display = Display.getCurrent(); // The dialog should be always instantiated in UI thread. // However it was possible to instantiate it in other threads // (the code worked in most cases) so the assertion covers // only the failing scenario. See bug 107082 for details. Assert.isNotNull(display, "The dialog should be created in UI thread"); //$NON-NLS-1$ } else { display = shell.getDisplay(); } final Image[] image = new Image[1]; display.syncExec(() -> image[0] = display.getSystemImage(imageID)); return image[0]; }