/** 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);
  }
 /** Disposes of all resources associated with a particular instance of the ControlExample. */
 public void dispose() {
   /*
    * Destroy any shells that may have been created
    * by the Shells tab.  When a shell is disposed,
    * all child shells are also disposed.  Therefore
    * it is necessary to check for disposed shells
    * in the shells list to avoid disposing a shell
    * twice.
    */
   if (shellTab != null) shellTab.closeAllShells();
   shellTab = null;
   tabFolder = null;
   freeResources();
 }