private static void renderImage( Shell shell ) { if( ( shell.getStyle() & SWT.TITLE ) != 0 ) { Image image = shell.getImage(); if( image == null ) { Image[] defaultImages = shell.getImages(); if( defaultImages.length > 0 ) { image = defaultImages[0]; } } renderProperty( shell, PROP_IMAGE, image, null ); } }
private static void writeImage( final Shell shell ) throws IOException { if( ( shell.getStyle() & SWT.TITLE ) != 0 ) { Image image = shell.getImage(); if( image == null ) { Image[] defaultImages = shell.getImages(); if( defaultImages.length > 0 ) { image = defaultImages[0]; } } if( WidgetLCAUtil.hasChanged( shell, PROP_IMAGE, image, null ) ) { JSWriter writer = JSWriter.getWriterFor( shell ); writer.set( JSConst.QX_FIELD_ICON, ImageFactory.getImagePath( image ) ); } } }
public static Image getWorkbenchShellImage(int maximumHeight) { // always use the launching workbench window IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows(); if (windows != null && windows.length > 0) { IWorkbenchWindow workbenchWindow = windows[0]; if (workbenchWindow != null && !workbenchWindow.getShell().isDisposed()) { Image image = getShell().getImage(); int diff = Integer.MAX_VALUE; if (image != null && image.getBounds().height <= maximumHeight) { diff = maximumHeight - image.getBounds().height; } else { image = null; } Image[] images = getShell().getImages(); if (images != null && images.length > 0) { // find the icon that is closest in size, but not larger than maximumHeight for (Image image2 : images) { int newDiff = maximumHeight - image2.getBounds().height; if (newDiff >= 0 && newDiff <= diff) { diff = newDiff; image = image2; } } } return image; } } return null; }