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); }
private static <T> T __check_arg__(java.lang.Class<T> expectedClass, Object argument) { T result = null; if (java.lang.Integer.class.equals(expectedClass) && argument instanceof Double) { result = (T) new java.lang.Integer(((Double) argument).intValue()); } else if (java.lang.Float.class.equals(expectedClass) && argument instanceof Double) { result = (T) new java.lang.Float(((Double) argument).floatValue()); } else { try { result = expectedClass.cast(argument); } catch (Throwable ex) { throw new IllegalArgumentException( String.format( "Bad parameter type in call to %s. Found '%s' when expected '%s'.", "nbActions", argument.getClass().getName(), expectedClass.getName())); } } return result; }
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; }
public java.lang.Class getClass(java.lang.String name, java.lang.Class defaultValue) { java.lang.String className = null; if (defaultValue == null) { className = this.getString(name, name); } else { className = this.getString(name, defaultValue.getName()); } java.lang.Class retClass = null; try { retClass = Class.forName(className); } catch (java.lang.ClassNotFoundException e) { retClass = defaultValue; } return retClass; }
/** Compiles and loads a hierarchy, starting at 'type' */ public java.lang.Class<?> compileAndLoad(Type type) throws ClassNotFoundException { ClassLoader loader = compile(type); return java.lang.Class.forName(type.getName(), false, loader); }