/** Loads the resources */ void initResources() { final Class<ControlExample> clazz = ControlExample.class; if (resourceBundle != null) { try { if (images == null) { images = new Image[imageLocations.length]; for (int i = 0; i < imageLocations.length; ++i) { InputStream sourceStream = clazz.getResourceAsStream(imageLocations[i]); ImageData source = new ImageData(sourceStream); if (imageTypes[i] == SWT.ICON) { ImageData mask = source.getTransparencyMask(); images[i] = new Image(null, source, mask); } else { images[i] = new Image(null, source); } try { sourceStream.close(); } catch (IOException e) { e.printStackTrace(); } } } return; } catch (Throwable t) { } } String error = (resourceBundle != null) ? getResourceString("error.CouldNotLoadResources") : "Unable to load resources"; //$NON-NLS-1$ freeResources(); throw new RuntimeException(error); }
private void launchEditor(TableItem item) { String theCommand = resUser.getString("Custom_editor"); theCommand = theCommand.replaceAll("%file%", item.getText(3)); theCommand = theCommand.replaceAll("%line%", item.getText(1)); theCommand = theCommand.replace('/', File.separatorChar); theCommand = theCommand.replaceAll("%slash%", "/"); try { Runtime.getRuntime().exec(theCommand); } catch (IOException e) { displayError("Error launching editor: " + e.getMessage()); } }