예제 #1
0
  public static String getImageURL(int mode, AppW app) {

    //		String modeText = app.getKernel().getModeText(mode);
    //		// bugfix for Turkish locale added Locale.US
    //		String iconName = "mode_" +StringUtil.toLowerCase(modeText)
    //				+ "_32";
    //

    // macro
    if (mode >= EuclidianConstants.MACRO_MODE_ID_OFFSET) {
      int macroID = mode - EuclidianConstants.MACRO_MODE_ID_OFFSET;
      try {
        Macro macro = app.getKernel().getMacro(macroID);
        String iconName = macro.getIconFileName();
        if (iconName == null || iconName.length() == 0) {
          // default icon
          return safeURI(myIconResourceBundle.mode_tool_32());
        }
        // use image as icon
        Image img = new NoDragImage(app.getImageManager().getExternalImageSrc(iconName), 32);
        return img.getUrl();
      } catch (Exception e) {
        App.debug("macro does not exist: ID = " + macroID);
        return "";
      }
    }

    return safeURI(getImageURLNotMacro(mode));
  }