コード例 #1
0
  /**
   * ggu Comment method "convertFormat".
   *
   * @param contextParameterType
   * @return
   */
  public static String convertFormat(String contextParameterType) {
    String newType = null;

    final ECodeLanguage codeLanguage = LanguageManager.getCurrentLanguage();
    if (codeLanguage == ECodeLanguage.JAVA) {
      String[] values = ContextParameterJavaTypeManager.getJavaTypesLabels();
      newType = contextParameterType.substring(3, contextParameterType.length());
      for (String format : values) {
        if (format.indexOf(ContextConstant.DOWNWARDS_STRING) != -1) {
          String[] formats = format.split(ContextConstant.SPLIT_CHAR);
          for (String aformat : formats) {
            if (newType.trim().equals(aformat.trim())) {
              return format;
            }
          }
        } else {
          if (newType.trim().equals(format.trim())) {
            return format;
          }
        }
      }
    } else {
      String[] values = ContextParameterJavaTypeManager.getPerlTypesLabels();
      if ("".equals(contextParameterType)) { // $NON-NLS-1$
        newType = ""; // $NON-NLS-1$
      } else {
        newType = contextParameterType;
      }
      for (String format : values) {
        if (format.indexOf(ContextConstant.DOWNWARDS_STRING) != -1) {
          String[] formats = format.split(ContextConstant.SPLIT_CHAR);
          for (String aformat : formats) {
            if (newType.trim().equals(aformat.trim())) {
              return format;
            }
          }
        } else {
          if (newType.trim().equals(format.trim())) {
            return format;
          }
        }
      }
    }
    return ""; //$NON-NLS-1$
  }