Exemplo n.º 1
0
  /**
   * Return the path of the given icon file small image.
   *
   * @param type The node type
   * @return a String representing the path to the given icon file.
   * @see IUIConstants
   */
  public static String getSmallPath(int type) {

    int idx = UINodeTypeManager.getImageIndexForType(type);

    String sPath = ""; // $NON-NLS-1$
    String skin = FormatProperties.skin;

    // Old skins sets have gif files, new ones have png - so need to check.
    // Also handle skin missing by getting image from images folder.

    // Check if the icon is a png file
    sPath = sNODEPATH + skin + sFS + DEFAULT_IMG_NAMES[idx];
    File fileCheck1 = new File(sPath);
    if (!fileCheck1.exists()) {
      // check if file is a gif
      sPath = sNODEPATH + skin + sFS + IMG_NAMES[idx];
      File fileCheck = new File(sPath);
      if (!fileCheck.exists()) {
        // if image not found, try getting the image from the default skin
        sPath = sDEFAULTNODEPATH + sFS + DEFAULT_IMG_NAMES[idx];
        fileCheck = new File(sPath);
        if (!fileCheck.exists()) {
          // If all else fails, get the backup images in the images folder
          sPath = sPATH + DEFAULT_IMG_NAMES[idx];
        }
      }
    }

    return sPath;
  }
Exemplo n.º 2
0
 /**
  * Return the standard size icon for the given node type.
  *
  * @param type, the node type to return the icon for.
  * @return ImageIcon, the icon for the given node type.
  */
 public static ImageIcon getNodeImage(int type) {
   return UINodeTypeManager.getNodeImage(type);
 }