/**
  * Returns a String that displays stereotypes (using their simple name or their qualified name)
  * and their properties
  *
  * @param editPart the edit part for which the label is edited
  * @param separator the separator used to split the string representing the stereotypes.
  * @param stereotypesToDisplay the list of stereotypes displayed
  * @param stereotypeWithQualifiedName the list of stereotypes displayed using their qualified
  *     names
  * @param stereotypesPropertiesToDisplay the list of properties to display
  * @return a string that displays stereotypes (using their simple name or their qualified name)
  *     and their properties
  */
 public String stereotypesAndPropertiesToDisplay(
     GraphicalEditPart editPart,
     String separator,
     String stereotypesToDisplay,
     String stereotypeWithQualifiedName,
     String stereotypesPropertiesToDisplay) {
   // Get the preference from PreferenceStore. there should be an assert
   final IPreferenceStore store = Activator.getDefault().getPreferenceStore();
   if (store == null) {
     Activator.log.warn("The preference store was not found");
     return "";
   }
   // retrieve if the name of the stereotype has to put to lower case or
   // not
   String sNameAppearance =
       store.getString(UMLVisualInformationPapyrusConstant.P_STEREOTYPE_NAME_APPEARANCE);
   // changes the string of properties into a map, where the entries of the
   // map are the
   // stereotype qualified name, and the properties to display are the data
   Map<String, List<String>> propertiesToDisplay =
       parseStereotypeProperties(editPart, stereotypesToDisplay, stereotypesPropertiesToDisplay);
   StringTokenizer strQualifiedName = new StringTokenizer(stereotypesToDisplay, ",");
   String out = "";
   while (strQualifiedName.hasMoreElements()) {
     String currentStereotype = strQualifiedName.nextToken();
     // check if current stereotype is applied
     final Element umlElement = getUMLElement(editPart);
     Stereotype stereotype = umlElement.getAppliedStereotype(currentStereotype);
     if (stereotype != null) {
       String name = currentStereotype;
       if ((stereotypeWithQualifiedName.indexOf(currentStereotype)) == -1) {
         // property value contains qualifiedName ==> extract name
         // from it
         StringTokenizer strToken = new StringTokenizer(currentStereotype, "::");
         while (strToken.hasMoreTokens()) {
           name = strToken.nextToken();
         }
       }
       // AL Changes Feb. 07 - Beg
       // Handling STEREOTYPE_NAME_APPEARANCE preference (from
       // ProfileApplicationPreferencePage)
       // Previously lowercase forced onto first letter (standard UML)
       // stereotypesToDisplay = stereotypesToDisplay+name.substring(0,
       // 1).toLowerCase()+name.substring(1,
       // name.length())+","+separator;
       // check that the name has not already been added to the
       // displayed string
       if (sNameAppearance.equals(
           UMLVisualInformationPapyrusConstant.P_STEREOTYPE_NAME_DISPLAY_USER_CONTROLLED)) {
         if (out.indexOf(name) == -1) {
           out = out + Activator.ST_LEFT + name + Activator.ST_RIGHT + separator;
         }
       } else { // VisualInformationPapyrusConstants.P_STEREOTYPE_NAME_DISPLAY_UML_CONFORM))
         // {
         name = name.substring(0, 1).toLowerCase() + name.substring(1, name.length());
         if (out.indexOf(name) == -1) {
           out = out + Activator.ST_LEFT + name + Activator.ST_RIGHT + separator;
         }
       }
       // now should add all properties associated to this stereotype
       List<String> properties = propertiesToDisplay.get(stereotype.getQualifiedName());
       if (properties != null) {
         // retrieve property
         for (String propertyName : properties) {
           out =
               out
                   + StereotypeUtil.displayPropertyValue(
                       stereotype,
                       StereotypeUtil.getPropertyByName(stereotype, propertyName),
                       getUMLElement(editPart),
                       " ");
         }
       }
     }
   }
   if (out.endsWith(",")) {
     return out.substring(0, out.length() - 1);
   }
   if (out.endsWith(separator)) {
     return out.substring(0, out.length() - separator.length());
   }
   return out;
 }