/** 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);
  }
 /**
  * Parses a bunlde's manifest into a dictionary. The bundle may be in a jar or in a directory at
  * the specified location.
  *
  * @param bundleLocation root location of the bundle
  * @return bundle manifest dictionary or <code>null</code> if none
  * @throws IOException if unable to parse
  */
 protected Map loadManifest(File bundleLocation) throws IOException {
   ZipFile jarFile = null;
   InputStream manifestStream = null;
   String extension = new Path(bundleLocation.getName()).getFileExtension();
   try {
     if (extension != null && extension.equals("jar") && bundleLocation.isFile()) { // $NON-NLS-1$
       jarFile = new ZipFile(bundleLocation, ZipFile.OPEN_READ);
       ZipEntry manifestEntry = jarFile.getEntry(JarFile.MANIFEST_NAME);
       if (manifestEntry != null) {
         manifestStream = jarFile.getInputStream(manifestEntry);
       }
     } else {
       File file = new File(bundleLocation, JarFile.MANIFEST_NAME);
       if (file.exists()) manifestStream = new FileInputStream(file);
     }
     if (manifestStream == null) {
       return null;
     }
     return ManifestElement.parseBundleManifest(manifestStream, new Hashtable(10));
   } catch (BundleException e) {
     PDEPlugin.log(e);
   } finally {
     try {
       if (manifestStream != null) {
         manifestStream.close();
       }
     } catch (IOException e) {
       PDEPlugin.log(e);
     }
     try {
       if (jarFile != null) {
         jarFile.close();
       }
     } catch (IOException e) {
       PDEPlugin.log(e);
     }
   }
   return null;
 }