void initResources() { final java.lang.Class clazz = this.getClass(); if (resourceBundle != null) { try { if (images == null) { images = new org.eclipse.swt.graphics.Image[imageLocations.length]; for (int i = 0; i < imageLocations.length; ++i) { java.io.InputStream sourceStream = clazz.getResourceAsStream(imageLocations[i]); org.eclipse.swt.graphics.ImageData source = new org.eclipse.swt.graphics.ImageData(sourceStream); org.eclipse.swt.graphics.ImageData mask = source.getTransparencyMask(); images[i] = new org.eclipse.swt.graphics.Image(null, source, mask); try { sourceStream.close(); } catch (java.io.IOException e) { e.printStackTrace(); } } } return; } catch (java.lang.Throwable t) { } } java.lang.String error = resourceBundle != null ? getResourceString("error.CouldNotLoadResources") : "Unable to load resources"; freeResources(); throw new java.lang.RuntimeException(error); }
public void initResources() { final java.lang.Class clazz = org.eclipse.swt.examples.paint.PaintExample.class; if (resourceBundle != null) { try { for (int i = 0; i < tools.length; ++i) { org.eclipse.swt.examples.paint.Tool tool = tools[i]; java.lang.String id = tool.group + '.' + tool.name; java.io.InputStream sourceStream = clazz.getResourceAsStream(getResourceString(id + ".image")); org.eclipse.swt.graphics.ImageData source = new org.eclipse.swt.graphics.ImageData(sourceStream); org.eclipse.swt.graphics.ImageData mask = source.getTransparencyMask(); tool.image = new org.eclipse.swt.graphics.Image(null, source, mask); try { sourceStream.close(); } catch (java.io.IOException e) { e.printStackTrace(); } } return; } catch (java.lang.Throwable t) { } } java.lang.String error = resourceBundle != null ? getResourceString("error.CouldNotLoadResources") : "Unable to load resources"; freeResources(); throw new java.lang.RuntimeException(error); }
public org.eclipse.swt.widgets.Shell open(org.eclipse.swt.widgets.Display display) { java.lang.Class clazz = org.eclipse.swt.examples.hoverhelp.HoverHelp.class; try { if (images == null) { images = new org.eclipse.swt.graphics.Image[imageLocations.length]; for (int i = 0; i < imageLocations.length; ++i) { java.io.InputStream stream = clazz.getResourceAsStream(imageLocations[i]); org.eclipse.swt.graphics.ImageData source = new org.eclipse.swt.graphics.ImageData(stream); org.eclipse.swt.graphics.ImageData mask = source.getTransparencyMask(); images[i] = new org.eclipse.swt.graphics.Image(display, source, mask); try { stream.close(); } catch (java.io.IOException e) { e.printStackTrace(); } } } } catch (java.lang.Exception ex) { System.err.println( getResourceString( "error.CouldNotLoadResources", new java.lang.Object[] {ex.getMessage()})); return null; } org.eclipse.swt.widgets.Shell shell = new org.eclipse.swt.widgets.Shell(); createPartControl(shell); shell.addDisposeListener( new org.eclipse.swt.events.DisposeListener() { public void widgetDisposed(org.eclipse.swt.events.DisposeEvent e) { if (images != null) { for (int i = 0; i < images.length; i++) { final org.eclipse.swt.graphics.Image image = images[i]; if (image != null) { image.dispose(); } } images = null; } } }); shell.pack(); shell.open(); return shell; }